Terraform
terraform import
Appears inTerraform Associate
A command that brings an existing resource at the provider (created manually or by another tool) into Terraform state, associating it with a resource block already written in the code, without recreating it.
On the exam
In Terraform Associate it's the way to "adopt" pre-existing infrastructure under Terraform management. It requires the corresponding resource block to already exist in the code (even if empty) before running the import; recent versions (1.5+) can auto-generate the HCL with generate-config-out.
Related terms
- Terraform StateA file (terraform.tfstate) that Terraform uses to map the real-world configuration in code to actual resources in the cloud. It's Terraform's source of truth about which resources it manages and their current status.
- Configuration driftThe difference between the infrastructure described in Terraform code (and reflected in the state) and the actual state of resources at the provider, usually caused by manual changes made outside of Terraform.