Skip to content

Commit 97af55f

Browse files
authored
feat: Add support tags to additional IAM modules (#144)
1 parent 506ea7b commit 97af55f

File tree

15 files changed

+45
-7
lines changed

15 files changed

+45
-7
lines changed

examples/iam-policy/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ module "iam_policy" {
3434
]
3535
}
3636
EOF
37+
38+
tags = {
39+
PolicyDescription = "Policy created using heredoc policy"
40+
}
3741
}
3842

3943
module "iam_policy_from_data_source" {
@@ -44,4 +48,8 @@ module "iam_policy_from_data_source" {
4448
description = "My example policy"
4549

4650
policy = data.aws_iam_policy_document.bucket_policy.json
51+
52+
tags = {
53+
PolicyDescription = "Policy created using example from data source"
54+
}
4755
}

modules/iam-assumable-role/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ Trusted resources can be any [IAM ARNs](https://docs.aws.amazon.com/IAM/latest/U
1010
| Name | Version |
1111
|------|---------|
1212
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12.6 |
13-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.23 |
13+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.34 |
1414

1515
## Providers
1616

1717
| Name | Version |
1818
|------|---------|
19-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 2.23 |
19+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.34 |
2020

2121
## Modules
2222

modules/iam-assumable-role/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,6 @@ resource "aws_iam_instance_profile" "this" {
108108
name = var.role_name
109109
path = var.role_path
110110
role = aws_iam_role.this[0].name
111+
112+
tags = var.tags
111113
}

modules/iam-assumable-role/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ terraform {
22
required_version = ">= 0.12.6"
33

44
required_providers {
5-
aws = ">= 2.23"
5+
aws = ">= 3.34"
66
}
77
}

modules/iam-group-with-assumable-roles-policy/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ No modules.
3737
| <a name="input_assumable_roles"></a> [assumable\_roles](#input\_assumable\_roles) | List of IAM roles ARNs which can be assumed by the group | `list(string)` | `[]` | no |
3838
| <a name="input_group_users"></a> [group\_users](#input\_group\_users) | List of IAM users to have in an IAM group which can assume the role | `list(string)` | `[]` | no |
3939
| <a name="input_name"></a> [name](#input\_name) | Name of IAM policy and IAM group | `string` | n/a | yes |
40+
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources. | `map(string)` | `{}` | no |
4041

4142
## Outputs
4243

modules/iam-group-with-assumable-roles-policy/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ resource "aws_iam_policy" "this" {
1010
name = var.name
1111
description = "Allows to assume role in another AWS account"
1212
policy = data.aws_iam_policy_document.assume_role.json
13+
14+
tags = var.tags
1315
}
1416

1517
resource "aws_iam_group" "this" {

modules/iam-group-with-assumable-roles-policy/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ variable "group_users" {
1515
default = []
1616
}
1717

18+
variable "tags" {
19+
description = "A map of tags to add to all resources."
20+
type = map(string)
21+
default = {}
22+
}
23+

modules/iam-group-with-policies/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ No modules.
4747
| <a name="input_group_users"></a> [group\_users](#input\_group\_users) | List of IAM users to have in an IAM group which can assume the role | `list(string)` | `[]` | no |
4848
| <a name="input_iam_self_management_policy_name_prefix"></a> [iam\_self\_management\_policy\_name\_prefix](#input\_iam\_self\_management\_policy\_name\_prefix) | Name prefix for IAM policy to create with IAM self-management permissions | `string` | `"IAMSelfManagement-"` | no |
4949
| <a name="input_name"></a> [name](#input\_name) | Name of IAM group | `string` | `""` | no |
50+
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources. | `map(string)` | `{}` | no |
5051

5152
## Outputs
5253

modules/iam-group-with-policies/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ resource "aws_iam_policy" "iam_self_management" {
4848

4949
name_prefix = var.iam_self_management_policy_name_prefix
5050
policy = data.aws_iam_policy_document.iam_self_management.json
51+
52+
tags = var.tags
5153
}
5254

5355
resource "aws_iam_policy" "custom" {
@@ -56,5 +58,7 @@ resource "aws_iam_policy" "custom" {
5658
name = var.custom_group_policies[count.index]["name"]
5759
policy = var.custom_group_policies[count.index]["policy"]
5860
description = lookup(var.custom_group_policies[count.index], "description", null)
61+
62+
tags = var.tags
5963
}
6064

modules/iam-group-with-policies/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,8 @@ variable "aws_account_id" {
4646
default = ""
4747
}
4848

49+
variable "tags" {
50+
description = "A map of tags to add to all resources."
51+
type = map(string)
52+
default = {}
53+
}

0 commit comments

Comments
 (0)