terraform import
Before using terraform import
you must manually write a resource configuration block for the resource.
Contents
Examples
terraform import --help
terraform import aws_instance.my_foo i-abcd1234
[1]terraform import aws_default_subnet.public_subnet subnet-9d4a7b6c
terraform import aws_default_vpc.default vpc-a01106c2
Errors
terraform import aws_key_pair.MyNewKeyInTerraform YourExistingKeyName
terraform import aws key pair.MyNewKeyInTerraform YourExistingKeyName2
Error: Reference to undeclared resource
Related terms
- Terraform modules
- Terraform resources:
resource
terraform.tfstate
- Terraform activities
terraform apply -refresh-only
- Cloudformation:
--resources-to-import
See also
- Terraform configuration files, Terraform state files:
.tf
,.tfvars
,main.tf, outputs.tf
,variables.tf
,.terraform.d/
,terraform init
,providers.tf
,.terraform/
,terraform.tfstate
,.terraform.lock.hcl
,terraform.tfstate.d, override.tf, versions.tf
terraform
[untaint | fmt
|apply
|show
|state
|init | plan | console | output
|validate
|destroy
|debug
|import
|providers
|get
|graph
|workspaces
|resource
|login
|-var-file
|state mv
|state pull
|state push
|state replace-provider
|state rm
|force-unlock
|env
|tfe
|--version
|remote-exec
|delete on termination
| deprecated commands |terraform --help
]
Advertising: