Skip to content

Commit a8231be

Browse files
authored
Add policy boundary, iam_tags_enabled and update to cloudwatch_logs module (#13)
* adding policy boundary to roles and optional tags * Adding permission boundary * fixing typo * Update cloudwatch-log module and add permission boundary and iam_tags var
1 parent ba40fc9 commit a8231be

File tree

6 files changed

+38
-5
lines changed

6 files changed

+38
-5
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ Available targets:
155155

156156
| Name | Source | Version |
157157
|------|--------|---------|
158-
| <a name="module_cloudwatch_log_group"></a> [cloudwatch\_log\_group](#module\_cloudwatch\_log\_group) | cloudposse/cloudwatch-logs/aws | 0.6.2 |
158+
| <a name="module_cloudwatch_log_group"></a> [cloudwatch\_log\_group](#module\_cloudwatch\_log\_group) | cloudposse/cloudwatch-logs/aws | 0.6.5 |
159159
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
160160

161161
## Resources
@@ -182,6 +182,7 @@ Available targets:
182182
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
183183
| <a name="input_endpoint_type"></a> [endpoint\_type](#input\_endpoint\_type) | The type of the endpoint. One of - PUBLIC, PRIVATE, REGIONAL | `string` | `"REGIONAL"` | no |
184184
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
185+
| <a name="input_iam_tags_enabled"></a> [iam\_tags\_enabled](#input\_iam\_tags\_enabled) | Enable/disable tags on IAM roles and policies | `string` | `true` | no |
185186
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
186187
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
187188
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
@@ -192,6 +193,7 @@ Available targets:
192193
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br>This is the only ID element not also included as a `tag`.<br>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
193194
| <a name="input_namespace"></a> [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
194195
| <a name="input_openapi_config"></a> [openapi\_config](#input\_openapi\_config) | The OpenAPI specification for the API | `any` | `{}` | no |
196+
| <a name="input_permissions_boundary"></a> [permissions\_boundary](#input\_permissions\_boundary) | ARN of the policy that is used to set the permissions boundary for the IAM role | `string` | `""` | no |
195197
| <a name="input_private_link_target_arns"></a> [private\_link\_target\_arns](#input\_private\_link\_target\_arns) | A list of target ARNs for VPC Private Link | `list(string)` | `[]` | no |
196198
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
197199
| <a name="input_rest_api_policy"></a> [rest\_api\_policy](#input\_rest\_api\_policy) | The IAM policy document for the API. | `string` | `null` | no |

docs/terraform.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
| Name | Source | Version |
1818
|------|--------|---------|
19-
| <a name="module_cloudwatch_log_group"></a> [cloudwatch\_log\_group](#module\_cloudwatch\_log\_group) | cloudposse/cloudwatch-logs/aws | 0.6.2 |
19+
| <a name="module_cloudwatch_log_group"></a> [cloudwatch\_log\_group](#module\_cloudwatch\_log\_group) | cloudposse/cloudwatch-logs/aws | 0.6.5 |
2020
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
2121

2222
## Resources
@@ -43,6 +43,7 @@
4343
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
4444
| <a name="input_endpoint_type"></a> [endpoint\_type](#input\_endpoint\_type) | The type of the endpoint. One of - PUBLIC, PRIVATE, REGIONAL | `string` | `"REGIONAL"` | no |
4545
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | `null` | no |
46+
| <a name="input_iam_tags_enabled"></a> [iam\_tags\_enabled](#input\_iam\_tags\_enabled) | Enable/disable tags on IAM roles and policies | `string` | `true` | no |
4647
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
4748
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
4849
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
@@ -53,6 +54,7 @@
5354
| <a name="input_name"></a> [name](#input\_name) | ID element. Usually the component or solution name, e.g. 'app' or 'jenkins'.<br>This is the only ID element not also included as a `tag`.<br>The "name" tag is set to the full `id` string. There is no tag with the value of the `name` input. | `string` | `null` | no |
5455
| <a name="input_namespace"></a> [namespace](#input\_namespace) | ID element. Usually an abbreviation of your organization name, e.g. 'eg' or 'cp', to help ensure generated IDs are globally unique | `string` | `null` | no |
5556
| <a name="input_openapi_config"></a> [openapi\_config](#input\_openapi\_config) | The OpenAPI specification for the API | `any` | `{}` | no |
57+
| <a name="input_permissions_boundary"></a> [permissions\_boundary](#input\_permissions\_boundary) | ARN of the policy that is used to set the permissions boundary for the IAM role | `string` | `""` | no |
5658
| <a name="input_private_link_target_arns"></a> [private\_link\_target\_arns](#input\_private\_link\_target\_arns) | A list of target ARNs for VPC Private Link | `list(string)` | `[]` | no |
5759
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
5860
| <a name="input_rest_api_policy"></a> [rest\_api\_policy](#input\_rest\_api\_policy) | The IAM policy document for the API. | `string` | `null` | no |

main.tf

+5-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ resource "aws_api_gateway_rest_api_policy" "this" {
2727

2828
module "cloudwatch_log_group" {
2929
source = "cloudposse/cloudwatch-logs/aws"
30-
version = "0.6.2"
30+
version = "0.6.5"
31+
32+
enabled = local.create_log_group
33+
iam_tags_enabled = var.iam_tags_enabled
34+
permissions_boundary = var.permissions_boundary
3135

32-
enabled = local.create_log_group
3336
context = module.this.context
3437
}
3538

modules/account-settings/main.tf

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ data "aws_iam_policy_document" "api_gateway_permissions" {
2828

2929
module "role" {
3030
source = "cloudposse/iam-role/aws"
31-
version = "0.14.0"
31+
version = "0.16.1"
3232

3333
enabled = local.create_iam_role
3434
#name = module.iam_role_label.id
@@ -46,6 +46,8 @@ module "role" {
4646
policy_document_count = 1
4747
policy_description = "Allow API Gateway to send logs to CloudWatch IAM policy"
4848
role_description = "Allow API Gateway to send logs to CloudWatch"
49+
permissions_boundary = var.permissions_boundary
50+
tags_enabled = var.iam_tags_enabled
4951

5052
context = module.this.context
5153
}

modules/account-settings/variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,15 @@ variable "iam_role_arn" {
33
description = "ARN of the IAM role for API Gateway to use. If not specified, a new role will be created."
44
default = null
55
}
6+
7+
variable "iam_tags_enabled" {
8+
type = string
9+
description = "Enable/disable tags on IAM roles"
10+
default = true
11+
}
12+
13+
variable "permissions_boundary" {
14+
type = string
15+
default = ""
16+
description = "ARN of the policy that is used to set the permissions boundary for the role"
17+
}

variables.tf

+12
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,15 @@ variable "private_link_target_arns" {
109109
description = "A list of target ARNs for VPC Private Link"
110110
default = []
111111
}
112+
113+
variable "iam_tags_enabled" {
114+
type = string
115+
description = "Enable/disable tags on IAM roles and policies"
116+
default = true
117+
}
118+
119+
variable "permissions_boundary" {
120+
type = string
121+
default = ""
122+
description = "ARN of the policy that is used to set the permissions boundary for the IAM role"
123+
}

0 commit comments

Comments
 (0)