Difference between revisions of "Terraform import"
Jump to navigation
Jump to search
↑ https://www.terraform.io/docs/cli/import/index.html
Line 1: | Line 1: | ||
{{lowercase}} | {{lowercase}} | ||
+ | Before using <code>terraform import</code> you must manually write a resource [[configuration block]] for the resource. | ||
+ | |||
* https://www.terraform.io/docs/cli/import/index.html | * https://www.terraform.io/docs/cli/import/index.html | ||
Revision as of 14:18, 8 February 2023
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
]- Terraform, OpenTofu, Terrakube.org, Installation, Terraform AWS, Terraform GCP, Terraform commands, Terraform Cloud, Terraform Enterprise (TFE), HCL, HIL, meta-arguments, providers, modules, resource, provisioners, data sources, backends: remote backends, examples, configuration files, state files, variables, types, Terraform Registry, conditionals:
depends_on
, functions, Blocks, dynamic blocks, errors, Terragrunt, Terraformer, Terratest, Terraform certifications, Terraform map type, Terraform Associate, Terraform: list type,TF_VAR_, TF_LOG
, Terraform provider versioning, Terraform Style Conventions, Required version, Terraform plugin, Terraform Named Values, tags, Changelog,tfsec, tflint
, Operators, Expressions:for, splat
, Debugging, Namespaces, Terraform Landing Zones, CDKTF, Atmos
Advertising: