-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
command/console: support root module output #24060
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From digging into outputs last week, I feel like this might not be the right direction (namely, making OutputValue
referenceable
, when it is noted to explicitly not be) to address this issue.
@@ -13,6 +13,7 @@ import ( | |||
// OutputValue is not Referenceable, while ModuleCallOutput is. | |||
type OutputValue struct { | |||
Name string | |||
referenceable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// OutputValue is not Referenceable, while ModuleCallOutput is.
The comment right above this would be incorrect from this PR, and as well, I wonder about how this relates to this code's intention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah wonderful catch, thanks! The whole point is that it is now referenceable so MILDLY IMPORTANT that the comments match
@@ -128,6 +128,11 @@ func (d analysisData) GetModuleInstance(addrs.ModuleCallInstance, tfdiags.Source | |||
} | |||
|
|||
func (d analysisData) GetModuleInstanceOutput(addrs.ModuleCallOutput, tfdiags.SourceRange) (cty.Value, tfdiags.Diagnostics) { | |||
// This implementation doesn't use this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment denoting that this is dead code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this function is required so that the interface is implemented, but is not used - I will add to the comment!
@pselle thank you, this is really helpful feedback:
I was only thinking about the console output needs and had missed the additional implications of making this |
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. |
The
terraform console
command was unable to print root module outputs, instead only supporting module output (which I suspect won't work in 0.12 at all, since only root module outputs are stored in state).Addresses some of the concerns in 21516, but possibly not all - as implemented this still requires an initial apply, even if the value is hard-coded in the module.
From a MODIFIED example in this comment:
I had to add the output to the root module for the above to work:
Note that (as currently implemented) this only works after an apply; the value must be in state. If it's intended/expected to work without apply there's more to be done, but I hope this is a sufficient first step.
This works too!