Update `!terraform.output` and `atmos.Component` functions @aknysh (#944)
what
- Improve
!terraform.output
YAML function - Improve
atmos.Component
template function
why
-
When executing
!terraform.output
andatmos.Component
functions, honor thecomponents.terraform.init_run_reconfigure
setting inatmos.yaml
. If it's set totrue
, add the-reconfigure
flag to theterraform output
command when executing it to get the component outputs. This prevents an issue when you use the functions to retrieve the outputs of the same component from many different stacks (without using the-reconfigure
flag, Terraform detects that the backend configuration has changed and complains about it) -
Use YQ expressions to retrieve items from complex output types
To retrieve items from complex output types such as maps and lists, or do any kind of filtering or querying,
you can utilize YQ expressions.For example:
- Retrieve the first item from a list
subnet_id1: !terraform.output vpc .private_subnet_ids[0]
- Read a key from a map
username: !terraform.output config .config_map.username
Examples
components: terraform: my_lambda_component: vars: vpc_config: # Output of type list subnet_ids: !terraform.output vpc private_subnet_ids # Use a YQ expression to get an item from the list subnet_id1: !terraform.output vpc .private_subnet_ids[0] # Output of type map config_map: !terraform.output config {{ .stack }} config_map # Use a YQ expression to get a value from the map username: !terraform.output config .config_map.username