-
Notifications
You must be signed in to change notification settings - Fork 9k
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
"Terraform prompts to enter provider.aws.region" #1043
Comments
Same issue here still with
using in other module:
|
For me it was issue that some resources were in the same directory as module initialization, therefore there was no region defined for them. Something like
Mind that terraform takes whole directory so you should check each file if there is no resource created. Solution was simple for me, move everything to module, even if you create small resource because otherwise no provider is defined for it. Hope it helps somebody, it's not answer to the issue per se, but maybe someone else missed that. Cheers |
Same issue with 0.11.1. |
A workaround in the meantime is to use the environment variable |
Have been living with this for more than a year, or so. Everytime I use multiple providers I have to hit enter to apply. |
This might seem silly, but I notice that when I specify any other attribute other than 'region' for a provider definition (in this example, an alias), it prompts me for the provider even if all of my resources are created using the alias. Therefore my solution is:
A (somewhat redundant) 'default' definition, followed by a second definition with the attributes you want. This resolved the issue for me. |
@petewilcock Your workaround works a treat, but I'm at a loss to the 'how' - I have exactly the same problem with:
|
It seems the best practice is to not declare the provider in the child module, but rather keep all providers in the root module, and pass the provider to the child module as a parameter either implicitly or explicitly as described here: https://www.terraform.io/docs/modules/usage.html#providers-within-modules
root module
|
I've just run into this shortly after after enabling s3 backend & remote states: terraform: 0.11.7 |
I no longer have this issue across any of my Terraform modules. It may seem trivial, but this single nugget of information cleared up a LOT for me, so I'll share: https://www.terraform.io/docs/modules/create.html
It took me an embarrassing amount of searching to definitively understand what a "root module" really is. So, combining with @sjwl's advice, only declare providers where you run |
You just need to read documentation more carefully :) |
@reedflinch - same here. The wording root module threw me off thinking it refers to the parent module, not the current module. Thanks for the clarification. |
Hey @edsonmarquezani did you find a way to get rid of this pain? |
Lmfao sounds like you have been living with a disease. |
@LeoncioXavier It's been some time since I stopped having to use multiple providers at once, but as far as I remember, I stopped declaring providers in modules, declaring only in the most "external" configuration (the one which really uses the module). I can't remember how I dealt with different regions in the same cloud, though, if I ever did. Declaring providers in different levels of configuration is wrong, anyway, this I'm sure. |
Reporting this issue as still an issue. I was able to solve it and get by it by not using an alias. terraform {
required_version = ">= 0.12.0"
}
provider "aws" {
alias = "cool_alias"
version = "~> 2.13"
region = "us-east-1"
}
resource "aws_vpc_peering_connection_accepter" "the_accepting_vpc" {} The above configuration asks for the user to enter the region terraform {
required_version = ">= 0.12.0"
}
provider "aws" {
version = "~> 2.13"
region = "us-east-1"
} Running |
When using an alias, either
|
I had exactly the case @mmell described. I specified a single provider with
|
Hi folks 👋 Please note that as mentioned in the above two comments, if you are using multiple provider instances and only declaring provider configurations with Given that the Terraform AWS Provider itself cannot give a different user experience for this problem (any changes would likely need to occur upstream in Terraform CLI to special handle this case) and that majority of these cases should be fixable via the two above documentation links, I'm going to close this since its not actionable here. If you're looking for general assistance, please note that we use GitHub issues in this repository for tracking bugs and enhancements with the Terraform AWS Provider codebase rather than for questions. While we may be able to help with certain simple problems here it's generally better to use the community forums where there are far more people ready to help, whereas the GitHub issues here are generally monitored only by a few maintainers and dedicated community members interested in code development of the Terraform AWS Provider itself. |
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. Thanks! |
Hi there,
it seems terraform version 0.9.6 is still affected by this bug hashicorp/terraform#8680
Sub modules seem to not pick the aws provider defined as a common module.
Terraform Version
0.9.6
Affected Resource(s)
Terraform Configuration Files
Here is my configuration :
and in a sub module, i'm calling the aws module like this
but it is still asking to enter the region.
Expected Behavior
The region defined in the aws provider module should be picked by the sub module, and never prompts for a new one.
Actual Behavior
Steps to Reproduce
terraform plan
References
hashicorp/terraform#10722
hashicorp/terraform#8680
The text was updated successfully, but these errors were encountered: