prevent_destroy

A lifecycle setting that makes any plan fail if it would destroy that resource, including as part of a replacement.

In more detail

It suits a few precious resources such as a production database. On most resources it gets in the way, because it also blocks legitimate replacements. It does not stop someone deleting the resource block from the configuration, which removes the setting too.

Example

lifecycle {
  prevent_destroy = true
}

Related terms

Taught in

References

Certification courses