Improvements and new features @aknysh (#58)
what
- Improvements and new features
why
-
atmos terraform apply
made 100% compatible withterraform apply
:- does not run
terraform plan
atmos terraform apply
does not useplanfile
(by default)atmos terraform apply
will ask for the confirmation to applyatmos terraform apply -auto-approve
will apply without asking for the confirmation to apply- The above behavior can be overridden. If
apply_auto_approve
config (or ENV varATMOS_COMPONENTS_TERRAFORM_APPLY_AUTO_APPROVE
) is set totrue
,atmos terraform apply
will not ask for the confirmation to apply regardless of whether the-auto-approve
is specified or not
- does not run
-
atmos terraform deploy
:- behaves like
atmos terraform apply -auto-approve
- does not run
terraform plan
- If
deploy_run_init
config (or ENV varATMOS_COMPONENTS_TERRAFORM_DEPLOY_RUN_INIT
, or--deploy-run-init
command-line argument) is set totrue
,atmos terraform deploy
will first runterraform init
to initialize modules. Otherwise, it will not runterraform init
, andatmos terraform init
will need to be run first at least once
ATMOS_COMPONENTS_TERRAFORM_DEPLOY_RUN_INIT=false atmos terraform deploy top-level-component1 -s tenant1-ue2-dev ATMOS_COMPONENTS_TERRAFORM_DEPLOY_RUN_INIT=true atmos terraform deploy top-level-component1 -s tenant1-ue2-dev
atmos terraform deploy top-level-component1 -s tenant1/ue2/dev --deploy-run-init=false Using command line argument '--deploy-run-init=false'
ATMOS_COMPONENTS_TERRAFORM_DEPLOY_RUN_INIT=false atmos terraform deploy top-level-component1 -s tenant1/ue2/dev --deploy-run-init=true Found ENV var ATMOS_COMPONENTS_TERRAFORM_DEPLOY_RUN_INIT=false Using command line argument '--deploy-run-init=true'
- behaves like
-
Log level control:
-
If ENV var
ATMOS_LOGS_VERBOSE
is set tofalse
(default), the CLI will not print all the information about the config, stacks and component (and how it searches them), but will just output the essential info for each commandATMOS_LOGS_VERBOSE=true atmos terraform deploy top-level-component1 -s tenant1-ue2-dev
-
-
Check if terraform commands require user interaction, but running in a scripted environment (where a
tty
is not attached orstdin
is not attached) -
Use logical
context
to generate terraform workspaces and file names forplanfile
andvarfile
:- Instead of using the physical paths derived from the provided stack names to generate terraform workspaces and the names of
planfile
andvarfile
(which the old variant-basedatmos
did as well), find the logicalcontext
for the specified component in the specified stack (from the deep-merged vars). The logicalcontext
consist oftenant
(if used),environment
andstage
, and is controlled by thename_pattern: "{tenant}-{environment}-{stage}"
CLI config - This makes it completely independent of the folder structure where the YAML stack config files are defined - don't use the physical structure, look at the logical structure
- Bonus:
- You will be able move around the top-level YAML config files (that are not imported into other stacks) to any folder at any level (under
stacks
parent folder) "on-the-fly" , or change the names of the folders, WITHOUT needing to change anything - terraform workspace remains the same, the CLI will find the context from the deep-merged vars, and it just works - You can also move around the YAML config files even if they are already imported into other stacks, you will just need to update the
import
paths, but all CLI commands will continue working without making any changes to terraform state
- You will be able move around the top-level YAML config files (that are not imported into other stacks) to any folder at any level (under
- Instead of using the physical paths derived from the provided stack names to generate terraform workspaces and the names of