hashicorp / hashicorp/terraform-plugin-framework
Support of deprecation warnings for parameters with unknown values in `terraform validate`
- Dominant language
- Go
- Stars
- 384
- Forks
- 107
- Avg merge
- 3m
- Merged PRs (30d)
- 1
Description
### Module version
```
v1.4.0
```
### Use-cases
Detect and alert programmatically on use of deprecated provider parameters in HCL code stored in Github/Gitlab using CI actions.
HCL code may drift over time as `>=` or `~>` notation is used in the provider/module version constraints. The action would alert to the use of a deprecated provider parameter if a provider version is upgraded
### Attempted Solutions
- `terraform validate --json` - Cannot be used as deprecated parameters in the configuration HCL with unknown values (values determined after `terraform apply`) are not returned as warnings. E.g., a value that comes from a data source, used as a reference to a deprecated parameter on a resource will not show as a warning here
- `terraform plan` - Same as above, unless previously applied.
- `terraform apply` - Warnings are aggregated and limited and there doesn't appear to be a way to extract them as a full list in JSON. Also, infrastructure shouldn't need to be provisioned to warn about the use of deprecated attributes in the HCL.
Note that because of the above, the warnings returned by `terraform validate` are a subset of warnings returned from `terraform apply`
### Proposal
Without knowing details of the Terraform architecture, the ideal situation would be for `terraform validate --json` to return use of deprecated attributes declared in the HCL, even if the values are unknown
### References
- Moved from https://github.com/hashicorp/terraform/issues/33939
Contributor guide
Assessment
This issue has not been assessed yet.