Skip to content

Commit f5ac140

Browse files
committed
fix: Revert policy_statements back to map()
1 parent 9682e45 commit f5ac140

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ No modules.
164164
| <a name="input_name"></a> [name](#input\_name) | Friendly name of the new secret. The secret name can consist of uppercase letters, lowercase letters, digits, and any of the following characters: `/_+=.@-` | `string` | `null` | no |
165165
| <a name="input_name_prefix"></a> [name\_prefix](#input\_name\_prefix) | Creates a unique name beginning with the specified prefix | `string` | `null` | no |
166166
| <a name="input_override_policy_documents"></a> [override\_policy\_documents](#input\_override\_policy\_documents) | List of IAM policy documents that are merged together into the exported document. In merging, statements with non-blank `sid`s will override statements with the same `sid` | `list(string)` | `[]` | no |
167-
| <a name="input_policy_statements"></a> [policy\_statements](#input\_policy\_statements) | A map of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage | <pre>list(object({<br/> sid = optional(string)<br/> actions = optional(list(string))<br/> not_actions = optional(list(string))<br/> effect = optional(string)<br/> resources = optional(list(string))<br/> not_resources = optional(list(string))<br/> principals = optional(list(object({<br/> type = string<br/> identifiers = list(string)<br/> })))<br/> not_principals = optional(list(object({<br/> type = string<br/> identifiers = list(string)<br/> })))<br/> condition = optional(list(object({<br/> test = string<br/> values = list(string)<br/> variable = string<br/> })))<br/> }))</pre> | `null` | no |
167+
| <a name="input_policy_statements"></a> [policy\_statements](#input\_policy\_statements) | A map of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage | <pre>map(object({<br/> sid = optional(string)<br/> actions = optional(list(string))<br/> not_actions = optional(list(string))<br/> effect = optional(string)<br/> resources = optional(list(string))<br/> not_resources = optional(list(string))<br/> principals = optional(list(object({<br/> type = string<br/> identifiers = list(string)<br/> })))<br/> not_principals = optional(list(object({<br/> type = string<br/> identifiers = list(string)<br/> })))<br/> condition = optional(list(object({<br/> test = string<br/> values = list(string)<br/> variable = string<br/> })))<br/> }))</pre> | `null` | no |
168168
| <a name="input_random_password_length"></a> [random\_password\_length](#input\_random\_password\_length) | The length of the generated random password | `number` | `32` | no |
169169
| <a name="input_random_password_override_special"></a> [random\_password\_override\_special](#input\_random\_password\_override\_special) | Supply your own list of special characters to use for string generation. This overrides the default character list in the special argument | `string` | `"!@#$%&*()-_=+[]{}<>:?"` | no |
170170
| <a name="input_recovery_window_in_days"></a> [recovery\_window\_in\_days](#input\_recovery\_window\_in\_days) | Number of days that AWS Secrets Manager waits before it can delete the secret. This value can be `0` to force deletion without recovery or range from `7` to `30` days. The default value is `30` | `number` | `null` | no |

examples/complete/main.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ module "secrets_manager" {
3838
# Policy
3939
create_policy = true
4040
block_public_policy = true
41-
policy_statements = [
42-
{
41+
policy_statements = {
42+
read = {
4343
sid = "AllowAccountRead"
4444
principals = [{
4545
type = "AWS"
@@ -48,7 +48,7 @@ module "secrets_manager" {
4848
actions = ["secretsmanager:GetSecretValue"]
4949
resources = ["*"]
5050
}
51-
]
51+
}
5252

5353
# Version
5454
create_random_password = true
@@ -69,8 +69,8 @@ module "secrets_manager_rotate" {
6969
# Policy
7070
create_policy = true
7171
block_public_policy = true
72-
policy_statements = [
73-
{
72+
policy_statements = {
73+
lambda = {
7474
sid = "LambdaReadWrite"
7575
principals = [{
7676
type = "AWS"
@@ -83,8 +83,8 @@ module "secrets_manager_rotate" {
8383
"secretsmanager:UpdateSecretVersionStage",
8484
]
8585
resources = ["*"]
86-
},
87-
{
86+
}
87+
account = {
8888
sid = "AccountDescribe"
8989
principals = [{
9090
type = "AWS"
@@ -93,7 +93,7 @@ module "secrets_manager_rotate" {
9393
actions = ["secretsmanager:DescribeSecret"]
9494
resources = ["*"]
9595
}
96-
]
96+
}
9797

9898
# Version
9999
ignore_secret_changes = true

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ data "aws_iam_policy_document" "this" {
3838
override_policy_documents = var.override_policy_documents
3939

4040
dynamic "statement" {
41-
for_each = var.policy_statements != null ? var.policy_statements : []
41+
for_each = var.policy_statements != null ? var.policy_statements : {}
4242

4343
content {
4444
sid = statement.value.sid

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ variable "override_policy_documents" {
8989

9090
variable "policy_statements" {
9191
description = "A map of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage"
92-
type = list(object({
92+
type = map(object({
9393
sid = optional(string)
9494
actions = optional(list(string))
9595
not_actions = optional(list(string))

0 commit comments

Comments
 (0)