1. List addresses
state list prints every resource address Terraform currently tracks.
terraform state listTyporithm · medium
Step 1 of 8 · intro card
terraform Commands
state list and show inspect tracked resources, state rm forgets one without deleting it, and import adopts existing infrastructure into management.
The state file is Terraform's record of what it manages; the state subcommands let you inspect and surgically edit it.
state list enumerates every tracked address and state show prints the recorded attributes of one resource, both read-only views into state.
state rm forgets a resource without deleting the real thing, and import does the opposite — it adopts an existing real resource into a Terraform address so future plans manage it.
state list / show inspect tracked resources.
state rm forgets a resource without deleting it.
import adopts existing infra into management.
terraform state list
terraform state show aws_s3_bucket.this
terraform state rm aws_s3_bucket.this
terraform import aws_s3_bucket.this my-bucketConnect each part of the code to the concept before you type.
state list prints every resource address Terraform currently tracks.
terraform state liststate show prints the recorded attributes of a single resource from state.
terraform state show aws_s3_bucket.thisstate rm removes a resource from state so Terraform stops managing it, leaving the real resource untouched.
terraform state rm aws_s3_bucket.thisimport binds an existing real resource to a Terraform address so it becomes managed.
terraform import aws_s3_bucket.this my-bucketRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.