Creation / Destroy Time
Last updated
What is Creation / Destroy Time?
Creation and destroy-time provisioners in Terraform are used to execute actions at specific points in a resource's lifecycle. Creation-time provisioners run after a resource is created, while destroy-time provisioners run before a resource is destroyed. Creation-time provisioners are useful for tasks like initializing a newly created server, installing software, or configuring applications. Destroy-time provisioners are typically used for cleanup tasks, such as deregistering a server from a load balancer before deletion. Both types can be specified within a resource block.
Creation-time provisioners that fail will cause the resource creation to fail, potentially leaving resources in an incomplete state. Destroy-time provisioners that fail don't prevent resource destruction but may leave external resources in an inconsistent state. Due to their potential impact on Terraform's ability to manage state consistently, both types should be used cautiously and designed to be idempotent and fault-tolerant.
Free resources to learn Creation / Destroy Time
- Official docsCreation Time Provisioners
- Official docsDestroy Time Provisioners
- Official docsHow to: Terraform destroy time provisioners
More in stage 15: Provisioners
Creation / Destroy Time: common questions
Can I learn Creation / Destroy Time in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Creation / Destroy Time in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Creation / Destroy Time tutorial for beginners?
It is lesson 61 of 110 in the free Terraform roadmap, in stage 15, Provisioners. If you are new to Terraform, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.