diff options
author | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-08-09 15:59:15 +0200 |
---|---|---|
committer | Alexandre Garand <alexandre.garand@fretlink.com> | 2019-08-09 16:39:21 +0200 |
commit | 863486a6b71ed0e562a3965bed56465d007b1418 (patch) | |
tree | e93f6a687695af86d54237ec9f575d4ef104222d /vendor/github.com/hashicorp/terraform/configs/parser_config_dir.go | |
parent | 49c1c7b4dc69ffb9ab52330e6dc52ccdd6351087 (diff) | |
download | terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.tar.gz terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.tar.zst terraform-provider-statuscake-863486a6b71ed0e562a3965bed56465d007b1418.zip |
update vendor and go.modadd_contact_groups
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/configs/parser_config_dir.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/configs/parser_config_dir.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/configs/parser_config_dir.go b/vendor/github.com/hashicorp/terraform/configs/parser_config_dir.go index 3014cb4..752d6d9 100644 --- a/vendor/github.com/hashicorp/terraform/configs/parser_config_dir.go +++ b/vendor/github.com/hashicorp/terraform/configs/parser_config_dir.go | |||
@@ -2,6 +2,7 @@ package configs | |||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | "os" | ||
5 | "path/filepath" | 6 | "path/filepath" |
6 | "strings" | 7 | "strings" |
7 | 8 | ||
@@ -140,3 +141,23 @@ func IsIgnoredFile(name string) bool { | |||
140 | strings.HasSuffix(name, "~") || // vim | 141 | strings.HasSuffix(name, "~") || // vim |
141 | strings.HasPrefix(name, "#") && strings.HasSuffix(name, "#") // emacs | 142 | strings.HasPrefix(name, "#") && strings.HasSuffix(name, "#") // emacs |
142 | } | 143 | } |
144 | |||
145 | // IsEmptyDir returns true if the given filesystem path contains no Terraform | ||
146 | // configuration files. | ||
147 | // | ||
148 | // Unlike the methods of the Parser type, this function always consults the | ||
149 | // real filesystem, and thus it isn't appropriate to use when working with | ||
150 | // configuration loaded from a plan file. | ||
151 | func IsEmptyDir(path string) (bool, error) { | ||
152 | if _, err := os.Stat(path); err != nil && os.IsNotExist(err) { | ||
153 | return true, nil | ||
154 | } | ||
155 | |||
156 | p := NewParser(nil) | ||
157 | fs, os, err := p.dirFiles(path) | ||
158 | if err != nil { | ||
159 | return false, err | ||
160 | } | ||
161 | |||
162 | return len(fs) == 0 && len(os) == 0, nil | ||
163 | } | ||