terraform-plugin-sdk
terraform-plugin-sdk copied to clipboard
Add `DeleteWarning` message to resource level
Deletion of some resources is inherently problematic (data loss, money, etc). In cases where there is significant potential user issues from an accidental deletion, we want to provide additional warning messages at plan time about the deletion.
Currently, Terraform CLI never calls the PlanResourceChange RPC during destroy plans, so there is not an opportunity for providers to even "see" the planned resource destroy operation. They are investigating the feasibility of turning that on, since provider implementations may not be expecting null data. Upon quick investigation, it might be safe with this SDK (due to a well placed early return), but it could break terraform-plugin-go or other implementations. In that case, it could be introduced as a separate RPC, although doing that introduces its own complexities.