diff options
author | Jake Champlin <jake.champlin.27@gmail.com> | 2017-06-06 12:40:07 -0400 |
---|---|---|
committer | Jake Champlin <jake.champlin.27@gmail.com> | 2017-06-06 12:40:07 -0400 |
commit | bae9f6d2fd5eb5bc80929bd393932b23f14d7c93 (patch) | |
tree | ca9ab12a7d78b1fc27a8f734729081357ce6d252 /vendor/github.com/hashicorp/hil/ast/unknown.go | |
parent | 254c495b6bebab3fb72a243c4bce858d79e6ee99 (diff) | |
download | terraform-provider-statuscake-bae9f6d2fd5eb5bc80929bd393932b23f14d7c93.tar.gz terraform-provider-statuscake-bae9f6d2fd5eb5bc80929bd393932b23f14d7c93.tar.zst terraform-provider-statuscake-bae9f6d2fd5eb5bc80929bd393932b23f14d7c93.zip |
Initial transfer of provider code
Diffstat (limited to 'vendor/github.com/hashicorp/hil/ast/unknown.go')
-rw-r--r-- | vendor/github.com/hashicorp/hil/ast/unknown.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/hil/ast/unknown.go b/vendor/github.com/hashicorp/hil/ast/unknown.go new file mode 100644 index 0000000..d6ddaec --- /dev/null +++ b/vendor/github.com/hashicorp/hil/ast/unknown.go | |||
@@ -0,0 +1,30 @@ | |||
1 | package ast | ||
2 | |||
3 | // IsUnknown reports whether a variable is unknown or contains any value | ||
4 | // that is unknown. This will recurse into lists and maps and so on. | ||
5 | func IsUnknown(v Variable) bool { | ||
6 | // If it is unknown itself, return true | ||
7 | if v.Type == TypeUnknown { | ||
8 | return true | ||
9 | } | ||
10 | |||
11 | // If it is a container type, check the values | ||
12 | switch v.Type { | ||
13 | case TypeList: | ||
14 | for _, el := range v.Value.([]Variable) { | ||
15 | if IsUnknown(el) { | ||
16 | return true | ||
17 | } | ||
18 | } | ||
19 | case TypeMap: | ||
20 | for _, el := range v.Value.(map[string]Variable) { | ||
21 | if IsUnknown(el) { | ||
22 | return true | ||
23 | } | ||
24 | } | ||
25 | default: | ||
26 | } | ||
27 | |||
28 | // Not a container type or survive the above checks | ||
29 | return false | ||
30 | } | ||