Hi Team,
I’m trying to import existing aws-kms-keys into a tf-state. We are using the aws-providers default-tags-function to tag the resources.
The tags are generated via separate tf-modul:
provider "aws" {
default_tags {
tags = merge(
module.tagging.tagA,
module.tagging.tagB,
module.tagging.tagC,
}
}
}
The import is failing with:
The configuration for provider[“Terraform Registry ”] depends on values that cannot be determined until apply.
When putting the tags directly/statiticky into the providers.tf-file, the import works as expecetd.
Any ideas on that?
Look similiar to this one:
opened 08:02PM - 10 Sep 20 UTC
closed 09:21PM - 23 Mar 21 UTC
bug
import
confirmed
v0.13
<!--
Hi there,
Thank you for opening an issue. Please note that we try to ke… ep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.
If your issue relates to a specific Terraform provider, please open it in the provider's own repository. The index of providers is at https://github.com/terraform-providers .
-->
### Terraform Version
<!---
Run `terraform version` to show the version, and paste the result between the ``` marks below.
If you are not running the latest version of Terraform, please try upgrading because your issue may have already been fixed.
-->
```
Terraform v0.13.2
+ provider registry.terraform.io/hashicorp/azurerm v2.26.0
+ provider registry.terraform.io/hashicorp/kubernetes v1.13.1
```
### Terraform Configuration Files
<!--
Paste the relevant parts of your Terraform configuration between the ``` marks below.
For large Terraform configs, please use a service like Dropbox and share a link to the ZIP file. For security, you can also encrypt the files using our GPG public key.
-->
[Sample Repo](https://github.com/demonemia/terraform-import-failure)
### Debug Output
<!--
Full debug output can be obtained by running Terraform with the environment variable `TF_LOG=trace`. Please create a GitHub Gist containing the debug output. Please do _not_ paste the debug output in the issue, since debug output is long.
Debug output may contain sensitive information. Please review it before posting publicly, and if you are concerned feel free to encrypt the files using the HashiCorp security public key.
-->
[Log file](https://github.com/demonemia/terraform-import-failure/blob/master/trace.log)
### Expected Behavior
<!--
What should have happened?
-->
Terraform should import the existing resource into the state file
### Actual Behavior
<!--
What actually happened?
-->
Statefile is not updated, error message is displayed.
```
> terraform import module.resource_group_1.azurerm_resource_group.resource_group /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resource-group-1
module.resource_group_1.azurerm_resource_group.resource_group: Importing from ID "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resource-group-1"...
module.resource_group_1.azurerm_resource_group.resource_group: Import prepared!
Prepared azurerm_resource_group for import
module.resource_group_1.azurerm_resource_group.resource_group: Refreshing state... [id=/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resource-group-1]
Error: Invalid provider configuration
on resource_group_1/resource_group_1.tf line 17:
17: provider kubernetes {
The configuration for
module.resource_group_1.provider["registry.terraform.io/hashicorp/kubernetes"].kubernetes_cluster
depends on values that cannot be determined until apply.
```
### Steps to Reproduce
<!--
Please list the full steps required to reproduce the issue, for example:
1. `terraform init`
2. `terraform apply`
-->
`terraform init`
`terraform import module.resource_group_1.azurerm_resource_group.resource_group /subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resource-group-1`
or
`terraform import module.resource_group_1.null_resource.test_resource test`
### Additional Context
<!--
Are there anything atypical about your situation that we should know? For example: is Terraform running in a wrapper script or in a CI system? Are you passing any unusual command line options or environment variables to opt-in to non-default behavior?
-->
`terraform plan` works
This was also an issue in terraform v0.13.0.
### References
<!--
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
- #6017
-->
#25816
Thank you!