2 Lifecycle of a Terraform Resource
This chapter covers:
- Utilizing the local provider to create and manage a file resource
- Generating execution plans and applying them
- Observing lifecycle events of a managed resource in Terraform
- Updating resources and detecting configuration drift
- Basics of state file management
This chapter is focused on the steps that Terraform takes to create and manage resources on your behalf. Specifically, we’ll be examining the lifecycle function hooks that Terraform invokes when certain actions or sequences of actions occur. Terraform is fundamentally a glorified state management tool, so having an intuitive understanding of how state is being stored and how Terraform makes decisions based on the current vs. desired state is absolutely essential. If you can grasp this, then you have a solid foundation going forward for more advanced topics.