Terraform Version
$ terraform version
Terraform v0.13.0-beta2
+ provider registry.terraform.io/hashicorp/aws v2.66.0
Terraform Configuration Files
locals {
region = "eu-central-1"
profile = "dev"
}
provider "aws" {
profile = local.profile
region = local.region
assume_role {
role_arn = "xxxxxx"
}
}
resource "aws_s3_bucket" "tf-bucket" {
acl = "private"
bucket = "dev-test-tf-0.13-beta"
region = local.region
}
Actual Behavior
Terraform reports the following when trying to import this simple bucket:
Error: Invalid provider dependency for import
on .../terraform/test/main.tf line 7, in provider "aws":
7: profile = local.profile
The configuration for provider["registry.terraform.io/hashicorp/aws"] depends
on local.profile. Providers used with import must either have literal
configuration or refer only to input variables.
Error: Invalid provider dependency for import
on .../terraform/test/main.tf line 8, in provider "aws":
8: region = local.region
The configuration for provider["registry.terraform.io/hashicorp/aws"] depends
on local.region. Providers used with import must either have literal
configuration or refer only to input variables.
Expected Behavior
Meanwhile using terraform v0.12 in the same folder:
$terraform version
Terraform v0.12.26
+ provider.aws v2.66.0
$ terraform import aws_s3_bucket.tf-bucket dev-test-tf-0.13-beta
aws_s3_bucket.tf-bucket: Importing from ID "dev-test-tf-0.13-beta"...
aws_s3_bucket.tf-bucket: Import prepared!
Prepared aws_s3_bucket for import
aws_s3_bucket.tf-bucket: Refreshing state... [id=dev-test-tf-0.13-beta]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
If this is not fixed it is a great deal breaker for migrating to v0.13 as it would require to destroy all our AWS resources. In our configuration the aws provider is created dynamically using locals that are terraform.workspace related. The solution to hard-code the provider's block is a leap back for terraform.
Steps to Reproduce
Please list the full steps required to reproduce the issue, for example:
terraform init
terraform import aws_s3_bucket.tf-bucket dev-test-tf-0.13-beta
Terraform Version
Terraform Configuration Files
Actual Behavior
Terraform reports the following when trying to import this simple bucket:
Expected Behavior
Meanwhile using terraform v0.12 in the same folder:
If this is not fixed it is a great deal breaker for migrating to v0.13 as it would require to destroy all our AWS resources. In our configuration the aws provider is created dynamically using locals that are terraform.workspace related. The solution to hard-code the provider's block is a leap back for terraform.
Steps to Reproduce
Please list the full steps required to reproduce the issue, for example:
terraform initterraform import aws_s3_bucket.tf-bucket dev-test-tf-0.13-beta