configs: Variable and Output both have Addr methods

We previously added methods like this for some of the other types in this
package, including Local in this same file, but apparently haven't needed
these two yet.
This commit is contained in:
Martin Atkins 2022-06-14 17:12:23 -07:00
parent d06cbfe6c8
commit 209b8de7a5

View File

@ -261,6 +261,10 @@ func decodeVariableType(expr hcl.Expression) (cty.Type, *typeexpr.Defaults, Vari
}
}
func (v *Variable) Addr() addrs.InputVariable {
return addrs.InputVariable{Name: v.Name}
}
// Required returns true if this variable is required to be set by the caller,
// or false if there is a default value that will be used when it isn't set.
func (v *Variable) Required() bool {
@ -466,6 +470,10 @@ func decodeOutputBlock(block *hcl.Block, override bool) (*Output, hcl.Diagnostic
return o, diags
}
func (o *Output) Addr() addrs.OutputValue {
return addrs.OutputValue{Name: o.Name}
}
// Local represents a single entry from a "locals" block in a module or file.
// The "locals" block itself is not represented, because it serves only to
// provide context for us to interpret its contents.