what
- Update
atmos terraform apply
andatmos terraform deploy
commands - Add
--planfile
flag toatmos terraform apply
andatmos terraform deploy
commands - Improve docs
why
-
Support two ways of specifying a planfile for
atmos terraform apply
andatmos terraform deploy
commands:-
atmos terraform apply
andatmos terraform deploy
commands support--planfile
flag to specify the path to a planfile. The--planfile
flag should be used instead of the planfile argument in the nativeterraform apply <planfile>
command. For example, you can execute the commandatmos terraform plan <component> -s <stack> -out=<FILE>
, which will save the generated plan to a file on disk, and then execute the commandatmos terraform apply <component> -s <stack> --planfile <FILE>
to apply the previously generated planfile -
atmos terraform apply
andatmos terraform deploy
commands support--from-plan
flag. If the flag is passed in, the commands will use the planfile previously generated byatmos terraform plan
command instead of generating a new planfile, e.g.atmos terraform apply <component> -s <stack> --from-plan
. Note that in this case, the planfile name is in the format supported by Atmos and is saved to the component's folder
-
test
# Pass the `-out` option to the native `terraform plan` command to save the plan to the file
atmos terraform plan test/test-component-override-3 -s tenant1-ue2-dev -out plan.planfile
Executing command:
/usr/local/bin/terraform plan -var-file tenant1-ue2-dev-test-test-component-override-3.terraform.tfvars.json -out plan.planfile
Changes to Outputs:
+ service_1_id = "cp-ue2-dev-mixin-2"
+ service_2_id = "cp-ue2-dev-service-2-override-2"
You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.
Saved the plan to: plan.planfile
To perform exactly these actions, run the following command to apply:
terraform apply "plan.planfile"
# Pass the `--planfile` flag to `atmos terraform apply/deploy` command to apply the previously saved planfile
atmos terraform apply test/test-component-override-3 -s tenant1-ue2-dev --planfile plan.planfile
atmos terraform deploy test/test-component-override-3 -s tenant1-ue2-dev --planfile plan.planfile
Executing command:
/usr/local/bin/terraform apply plan.planfile
# No `-out` option is specified, Atmos will generate a planfile automatically
# (using a name constructed form the context and component name) and save it into the component's folder
atmos terraform plan test/test-component-override-3 -s tenant1-ue2-dev
Executing command:
/usr/local/bin/terraform plan -var-file tenant1-ue2-dev-test-test-component-override-3.terraform.tfvars.json -out tenant1-ue2-dev-test-test-component-override-3.planfile
Saved the plan to: tenant1-ue2-dev-test-test-component-override-3.planfile
To perform exactly these actions, run the following command to apply:
terraform apply "tenant1-ue2-dev-test-test-component-override-3.planfile"
# `--from-plan` flag for the `atmos terraform apply/deploy` command instructs Atmos to use the planfile
# previously generated by `atmos terraform plan` command
atmos terraform apply test/test-component-override-3 -s tenant1-ue2-dev --from-plan
atmos terraform deploy test/test-component-override-3 -s tenant1-ue2-dev --from-plan
Executing command:
/usr/local/bin/terraform apply tenant1-ue2-dev-test-test-component-override-3.planfile