-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.12.0-rc1 - import fails if default provider is missing #21330
Comments
Additionally, if I add a default provider block without region configured:
Then the error becomes more clear:
But it still happens at the same stage: after the import process seems to have succeeded and all child resources have been found. |
Hi @a13xb! Thanks for reporting this. Indeed, it looks like for some reason the import process is unnecessarily adding the default (unaliased) The import graph builder seems to be using the same Since this bug is pre-existing in Terraform v0.11 (albeit with some slightly different symptoms, because the prompting behavior was refactored for v0.12), it's likely that this will require some digging to fully diagnose and fix. Because we're close to v0.12.0 final now we're going to hold this for a follow-up v0.12.x patch release so we can make sure we have enough time for full debugging and testing since this will be a change to behavior that has probably been present since the Thanks for reporting this! |
this issue is still very much present in the final terraform version, i currently have:
and with the provider configuration
the import of a very simple AWS EBS volume with
fails with
(volume id edited) are there any workarounds? |
replying to my previous comment here, it appears the issue can be solved by specifying a default provider for each provider type. i have moved the |
Any work around of this issue? Can't pass the validate check
Got the same today when convert a module to 0.12.1 UpdatesA quick fix, add below code.
|
I'm having what I believe is a similar issue with a vmware provider. We leave
|
Workaround that worked for meI have two AWS providers:
On terraform 0.11.14 I can run this without problems:
Now, on terraform 0.12.2 I had to add an empty AWS provider like this:
And it worked. |
The same happens on terraform 0.12.3 with aliased mysql providers when no default one is present:
and resources aren't imported eventually. A workaround is to add the default mysql provider:
|
@WraithCadmus did you find a solution to this? I had an issue and lost my state and now can't import. |
Also seeing this problem in 0.12.5, with AWS multiple providers. The workaround proposed by @meschansky of adding a default provider pointing to the needed region temporarily worked for me |
this seems related to #13018, still occurring in 0.12.5 when specifying the
there is only a single non-aliased provider defined in the root module, none in child modules. |
@AirCombat I just had the same thing. Had to set the default provider to point to the same settings as the aliased provider for the entity I was importing. e.g.
Added identical (minus alias line) default provider:
Gives me output:
Basically, i guess you have to setup the default to point to whatever, import all your entities on that aliased thing, and then rotate over all your different aliases until you're all done. Maybe in your case set an empty var that gets prompted on runtime, and set the providers to use that var? or maybe do it locally and make sure you remove those files before check-in? Can we make the state refresh thing use the -provider=blah settings please? |
The default provider is required due to a bug in terraform hashicorp/terraform#21330
* Upgrade module to terraform 0.12 * Upgrade module to terraform 0.12 * Set eu-west-1 as default * Added default was provider The default provider is required due to a bug in terraform hashicorp/terraform#21330 * Add maintainer * Update vpc version * Update readme for tf 0.12
Same issue if you defined as variable:
in environment and modules and only a default value in environment:
and empty in modules:
|
I can't run
The module itself doesn't have provider because the end user is expected to add it. Validation works if I add this to my module provider "vsphere" {
user = "test"
password = "test"
} How can one skip provider check for vSphere module validation? |
Yes I did run that. |
Hi folks! Much of (possibly all) the relevant code paths have changed since 0.12.0, and we've fixed various issues in this area (specifically with import), so I am going to close this issue. If you are still seeing problems in v0.13.0, please open a new issue. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Summary
Import of an AWS resource will fail if a default (non-aliased) provider is not present, even if all resources are using a valid aliased provider.
Import of the same resource succeeds if:
AWS_DEFAULT_REGION
environment variable is set to any region value, even if it's a different region than the resource imported0.11 has a slightly different behaviour in that it's blocking on an interactive prompt asking for a region value. I can specify any region value and the import will proceed. I am assuming it's related, but in 0.12 it's immediate "hard" failure.
Terraform Version
Terraform Configuration Files
Steps to Reproduce
terraform init
terraform import -provider=aws.sydney aws_route_table.main rtb-XXX
Expected Behavior
Import finishes successfully.
Actual Behavior
After refreshing the resource state correctly, import fails anyway.
Debug Output
The only excerpt that seems to be relevant happens before the import starts:
And then a few seconds later after the import has finished:
The text was updated successfully, but these errors were encountered: