detect drift terraform Archives - For all your terraform needs https://terraformarchitect.com/tag/detect-drift-terraform/ Automation cannot be an afterthought (TM) Fri, 24 Jun 2022 15:28:05 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 Manual Drift and terraform https://terraformarchitect.com/quick-recipes-terraform/manual-drift-and-terraform/?utm_source=rss&utm_medium=rss&utm_campaign=manual-drift-and-terraform https://terraformarchitect.com/quick-recipes-terraform/manual-drift-and-terraform/#respond Thu, 19 May 2022 05:29:36 +0000 https://terraformarchitect.com/?p=220 Also read – Preventing accidental deletion of resources Prevent_Destroy in Terraform Terraform has a few options for detecting and managing drift of resources. lifecycle { prevent_destroy = true } However, […]

The post Manual Drift and terraform appeared first on For all your terraform needs.

]]>
Also read – Preventing accidental deletion of resources

Prevent_Destroy in Terraform

Terraform has a few options for detecting and managing drift of resources.

 lifecycle {
    prevent_destroy = true
  }

However, these options only work with terraform – i.e. terraform only prevents and detects it’s own drifts…

Say you mark a resource as prevent_destory, it will respect that. However, it doesn’t stop an admin from deleting the resource through the console (of course, how would it know about that)?

Enter Terraform Refresh

Just need to remember to run refresh every time. From their documentation:

Terraform plan and apply operations run an implicit in-memory refresh as part of their functionality, reconciling any drift from your state file before suggesting infrastructure changes.

The post Manual Drift and terraform appeared first on For all your terraform needs.

]]>
https://terraformarchitect.com/quick-recipes-terraform/manual-drift-and-terraform/feed/ 0