hashicorp / hashicorp/terraform-plugin-sdk
Feature Request: Allow provider maintainers to specify `create_before_destroy` for resources
- Dominant language
- Go
- Stars
- 485
- Forks
- 244
- Avg merge
- 19h 57m
- Merged PRs (30d)
- 4
Description
### Current Terraform Version
```
Terraform v0.13.2
```
### Use-cases
Users of the `panos` provider will need to attach `lifecycle.create_before_destroy = True` to every single resource config block. Being able to specify that `create_before_destroy` applies to every single resource for the `panos` provider will save my users on hundreds of lines of copy/paste.
### Attempted Solutions
Add the following to all resources for the `panos` provider:
```hcl
lifecycle {
create_before_destroy = true
}
```
### Proposal
Add a new param to [schema.Provider](https://github.com/hashicorp/terraform-plugin-sdk/blob/master/helper/schema/provider.go#L49) that would allow providers to set `lifecycle.create_before_destroy` for all resources the provider exposes. (The issue is opened here as I'm assuming that there is Terraform core work that would need to happen before the SDK could expose this feature to provider maintainers).
### References
- hashicorp/terraform#26173
Contributor guide
Research direction
Start with helper/schema/provider.go, linked in the proposal, and trace how Provider settings could reach resource lifecycle handling. Read the referenced Terraform issue #26173 for related context; done means determining the required Terraform core and SDK design changes and documenting the behavior for provider maintainers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, terraform
- Domain
- backend-api-design, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100