Skip to content

Commit 127b10b

Browse files
authored
fix: Add context tags to the IAM resources (#45)
* fix: Add context tags to the IAM resources Prior to this, the `aws_iam_role` and the `aws_iam_policy` created by this module did not include any of the tags passed via `tags` or via `context`. This fixes that problem by specifying `tags = module.this.tags` on each of those resources so that they use the tags specified determined by the null/label context. * chore: update module boilerplate and docs ``` make init make github/init make readme ```
1 parent 0d85859 commit 127b10b

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

.github/renovate.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"extends": [
33
"config:base",
4-
":preserveSemverRanges"
4+
":preserveSemverRanges",
5+
":rebaseStalePrs"
56
],
6-
"baseBranches": ["main", "master", "/^release\\/v\\d{1,2}$/"],
7+
"baseBranches": ["main"],
78
"labels": ["auto-update"],
89
"dependencyDashboardAutoclose": true,
910
"enabledManagers": ["terraform"],
1011
"terraform": {
11-
"ignorePaths": ["**/context.tf", "examples/**"]
12+
"ignorePaths": ["**/context.tf"]
1213
}
1314
}

.github/workflows/release-branch.yml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- 'docs/**'
1111
- 'examples/**'
1212
- 'test/**'
13+
- 'README.*'
1314

1415
permissions:
1516
contents: write

.github/workflows/release-published.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ permissions:
1111

1212
jobs:
1313
terraform-module:
14-
uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release.yml@main
14+
uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release-published.yml@main

README.md

-4
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ We highly recommend that in your code you pin the version to the exact version y
9090
using so that your infrastructure remains stable, and update versions in a
9191
systematic way so that they do not catch you by surprise.
9292

93-
Also, because of a bug in the Terraform registry ([hashicorp/terraform#21417](https://github.com/hashicorp/terraform/issues/21417)),
94-
the registry shows many of our inputs as required when in fact they are optional.
95-
The table below correctly indicates which inputs are required.
96-
9793

9894
For a complete example, see [examples/complete](examples/complete).
9995
For automated tests of the complete example using [bats](https://github.com/bats-core/bats-core) and [Terratest](https://github.com/gruntwork-io/terratest)

iam-role.tf

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ resource "aws_iam_role" "this" {
22
count = local.enabled ? 1 : 0
33

44
name = "${var.function_name}-${local.region_name}"
5-
assume_role_policy = join("", data.aws_iam_policy_document.assume_role_policy.*.json)
5+
assume_role_policy = join("", data.aws_iam_policy_document.assume_role_policy[*].json)
66
permissions_boundary = var.permissions_boundary
7+
8+
tags = module.this.tags
79
}
810

911
data "aws_iam_policy_document" "assume_role_policy" {
@@ -68,6 +70,8 @@ resource "aws_iam_policy" "ssm" {
6870
name = "${var.function_name}-ssm-policy-${local.region_name}"
6971
description = var.iam_policy_description
7072
policy = data.aws_iam_policy_document.ssm[count.index].json
73+
74+
tags = module.this.tags
7175
}
7276

7377
resource "aws_iam_role_policy_attachment" "ssm" {

0 commit comments

Comments
 (0)