Closed IshwarBhat closed 4 years ago
Thanks for the heads up! I wrapped that snippet so that it fit better into the blog post, but putting a new line after the equals sign turns out not to be valid HCL2 syntax. I just fixed it in the blog post as follows:
resource "aws_instance" "example" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = (
terraform.workspace == "default"
? "t2.medium"
: "t2.micro"
)
}
I was experimenting with workspaces in https://blog.gruntwork.io/how-to-manage-terraform-state-28f5697e68fa (great set of blog posts btw, thanks!) and tried this piece of code:
which gave me an error:
Modifying the above code to this fixed my issue: