Last active
March 22, 2021 00:20
-
-
Save kwilczynski/40db6f92e5fa6ff7ee2dc848ce41d13f to your computer and use it in GitHub Desktop.
Set resources fields dynamically in Terraform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
region = "us-east-1" | |
} | |
variable "lifecycle_rule" { | |
default = { | |
enabled = true | |
} | |
} | |
# | |
# Error: aws_s3_bucket.test: "lifecycle_rule.0.enabled": required field is not set | |
# | |
resource "aws_s3_bucket" "test" { | |
bucket = "funky-monkey-2000" | |
lifecycle_rule = "${list(var.lifecycle_rule)}" | |
tags = {} | |
# lifecycle_rule = "${list(map("enabled", true))}" | |
# lifecycle_rule = "${var.lifecycle_rule}" | |
# lifecycle_rule = "${list()}" | |
# tags = "${map()}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment