Skip to content

Commit cbf304c

Browse files
authored
Fix ccustom IAM roles (#133)
* We're now using strings rather than objects for the policies - This changes the resources to reflect that
1 parent 4f8137c commit cbf304c

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ for dxw's Dalmatian hosting platform.
139139
| <a name="input_cloudwatch_slack_alerts_kms_encryption"></a> [cloudwatch\_slack\_alerts\_kms\_encryption](#input\_cloudwatch\_slack\_alerts\_kms\_encryption) | Use KMS encryption with the Slack Alerts SNS topic and logs | `bool` | n/a | yes |
140140
| <a name="input_cloudwatch_slack_alerts_log_retention"></a> [cloudwatch\_slack\_alerts\_log\_retention](#input\_cloudwatch\_slack\_alerts\_log\_retention) | Cloudwatch Slack Alerts log retention. Set to 0 to keep all logs | `number` | n/a | yes |
141141
| <a name="input_codestar_connections"></a> [codestar\_connections](#input\_codestar\_connections) | CodeStar connections to create | <pre>map(<br/> object({<br/> provider_type = string,<br/> })<br/> )</pre> | n/a | yes |
142-
| <a name="input_custom_iam_roles"></a> [custom\_iam\_roles](#input\_custom\_iam\_roles) | Configure custom IAM roles/policies | <pre>map(object({<br/> description = string<br/> policies = map(string)<br/> assume_role_policy = string<br/> }))</pre> | n/a | yes |
142+
| <a name="input_custom_iam_roles"></a> [custom\_iam\_roles](#input\_custom\_iam\_roles) | Configure custom IAM roles/policies | <pre>map(object({<br/> description = string<br/> policies = map(object({<br/> description = string<br/> policy = string<br/> }))<br/> assume_role_policy = string<br/> }))</pre> | n/a | yes |
143143
| <a name="input_datadog_api_key"></a> [datadog\_api\_key](#input\_datadog\_api\_key) | Datadog API key | `string` | n/a | yes |
144144
| <a name="input_datadog_app_key"></a> [datadog\_app\_key](#input\_datadog\_app\_key) | Datadog App key | `string` | n/a | yes |
145145
| <a name="input_datadog_region"></a> [datadog\_region](#input\_datadog\_region) | Datadog region | `string` | n/a | yes |

iam-custom-roles.tf

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ resource "aws_iam_role" "custom" {
33

44
name = each.key
55
description = each.value["description"]
6-
assume_role_policy = jsonencode(each.value["assume_role_policy"])
6+
assume_role_policy = each.value["assume_role_policy"]
77
}
88

99
resource "aws_iam_policy" "custom" {
@@ -20,10 +20,7 @@ resource "aws_iam_policy" "custom" {
2020

2121
name = each.value["policy_name"]
2222
description = each.value["policy"]["description"]
23-
policy = jsonencode({
24-
Version = each.value["policy"]["Version"],
25-
Statement = each.value["policy"]["Statement"]
26-
})
23+
policy = each.value["policy"]["policy"]
2724
}
2825

2926
resource "aws_iam_role_policy_attachment" "custom" {

variables.tf

+5-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,11 @@ variable "enable_datadog_aws_integration" {
191191

192192
variable "custom_iam_roles" {
193193
type = map(object({
194-
description = string
195-
policies = map(string)
194+
description = string
195+
policies = map(object({
196+
description = string
197+
policy = string
198+
}))
196199
assume_role_policy = string
197200
}))
198201
description = "Configure custom IAM roles/policies"

0 commit comments

Comments
 (0)