Skip to content

Commit

Permalink
Merge pull request #287 from hashicorp/b-exactly-one-of-unknowns
Browse files Browse the repository at this point in the history
schema/ExactlyOneOf: Fix handling of unknowns in complex types
  • Loading branch information
radeksimko authored Jan 8, 2020
2 parents 6184b31 + f85f24c commit 0a644c9
Show file tree
Hide file tree
Showing 2 changed files with 630 additions and 7 deletions.
14 changes: 7 additions & 7 deletions helper/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1508,13 +1508,13 @@ func validateExactlyOneAttribute(
specified := make([]string, 0)
unknownVariableValueCount := 0
for _, exactlyOneOfKey := range allKeys {
if raw, ok := c.Get(exactlyOneOfKey); ok {
if raw == hcl2shim.UnknownVariableValue {
// This aims to do a best effort check that at least one value is specified whether
// it's known or not.
unknownVariableValueCount++
continue
}
if c.IsComputed(exactlyOneOfKey) {
unknownVariableValueCount++
continue
}

_, ok := c.Get(exactlyOneOfKey)
if ok {
specified = append(specified, exactlyOneOfKey)
}
}
Expand Down
Loading

0 comments on commit 0a644c9

Please sign in to comment.