Skip to content

Commit bab3192

Browse files
authored
Update to v5.x of terraform-provider-aws (#27)
Switch this and dependent modules to the v5.x of the Terraform AWS provider to support the latest AWS features, like RDS' io2. - Fix dynamic statement block ``` │ on .terraform/modules/production.auth_token/secret/main.tf line 43, in data "aws_iam_policy_document" "secret": │ 43: identifiers = [statement.arn] │ │ This object does not have an attribute named "arn". ``` https://developer.hashicorp.com/terraform/language/expressions/dynamic-blocks - Fix user managed secret environment variables NOTE: This cherry picks a commit from a [PR @jferris opened] to address the same issue. - Terraform was complaining about calling `nonsensitive` when the value wasn't sensitive; this forces the initial value to potentially be sensitive to avoid the error. - We can skip parsing out the environment variables for the user managed secret module, because they are passed in directly. [PR @jferris opened]: #13
1 parent d93c347 commit bab3192

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

secret/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ data "aws_iam_policy_document" "secret" {
4040
]
4141
principals {
4242
type = "AWS"
43-
identifiers = [statement.arn]
43+
identifiers = [statement.value.arn]
4444
}
4545
}
4646
}
@@ -136,7 +136,7 @@ data "aws_iam_policy_document" "key" {
136136
resources = ["*"]
137137
principals {
138138
type = "AWS"
139-
identifiers = [statement.arn]
139+
identifiers = [statement.value.arn]
140140
}
141141
}
142142
}
@@ -288,7 +288,7 @@ locals {
288288
rotation_role_name = coalesce(var.rotation_role_name, "${var.name}-rotation")
289289

290290
env_vars = nonsensitive([
291-
for key in try(keys(jsondecode(var.initial_value)), []) :
291+
for key in try(keys(jsondecode(sensitive(var.initial_value))), []) :
292292
key if upper(key) == key
293293
])
294294
}

user-managed-secret/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ output "arn" {
55

66
output "environment_variables" {
77
description = "Environment variables provided by this secret"
8-
value = module.secret.environment_variables
8+
value = var.environment_variables
99
}
1010

1111
output "id" {

0 commit comments

Comments
 (0)