Skip to content

Commit

Permalink
Merge pull request #35310 from hashicorp/TF-10060
Browse files Browse the repository at this point in the history
stacks: send inputs in FindStackConfigurationComponents
  • Loading branch information
DanielMSchmidt authored Jun 11, 2024
2 parents f6db7ac + 343f550 commit 5a7e644
Show file tree
Hide file tree
Showing 5 changed files with 1,480 additions and 1,363 deletions.
7 changes: 7 additions & 0 deletions internal/rpcapi/stacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func stackConfigMetaforProto(cfgNode *stackconfig.ConfigNode, stackAddr stackadd
ret := &terraform1.FindStackConfigurationComponents_StackConfig{
Components: make(map[string]*terraform1.FindStackConfigurationComponents_Component),
EmbeddedStacks: make(map[string]*terraform1.FindStackConfigurationComponents_EmbeddedStack),
InputVariables: make(map[string]*terraform1.FindStackConfigurationComponents_InputVariable),
}

for name, cc := range cfgNode.Stack.Components {
Expand Down Expand Up @@ -188,6 +189,12 @@ func stackConfigMetaforProto(cfgNode *stackconfig.ConfigNode, stackAddr stackadd
ret.EmbeddedStacks[name] = sProto
}

for name, iv := range cfgNode.Stack.InputVariables {
ret.InputVariables[name] = &terraform1.FindStackConfigurationComponents_InputVariable{
Optional: !iv.DefaultValue.IsNull(),
}
}

return ret
}

Expand Down
8 changes: 8 additions & 0 deletions internal/rpcapi/stacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ func TestStacksFindStackConfigurationComponents(t *testing.T) {
},
},
},
InputVariables: map[string]*terraform1.FindStackConfigurationComponents_InputVariable{
"unused": {
Optional: false,
},
"unused_with_default": {
Optional: true,
},
},
}
if diff := cmp.Diff(want, got, protocmp.Transform()); diff != "" {
t.Errorf("wrong result\n%s", diff)
Expand Down
Loading

0 comments on commit 5a7e644

Please sign in to comment.