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

Referencing docker_container.*.ports.*.external does not work #5510

Closed
geovanisouza92 opened this issue Mar 8, 2016 · 4 comments
Closed

Comments

@geovanisouza92
Copy link

I'm trying to referencing a docker_container resource ports, but is does outputs anything, even if the external port is fixed. The workaround is inform the external port through variable, then use it on interpolations.

Here is an example of configuration files and results.

@jen20
Copy link
Contributor

jen20 commented Mar 9, 2016

Hi @geovanisouza92! I don't think there is an easy workaround for this at the moment, and the implementation makes it difficult to do multiple "splats" in one interpolation such as docker_container.*.ports.*.external would require right now. For now the best workaround is to buffer via a variable, which you have already used by the look of it. This is something that we might come around to in the future, but for now I'm going to close it - feel free to reopen if you have further questions. Thanks for opening this issue!

@geovanisouza92
Copy link
Author

Hi @jen20,Thank you for reply!

I expressed myself badly. I don't intended to use splats, but simple references to the first external port of each container, like

output "foo" {
  value = "${docker_container.mysql.ports.0.external}" # Here
}

Another thing that I noticed is even terraform refresh command isn't capable to read the port from the running container. Digging through the code, I saw this, so I think that the method resourceDockerContainerRead should read the ports and update the ResourceData object. I hope that this could make any sense.

Thank you.

@jen20 jen20 reopened this Mar 10, 2016
@apparentlymart
Copy link
Contributor

Hi @geovanisouza92! Sorry for the long silence here... this issue was using an old labeling scheme, and so we missed it on previous passes of posting updates.

It seems like this issue is covering the same needs as #17048, so I'm going to close it just to consolidate the discussion over there. I've previously posted some updates in that issue about plans for the next major release that will, I think, get you what you needed here.

("double-splats" is not in scope for that, but I see you clarified in your later comment that this wasn't what you needed anyway.)

@ghost
Copy link

ghost commented Apr 2, 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 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants