-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
AWS Provider in 0.4.0- Credentials can't be used in modules #1380
Comments
Hey there, sorry for the trouble, and thanks for the detailed report! Let me take a look and see what's up. |
Hmm everything seems to be working fine from my side. Let me detail out my environment / process and hopefully we can figure out where the discrepancy is.
See any differences between that and your environment? |
Figured it out! I had env variables set that the provider was using. Unsetting (This also means that setting those env vars should function as a workaround for you.) |
I just deleted everything I could find related to terraform:
I then re-downloaded/reinstalled the bins for 0.4.0 from the download site then put them in my PATH. I then copy/pasted your output and made a new directory with your output in it (for absolute/complete separation) and got the same output as before 😦 I moved over to a co-workers machine and had him try out the same POC with the same code, his output is in my updated gist https://gist.github.com/zxjinn/3bf821620e784ac709bb#file-coworker Notable facts about my system (from facter): operatingsystem => Darwin
operatingsystemrelease => 14.1.0
macosx_productname => Mac OS X
macosx_productversion => 10.10.2
macosx_productversion_major => 10.10
productname => MacBookPro11,3 I even compiled the latest 0.4.1 version 0cff04a and still have the same problem. |
Wow - thanks for putting in all that work to help isolate the issue! Now it's my turn to work on getting it solved for you. 😀 |
I just tried the environment variable setting and unfortunately it did work for me! Glad I could assist in helping you find this. I'm digging into it so much because most of what I am working on today relies on Terraform and I wanted to use the newest version!
|
s/unfortunately/fortunately |
@phinze Nothing is popping out as an exact solution for this for me, but it is almost certainly in the graph config merge logic stuff, which is reasonably advanced. Some pointers of where to look:
The only tingling I'm getting is that I'm really confident this is a subgraph variable merge issue. The way that works:
It is somewhere in there, there is a lot of data flowing so somethign is happening. |
Thanks for the pointers @mitchellh - time to dive in. 🏊 |
Looks like I am running into this as well, when trying to test out our zookeeper template with the changes I made to solarce/tf_aws_asg@9485be2 to use I normally have the AWS_* stuff set in my environment, except I don't set a REGION by default, so when I unset AWS_ACCESS_KEY and AWS_SECRET_KEY I begin to get the same errors as previously reported
Additionally, doing |
I'm encountering this same issue if I try to delete a
|
Hey folks - just landed what should be the fix for this. If you have the ability to build from master, it'd be great if you could take it for a spin to double check that your issue is solved. Either way, it should come out in v0.4.1 this week. |
Still getting the error in my situation.
$ terraform apply
.... Then comment out
My system:
|
@johnrengelman Thanks for double checking. Will take a look at that scenario and follow up. |
Yup. Do you want a separate ticket? |
@johnrengelman actually yeah that'd be great! 👍 |
Moved to #1447 |
Thanks a lot guys, just pulled the latest master and it appears as if it's fixed. With the same TF config as above: $ terraform plan -var 'module_access_key=<actual key>' -var 'module_secret_key=<actual secret>' -var 'module_region=us-west-2' -module-depth=1 -refresh=true -out=out.tfplan
...
+ module.poc.aws_vpc.040-awsprovider-poc
cidr_block: "" => "10.0.0.0/16"
default_network_acl_id: "" => "<computed>"
default_security_group_id: "" => "<computed>"
enable_dns_hostnames: "" => "<computed>"
enable_dns_support: "" => "<computed>"
main_route_table_id: "" => "<computed>"
tags.#: "" => "1"
tags.Name: "" => "0.4.0-awsprovider-poc"
$ terraform apply out.tfplan
module.poc.aws_vpc.040-awsprovider-poc: Creating...
cidr_block: "" => "10.0.0.0/16"
default_network_acl_id: "" => "<computed>"
default_security_group_id: "" => "<computed>"
enable_dns_hostnames: "" => "<computed>"
enable_dns_support: "" => "<computed>"
main_route_table_id: "" => "<computed>"
tags.#: "" => "1"
tags.Name: "" => "0.4.0-awsprovider-poc"
module.poc.aws_vpc.040-awsprovider-poc: Creation complete
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
$ terraform plan -var 'module_access_key=<actual key>' -var 'module_secret_key=<actual secret>' -var 'module_region=us-west-2' -module-depth=1 -refresh=true -out=out.tfplan -destroy
Refreshing Terraform state prior to plan...
module.poc.aws_vpc.040-awsprovider-poc: Refreshing state... (ID: vpc-93eb53f6)
...
Path: out.tfplan
- module.poc.aws_vpc.040-awsprovider-poc
$ terraform apply out.tfplan
aws_vpc.040-awsprovider-poc: Destroying...
aws_vpc.040-awsprovider-poc: Destruction complete
Apply complete! Resources: 0 added, 0 changed, 1 destroyed. Funny enough Thanks again everyone! 👏 🎆 |
I've also pulled and tried this today because I hit a similar bug. My use case is that I want to use different AWS credentials inside >1 invocation of a module, in order to create resources across multiple Amazon accounts in one run of the tool, and manage ordering between them. If the module tries to create just one resource (eg. a VPC), this works fine. If I also try to create multiple subnets, these all fail with
I'm happy to provide you with a failing use case, or more details. |
@jtopper Can you open another issue with a full repro case? I'd be happy to take a look. |
Hi, i run into the same issue. Here is my context :
and here is the console output when i run : terraform plan
maint.tf
variables.tf
terraform.tfvars
../modules/network/main.tf
../modules/network/variables.tf
|
Thanks for the report @adelamarre - reopening so we can recheck this. |
@adelamarre just followed your instructions to set up the same scenario locally (both with 0.5.2 and master), and everything seems to be working AOK here. Perhaps you can double check on your side? |
@phinze @adelamarre I just followed your instructions with v0.5.0, an old compiled version of v0.5.1-dev I had from some previous testing (72afc6b) and the latest master (88f72aa) and all of them were just fine for me. |
Thanks @zxjinn! Okay with two instances of it working I'm going re-close this - @adelamarre can you open up a new issue if you are still seeing a problem? |
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. |
Hey guys, I appreciate all your hard work. 0.4.0 looks like a really great release! I downloaded it excitedly yesterday and ran into an issue I couldn't resolve. So I made a tiny POC to show the problem. I hope I'm not missing something really small and dumb here :person_frowning:.
File structure and contents
tree
awsprovider-poc.tf
modules/awsprovider-poc/main.tf
Using 0.3.7
So everything works as expected. Note that this works if I put the key, region, and secret key in all possible locations: in
terraform.tfvars
, pass it on the command line (as in the example), hard code it in theaws-provider.tf
file, or hard code it in themodules/aws-provider-poc/main.tf
file.Using 0.4.0
Just the opposite of 0.3.7: this does not work if I put the variables in all possible locations: using
terraform.tfvars
(in the root of the folder, not in the modules folder), passing it on the command line (as in the example), hard coding the values inaws-provider-poc.tf
, or hard coding them in themodules/aws-provider-poc/main.tf
file. I made a gist showing the output with TF_LOG=1. Thanks guys, Terraform is amazing!The text was updated successfully, but these errors were encountered: