-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Provider and strong tie to region seems broken #1813
Comments
I believe this to be terraform issue, not a provider issue. |
That is in fact how it works. There is no need to specify multiple providers if you're specifying the region directly on the resource—the region on the provider is only used as a default. |
Yep - a lot of our imports allow you to specify |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
This issue was originally opened by @bradrhod as hashicorp/terraform#18531. It was migrated here as a result of the provider split. The original body of the issue is below.
Having a provider that requires a region, and then requiring any assets to be created in any other regions to have a alaised provider seems like the wrong model. Many assets have a region field in the asset, terraform should just be able to use that region field and create the asset. In particular Import is very broken.
For instance if you import a default google cloud project, it will have a 'default' network. That default network will have 17 default subnets. So to even get started creating something similar I have to create 17 providers all aliased the same way:
This is a load of busy work just to get a region field in an asset to work, as you would expect it to work in the first place.
Should not create a default network in region us-central1, it should be in region europe-west1.
The way that this happens on import is super clunky. Issuing a
terraform import google_compute_subnetwork.asia-east1 default
gets you a state file shown below. Note that the region for the asset coming from Google Cloud correctly says the region is asia-east1, but terraform clobbers that and puts the asset in us-central1. Not sure why.You have to do a 'terraform import --provider="google.asia-east1" google_compute_subnetwork.asia-east1 default ` to get this to import as you would expect. This is actually somewhat hard to debug and figure all of this out.
This import seems totally wrong. Would it not be easier just to have the region from the asset be used, as you would expect? On import from the cloud can we just not overwrite the region the provider sets?I think this is the same on all of the providers, so not specific to Google cloud.
It seems the provider created without an alias is just really carrying the 'default region'.
Am I not thinking about this correctly?
Terraform Version
Expected Behavior
Actual Behavior
Steps to Reproduce
create a default google cloud project.
create a simple default google provider and project.
use
terraform import google_compute_subnetwork.asia-east1 default' run
terraform plan` and notice that wants to move asia-east1 default network to us-central1References
https://groups.google.com/forum/#!topic/terraform-tool/P2r9mbcha2I
hashicorp/terraform#12512
hashicorp/terraform#15961
The text was updated successfully, but these errors were encountered: