-
Notifications
You must be signed in to change notification settings - Fork 65
Description
The terraform plan -state flag has been deprecated since Terraform v1.10. hashicorp/terraform#35660
I knew this flag was meaningless for remote backends, but it works for local backends. However, we should avoid using it as we get a deprecation warning in Terraform v.1.10+.
There are two possible ways to implement this. we can use the terraform state command on the temporary tfstate as before, but just before executing the terraform plan on the final phase, do the following additionally:
(1) Set the path attribute of the local backend in the override file to the temporary tfstate file and execute terraform init.
(2) Copy the temporary tfstate file to terraform.tfstate, which is the default value of the path attribute, and delete it after the terraform plan.
The latter may be simpler to design, but ensure the tfstate file must be deleted even if errors occur.