Skip to content

Instantly share code, notes, and snippets.

@tomharrisonjr
Created December 7, 2021 05:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomharrisonjr/efb9e86b2bedcee744300fdcee934e66 to your computer and use it in GitHub Desktop.
Save tomharrisonjr/efb9e86b2bedcee744300fdcee934e66 to your computer and use it in GitHub Desktop.
Count as enabled
data "aws_iam_policy_document" "data" {
count = terraform.workspace == "production" ? 1 : 0
statement {
actions = [
"s3:GetBucketLocation",
"s3:ListBucket",
]
resources = [
aws_s3_bucket.data[0].arn,
]
}
statement {
actions = [
"s3:GetObject",
"s3:PutObject",
]
resources = [
"${aws_s3_bucket.data[0].arn}/*",
"aws_s3_bucket.data[0].arn",
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment