Cheatsheets:
programming:
How-to:
Troubleshooting:
Rants:
Other:
Cheatsheets:
programming:
How-to:
Troubleshooting:
Rants:
Other:
Terraform supports conditional expressions that can be used to assign variable values based on conditions.
variable "environment" {
description = "Deployment environment"
type = string
}
resource "aws_instance" "example" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = var.environment == "production" ? "t2.large" : "t2.micro"
}