Created
July 11, 2022 19:25
-
-
Save sergsoares/866b7a1405d1ac912a0e0043b58ea6f5 to your computer and use it in GitHub Desktop.
Snippet for use variables as a map
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
# variables.tf | |
variable "myapp_conf" { | |
type = map | |
} | |
# terraform.tfvars | |
myapp_conf = { | |
REPLICAS = 0 | |
LIMIT_CPU = "50m" | |
LIMIT_MEMORY = "96Mi" | |
REQUEST_CPU = "50m" | |
REQUEST_MEMORY = "96Mi" | |
SECRET_NAME = "my-app-secret" | |
ENV_VARS = { | |
ENV = "dev" | |
} | |
} | |
# main.tf | |
var.myapp_conf["REPLICAS"] | |
# main.tf (with default) | |
try(var.myapp_conf["REPLICAS"], 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment