Description
Terraform Version
Terraform v1.11.3
on linux_amd64
Use Cases
Currently the terraform validate
will:
- skip the validation of the resource when any dependency resource has validation error
- skip the validation from provider if any required attribute is missing or non-support attribute exists
In this case, if there is an error in the provider
block, all resources of this provider is not validated, or other cases can cause resources are not validated. so customers may need to fix one error and then run terraform validate
again to get new errors, and continue this work until all errors to be fixed.
Attempted Solutions
As the state is not required and each step in the validation command operates independently, it remains possible to validate the configuration even if errors exist in the dependencies.
By adding a new argument to validate
command, like -all
or something like it. we don't skip validate if dependencies has errors, and don't skip provider validate if schema check has errors (required attributes not exists and unsupported attributes exists). So we can run terraform validate -all
to get as many errors as possible of my configuration.
Proposal
No proposal has been made yet, but if this is feasible and valuable to you, I would be glad to submit a pull request for it.
References
terraform/internal/dag/walk.go
Lines 392 to 395 in 19540e3
terraform/internal/terraform/node_resource_validate.go
Lines 350 to 353 in 19540e3