Add `atmos terraform generate planfile` command @aknysh (#1214)
what
- Add
atmos terraform generate planfile
command - Add unit tests
- Update docs
why
Use the atmos terraform generate planfile
command to generate a planfile for an Atmos Terraform/OpenTofu component in a stack in JSON or YAML formats.
Usage
Execute the terraform generate planfile
command like this:
atmos terraform generate planfile <component> -s <stack> [options]
This command generates a planfile for an Atmos terraform component in a stack.
Examples
atmos terraform generate planfile component1 -s plat-ue2-dev
atmos terraform generate planfile component1 -s plat-ue2-prod --format=json
atmos terraform generate planfile component1 -s plat-ue2-prod --format=yaml
atmos terraform generate planfile <component> -s <stack> --file=planfile.json
atmos terraform generate planfile <component> -s <stack> --format=yaml --file=planfiles/planfile.yaml
atmos terraform generate planfile <component> -s <stack> --file=/Users/me/Documents/atmos/infra/planfile.json
Validate Terraform/OpenTofu planfiles using Checkov
You can generate a planfile for a component in a stack and validate it using Checkov.
atmos terraform generate planfile <component> -s <stack>
checkov --file components/terraform/<component>/<stack>-<component>.planfile.json --framework terraform_plan
Refer to Evaluate Checkov Policies on Terraform Plan for more information.
Notify Not Running in a Git Repo @milldr (#990)
what
- Warn when not running from a Git repo
why
- Atmos is intended to be run from within a project -- typically a Git repo
- Alternatively you can specify the base path with an env var
Warn on specific TF Environment Variables @milldr (#1206)
what
- Only warn on these environment variables:
"TF_CLI_ARGS"
"TF_VAR_"
"TF_CLI_ARGS_"
"TF_WORKSPACE"
- Deleted duplicated warning on
atmos terraform shell
why
- Previously we warned on all
TF_*
environment variables as requested. This is far too noisy and unnecessary for the majority of use cases. - Inspired by
terraform-exec
, we're going to adopt similar convention.
chore: Log Level for TTY Warning @milldr (#1212)
what
- Change the TTY warning in the following to debug
+ atmos vendor pull
INFO Vendoring from '/atmos/vendor.yaml'
WARN No TTY detected. Falling back to basic output. This can happen when no terminal is attached or when commands are pipelined.
INFO ✓ terraform-aws-vpc (v5.19.0)
INFO Vendored 1 components.
why
- Change TTY warning to
log.Debug
as it's not important enough to surface at the warn level.