hashicorp / hashicorp/terraform-plugin-sdk
Terraform destroy calls CustomizeDiff though documentation suggests it shouldn't be
- Dominant language
- Go
- Stars
- 485
- Forks
- 244
- Avg merge
- 19h 57m
- Merged PRs (30d)
- 4
Description
### SDK version
```
v2.24.1
```
### Relevant provider source code
https://github.com/prashantv/terraform-customizediff-on-destroy-repro
### Terraform Configuration Files
Config doesn't matter, as it seems to always happen. However, the above repo does contain a repro with config.
### Debug Output
https://gist.github.com/prashantv/5e00eb5e6dc9215c280d7cb30a68cf26
### Expected Behavior
CustomizeDiff shouldn't be called, as documented in the [SDK docs](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema#Resource).
> // * Destroy: No runs (standard diff logic is skipped on destroy diffs)
If it is called, there should be some way for the provider to know that this is a destroy call.
### Actual Behavior
CustomizeDiff is called.
### Steps to Reproduce
See https://github.com/prashantv/terraform-customizediff-on-destroy-repro
Contributor guide
Research direction
Start with the linked terraform-customizediff-on-destroy-repro repository and its configuration, then compare the observed behavior with the CustomizeDiff documentation and the linked debug output. Done means determining why CustomizeDiff runs during destroy and either preventing that call or exposing whether the operation is a destroy, with the documented behavior and reproduction covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, terraform
- Domain
- devtools, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100