Skip to content

Commit 52e5625

Browse files
committed
Allow multiple path_prefixes and update documentation
1 parent 0bd4138 commit 52e5625

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

README.yaml

+9-3
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,15 @@ usage: |-
7979
dns_alias_enabled = true
8080
parent_zone_name = "cloudposse.com"
8181
82-
deployment_principal_arns = {
83-
"arn:aws:iam::123456789012:role/principal1" = ["prefix1/", "prefix2/"]
84-
"arn:aws:iam::123456789012:role/principal2" = [""]
82+
deployment_principals = {
83+
"principal1": {
84+
"arn": "arn:aws:iam::123456789012:role/principal1"
85+
"path_prefixes": ["prefix1/", "prefix2/"]
86+
},
87+
"principal2": {
88+
"arn": "arn:aws:iam::123456789012:role/principal2"
89+
"path_prefixes": [""]
90+
}
8591
}
8692
}
8793
```

deprecated.tf

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ locals {
1818

1919
# New variables, but declare them here for consistency
2020
cloudfront_access_log_create_bucket = var.cloudfront_access_log_create_bucket
21-
}
22-
21+
}

variables.tf

+4-3
Original file line numberDiff line numberDiff line change
@@ -481,18 +481,19 @@ variable "versioning_enabled" {
481481
}
482482

483483
variable "deployment_principals" {
484-
type = map(object({ path_prefix = string, arn = string }))
484+
type = map(object({ path_prefix = list(string), arn = string }))
485485
default = {}
486486
description = <<-EOT
487-
(Optional) Map of IAM Principal ARNs to lists of S3 path prefixes to grant `deployment_actions` permissions.
487+
(Optional) Map of objects that define the IAM Principal's to grant `deployment_actions` permissions. Each object in the map should have an IAM Principal ARN and a list of S3 path
488+
prefixes to scope that principal's actions in the bucket.
488489
Resource list will include the bucket itself along with all the prefixes. Prefixes should not begin with '/'.
489490
EOT
490491
}
491492

492493
variable "deployment_actions" {
493494
type = list(string)
494495
default = ["s3:PutObject", "s3:PutObjectAcl", "s3:GetObject", "s3:DeleteObject", "s3:ListBucket", "s3:ListBucketMultipartUploads", "s3:GetBucketLocation", "s3:AbortMultipartUpload"]
495-
description = "List of actions to permit `deployment_principal_arns` to perform on bucket and bucket prefixes (see `deployment_principal_arns`)"
496+
description = "List of actions to permit `deployment_principals` to perform on bucket and bucket prefixes (see `deployment_principals`)"
496497
}
497498

498499
variable "cloudfront_origin_access_identity_iam_arn" {

0 commit comments

Comments
 (0)