Terraform: capture output of provisioners into variables

Created on 27 Nov 2014  路  38Comments  路  Source: hashicorp/terraform

so that they could be referenced in other TF resources

config enhancement

Most helpful comment

I'm still actively developing https://github.com/matti/terraform-shell-resource module, the number of issues and github stars etc clearly shows that there is a massive demand for this one.

while my module works pretty well now after 0.12, having this in terraform would be super good.

All 38 comments

Interesting idea... and completely possible. I think we need an overhaul of the state a bit to better support longform text to support this. We plan on making this change at some point. I'll tag this for now.

+1!

We're needing this feature right now for creating and sharing cluster discovery tokens.

Here's how it's used in Ansible.

+1

So I just ran into the need for this as well, want to save the output from an inline script call and have it available after its been created.

I second @Supernomad. We are currently taking the state, parsing it into an ini file and then querying it that way into variables (via the Ansible lookup function). It would be great if this could be made easier.

I would love something like this as well. I've got a fair number of things that create accounts or keys or whatever on an instance that I'd love to be able to capture and then stick into other instances. I know this is probably tricky, but man, it would be cool to remove these manual steps from the process. :-)

I use terraform to stand up mesos clusters with a newly provisioned vault instance that has a randomly generated set of passwords for that cluster. In addition, I generate access tokens for our internal deployment tools and our devops engineers to access these secrets when they need them. I would like to be able to save these access tokens to our permanent on-premise vault installation. If terraform provided me a way to capture output from a provisioner, I would be able to do that.

+1

+1 I need this functionality also.

+1 this would be great

+1 it's block my swarm cluster. I have a token in master node and I need it randomly token from provisioner to use for include different nodes to cluster.

Any status on this? Why such a basic feature still not implemented? How can I join slaves of cluster if I can't memorize token...?

+1 helpful with AWS provider as well to fetch EC2 Windows password and pass to communicator

Interested in this also, mainly to register cluster join tokens.

It is a roadblock for many different scenarios. Is there any workaround to get command's output as a variable?

Meanwhile I did this that works for me in my use case: https://github.com/matti/terraform-shell-resource

Yeah, I see this as very useful feature to have as some commented for creating Docker Swarms or other valid use cases...

+1

+1

It would be a useful feature. Would solve so many roadblocks.

+1

+1

+1

Can someone tag a maintainer in here? If this is something they don't want to do would be nice if they state so and would close a ticket. It's opened since 2014!

+1 Thanks so much...

Hi all! I'm very sorry for the long silence on this request, but tagging maintainers and "+1" comments don't influence our prioritization. Please react to the original issue comment with 馃憤, which we can and do report on during prioritization.

Thee Terraform 0.12 release has dominated our focus for quite a long time now, but we will be planning future work in the not-too-distant future, and your 馃憤 will help.

Thank you @mildwonkey I've actually just found provider for ansible and this seems to be solves the issue. Now most hot problem of Terraform is that kubernetes provider annotation doesn't work,makes me almost up to impossible to use Terraform for kubernetes.

tagging maintainers and "+1" comments don't influence our prioritization.

Regardless of where +1 are located, it's obvious that a lot of people asked for this feature since 2014. So the most immediate problem is that your priorities are wrong. While this can be fixed by asking to give feedback to the correct place, you shouldn't be blocked waiting for it. Just be pragmatic.

+1

I'm still actively developing https://github.com/matti/terraform-shell-resource module, the number of issues and github stars etc clearly shows that there is a massive demand for this one.

while my module works pretty well now after 0.12, having this in terraform would be super good.

+1

+1

+1

@matti is it possible to use your module to run bash files ?

@boredabdel why not?

I'm wondering if it's possible ! and if you could provide an example it would great !

Thanks

just call the script as the command and you are good

Was this page helpful?
0 / 5 - 0 ratings