hashicorp / terraform-provider-template

Terraform template provider
https://www.terraform.io/docs/providers/template/
Mozilla Public License 2.0
130 stars 89 forks source link

Make Terraform validate template_file on plan phase #57

Open ghost opened 5 years ago

ghost commented 5 years ago

This issue was originally opened by @fcappi as hashicorp/terraform#20770. It was migrated here as a result of the provider split. The original body of the issue is below.


Current Terraform Version

terraform -v
Terraform v0.11.10

Use-cases

Currently, when there is an issue with a template file like having a variable being used in the file that was not specified as input, terraform only fails at the apply phase. Then you have to destroy the infrastructure that is already created so far, fix the issue in the template file and then apply again. This can be time-consuming if you are creating many resources.

Attempted Solutions

Currently, you have to terraform destroy, fix the file and then terraform applyagain

Proposal

I think it would be great if Terraform validates the template files before starting applying all the changes, this way we can make sure it will not break during infrastructure creation.