website: import id interp (#33774)

IPL-3022-terraform-cloud-state-locking-regression-for-local-users
kmoe 3 years ago committed by GitHub
parent 9e9a78e96c
commit 0635a3054f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -43,7 +43,9 @@ If you do not set the `provider` argument, Terraform attempts to import from the
### Import ID
The import block requires you to provide the `id` argument with a literal string of your resource's import ID. Terraform needs this import ID to locate the resource you want to import.
The import block's `id` argument can be a literal string of your resource's import ID, or an expression that evaluates to a string. Terraform needs this import ID to locate the resource you want to import.
The import ID must be known at plan time for planning to succeed. If the value of `id` is only known after apply, `terraform plan` will fail with an error.
The identifier you use for a resource's import ID is resource-specific. You can find the required ID in the [provider documentation](https://registry.terraform.io/browse/providers) for the resource you wish to import.
@ -102,6 +104,15 @@ import {
}
```
The below example shows how to use the value of a variable as the import ID.
```hcl
import {
to = aws_instance.example
id = var.instance_id
}
```
The below example shows how to import a resource that includes [`count`](/terraform/language/meta-arguments/count).
```hcl
@ -111,7 +122,6 @@ import {
}
```
The below example shows how to import a resource that includes [`for_each`](/terraform/language/meta-arguments/for_each).
```hcl
import {

Loading…
Cancel
Save