Skip to content

Instantly share code, notes, and snippets.

@tomharrisonjr
Created December 7, 2021 06:26
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/003998cffc87d52ce8b236c9ff701241 to your computer and use it in GitHub Desktop.
Save tomharrisonjr/003998cffc87d52ce8b236c9ff701241 to your computer and use it in GitHub Desktop.
Use enabled instead of count
data "aws_iam_policy_document" "data" {
enabled = terraform.workspace == "production"
statement {
actions = [
"s3:GetBucketLocation",
"s3:ListBucket",
]
resources = [
aws_s3_bucket.data.arn,
]
}
statement {
actions = [
"s3:GetObject",
"s3:PutObject",
]
resources = [
"${aws_s3_bucket.data.arn}/*",
aws_s3_bucket.data.arn,
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment