Skip to content
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

Providers are not inherited by grandchildren #4865

Closed
orclev opened this issue Jan 27, 2016 · 6 comments · Fixed by #6186
Closed

Providers are not inherited by grandchildren #4865

orclev opened this issue Jan 27, 2016 · 6 comments · Fixed by #6186

Comments

@orclev
Copy link

orclev commented Jan 27, 2016

When you declare a provider and then import a module, the child module has access to the provider declared in the parent. If the imported child module in turn imports a module the grandchild module does not have access to the provider declared in the grandparent.

terraform-bug-repro.zip

In the reproduction sample provided there is a root TF file, and 3 modules. The root calls module 1, which calls module 2, which calls module 3, all 3 modules instantiate a resource. In order for this to execute without error a provider must be declared in the root and module 2. Module 1 inherits its provider from the root, and module 3 inherits its provider from module 2. If the provider is left out of module 2 it will attempt to instantiate a new provider rather than use the one that module one has inherited from the root.

The following issues appear to be relevant to this issue:
#3285
#1819

@scottcunningham
Copy link

Any word on this? This has stung me too recently.

@Bowbaq
Copy link
Contributor

Bowbaq commented Mar 10, 2016

@phinze running into this today, trying to adapt some scripts from https://github.com/hashicorp/best-practices/tree/master/terraform. Somehow, on the first run it worked fine, but then I must have changed something, and now it's completely ignoring the aws provider declared in the root module. Any ETA on a fix?

@phinze
Copy link
Contributor

phinze commented Mar 10, 2016

@Bowbaq I was just reviewing issues today and this made it onto a short list to look into - you can work around it by switching to environment variable based config, but I agree it's annoying. Will see if I can get this sorted out before the 0.6.13 release. 👍

@Bowbaq
Copy link
Contributor

Bowbaq commented Mar 18, 2016

@phinze any updates on this?

@phinze
Copy link
Contributor

phinze commented Mar 23, 2016

Sorry I haven't been able to get to this yet - just noting that this is still on my (ever-shuffling) stack! 👌

phinze added a commit that referenced this issue Apr 14, 2016
The flattening process was not properly drawing dependencies between provider
nodes in modules and their parent provider nodes.

Fixes #2832
Fixes #4443
Fixes #4865
phinze added a commit that referenced this issue Apr 15, 2016
The flattening process was not properly drawing dependencies between provider
nodes in modules and their parent provider nodes.

Fixes #2832
Fixes #4443
Fixes #4865
jen20 pushed a commit that referenced this issue Apr 18, 2016
The flattening process was not properly drawing dependencies between provider
nodes in modules and their parent provider nodes.

Fixes #2832
Fixes #4443
Fixes #4865
@ghost
Copy link

ghost commented Apr 26, 2020

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.

@ghost ghost locked and limited conversation to collaborators Apr 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants