-
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
command: Add remote state capability to output subcommand #6665
Conversation
ef2a077
to
ee8bd6e
Compare
Interesting idea! (Of course, your second use-case should be eliminated by being able to interpolate data resource attributes into count, but still!) I wonder if this would be more intuitive as a separate command Don't feel that strongly about it, though. What do you think? |
@apparentlymart, thanks! Yeah this idea mainly came up as a stop-gap idea for me while #4169 is fully hashed out, but I figured there might be value for remote state being readable from Terraform for out-of-band tasks as well. I was torn too on where exactly in the command tree to put this, but settled on Let me see what I can do here. :) |
1af38bb
to
7d60d46
Compare
Alright, this is now done. The functionality has been moved to In this process I also did a bit of a re-factoring on the |
7d60d46
to
9935268
Compare
9935268
to
203cd29
Compare
5a68a97
to
ea0ea41
Compare
Add the ability to get *separate* remote state via the "terraform remote output" subcommand. Syntax follows "terraform remote config", with a couple of additions. This allows the ability to extract remote state from Terraform in places were remote state may not be present, without having to pre-configure remote state. Also, as part of this work, there has been a re-factoring of the outputsAsString function to allow both "terraform output" and "terraform remote output" to print all outputs, even when an optional module is supplied.
ea0ea41
to
0da4e8f
Compare
Just a FYI I'm about to close this. There has been some changes and divergences to the way that outputs are handled it looks like (work that @jen20 has been doing to ensure that list and map outputs are properly formatted and handled) which has added some complexity to keeping this up to date. Further to that, I have found that I can replace a good chunk of this functionality with a simple |
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. |
UPDATE: Moved to
terraform remote output
- see comments.This patch provides the ability to view separate remote state via the
terraform output
sub-command.Some use cases:
terraform remote config
first.terraform_remote_state
, but you need to provide the outputs to variables/parameters that ultimately influence resourcecount
s (my use case). In this instance, you can use this to view the outputs of a separate remote state without affecting your current locally configured remote state.Command-line usage is similar to
terraform remote config
, but with some changes to make things semantic for the specific use context.Also, I've updated the docs and the help a little bit for the
-module
flag, which only works when you are specifying a certain output to display, due to the fact thatcommand.outputsAsString()
only acts on the root module.I was going to make this a separate project (https://github.com/paybyphone/terraform-remote-env) but that kind of seemed silly. ;)