mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-10 23:55:34 -06:00
terraform: IsSet can be called on nil
This commit is contained in:
parent
7980aa96a8
commit
6bef265514
@ -129,6 +129,10 @@ func (c *ResourceConfig) Get(k string) (interface{}, bool) {
|
||||
// raw configuration itself, since a key may be omitted from the raw
|
||||
// configuration if it is being computed.
|
||||
func (c *ResourceConfig) IsSet(k string) bool {
|
||||
if c == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, ck := range c.ComputedKeys {
|
||||
if ck == k {
|
||||
return true
|
||||
|
@ -167,3 +167,11 @@ func TestResourceConfig_IsSet(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestResourceConfig_IsSet_nil(t *testing.T) {
|
||||
var rc *ResourceConfig
|
||||
|
||||
if rc.IsSet("foo") {
|
||||
t.Fatal("bad")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user