- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Core Tech
Manage Resource Lifecycles and Import Existing Infrastructure
Practise managing the lifecycle of AWS resources with Terraform. You’ll define an explicit dependency, apply lifecycle rules to control replacement and destruction, and interpret plan output before making changes. You’ll also import an existing resource, reconcile its configuration, and rename its Terraform address using a moved block. By the end, you’ll be able to verify that Terraform manages the intended resources without introducing unintended changes.
Lab Info
Table of Contents
-
Challenge
Define explicit resource dependencies
- Identify an ordering requirement that Terraform cannot infer from existing resource references.
- Define the required dependency using
-
Challenge
Apply resource lifecycle rules
- Configure
create_before_destroyandprevent_destroyon the designated resources. - Configure
ignore_changesfor a specific externally managed attribute.
- Configure
-
Challenge
Predict lifecycle behaviour from plan output
- Review plans for controlled changes and predict how the configured lifecycle rules affect replacement, destruction, and attribute updates.
- Verify the predictions through permitted operations and the expected destruction-protection error.
-
Challenge
Import an existing resource
- Define a resource block and an import block for the designated resource created outside Terraform.
- Review and complete the import while preserving the existing AWS resource.
-
Challenge
Reconcile the imported resource configuration
- Compare the imported resource’s settings with its Terraform configuration.
- Align the configuration with the intended settings and verify that the resulting plan contains no unintended changes.
-
Challenge
Rename a resource safely
- Rename the Terraform resource address and record the address change using a
movedblock. - Apply the move and verify that the AWS resource retains its identity without replacement.
- Rename the Terraform resource address and record the address change using a
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.