Fix `atmos terraform shell` command. Improve `!terraform.output` YAML function @aknysh (#1252)
what
- Fix
atmos terraform shell
command - Improve
!terraform.output
YAML function - Add unit tests
- Update docs https://atmos.tools/core-concepts/stacks/yaml-functions/terraform.output#using-yq-expressions-to-provide-a-default-value
why
-
In
atmos terraform shell
command, parsing and adding the system (parent process) environment variables to the launched shell was accidentally removed in a previous PR. Added it back -
Allow specifying a default value in the
!terraform.output
YAML function
Using YQ Expressions to provide a default value
If the component for which you are reading the output has not been provisioned yet, the !terraform.output
function
will return the string <no value>
unless you specify a default value in the YQ expression, in which case the function will return the default value.
This will allow you to mock outputs when executing atmos terraform plan
where there are dependencies between components, and the dependent components are not provisioned yet.
NOTE: To provide a default value, you use the //
YQ operator. The whole YQ expression contains spaces, and to make it a single parameter, you need to double-quote it. YQ requires the strings in the default values to be double-quoted as well.
This means that you have to escape the double-quotes in the default values by using two double-quotes.
For example:
- Specify a string default value.
Read theusername
output from theconfig
component in the current stack.
If theconfig
component has not been provisioned yet, return the default valuedefault-user
username: !terraform.output config ".username // ""default-user"""
- Specify a list default value.
Read theprivate_subnet_ids
output from thevpc
component in the current stack.
If thevpc
component has not been provisioned yet, return the default value["mock-subnet1", "mock-subnet2"]
subnet_ids: !terraform.output vpc ".private_subnet_ids // [""mock-subnet1"", ""mock-subnet2""]"
- Specify a map default value.
Read theconfig_map
output from theconfig
component in the current stack.
If theconfig
component has not been provisioned yet, return the default value{"api_endpoint": "localhost:3000", "user": "test"}
config_map: !terraform.output 'config ".config_map // {""api_endpoint"": ""localhost:3000"", ""user"": ""test""}"'
For more details, review the following docs:
Add no-color support for Atmos @samtholiya (#1227)
what
- We are adding support for no color output for atmos
why
- Customer having custom terminal find it difficult to look at the content. Having no color option helps customer to have a visible output
Add pager to describe config command @samtholiya (#1203)
what
- We are adding pager from https://github.com/charmbracelet/bubbletea
--pager
flag,ATMOS_PAGER
env boolean variable added to enable/disable pager if required- Normal View
- Help View
- When user presses
c
to copy the contents
why
- Better UX
Add tests for `!terraform.output`. Improve logging and error handling @aknysh (#1235)
what
- Add tests for
!terraform.output
- Refactor code
- Improve logging and error handling
- Install OpenTofu in the GitHub actions for testing Atmos OpenTofu components
why
- Add more unit tests for the
!terraform.output
YAML function. Test!terraform.output
for OpenTofutofu
command per component - Refactor code: move all
shell
related functions topkg/utils/shell_utils.go
- Replace the deprecated logging functions with
github.com/charmbracelet/log
- Use structured errors for error handling
[Stores] Add support for non-string values to GSM @ohaibbq (#1237)
what
- Users of the Google Secret Manager store can now persist/read complex values like slices and maps
why
- Brings the Google Secret Manager store up to parity with other store implementations
Support atmos docs generate feature natively @Listener430 (#934)
what
- Introduce a new command to generate a README.md from one or more input sources defined at
docs.generate.readme
section ofatmos.yaml
. The command combines all local or remote YAML files specified atsource
and generates README.md at the working directory. In case the template containsterraform_docs
key, the resultant README.md will also have a corresponding section rendered. By defaultterraform.format
is set tomarkdown table
, and can also bemarkdown
,tfvars hcl
, andtfvars json
.
This command also aliases to “atmos generate docs”.