aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/terraform/config/config_string.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/config/config_string.go')
-rw-r--r--vendor/github.com/hashicorp/terraform/config/config_string.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/config/config_string.go b/vendor/github.com/hashicorp/terraform/config/config_string.go
index 0b3abbc..a6933c2 100644
--- a/vendor/github.com/hashicorp/terraform/config/config_string.go
+++ b/vendor/github.com/hashicorp/terraform/config/config_string.go
@@ -143,6 +143,46 @@ func outputsStr(os []*Output) string {
143 result += fmt.Sprintf(" %s: %s\n", kind, str) 143 result += fmt.Sprintf(" %s: %s\n", kind, str)
144 } 144 }
145 } 145 }
146
147 if o.Description != "" {
148 result += fmt.Sprintf(" description\n %s\n", o.Description)
149 }
150 }
151
152 return strings.TrimSpace(result)
153}
154
155func localsStr(ls []*Local) string {
156 ns := make([]string, 0, len(ls))
157 m := make(map[string]*Local)
158 for _, l := range ls {
159 ns = append(ns, l.Name)
160 m[l.Name] = l
161 }
162 sort.Strings(ns)
163
164 result := ""
165 for _, n := range ns {
166 l := m[n]
167
168 result += fmt.Sprintf("%s\n", n)
169
170 if len(l.RawConfig.Variables) > 0 {
171 result += fmt.Sprintf(" vars\n")
172 for _, rawV := range l.RawConfig.Variables {
173 kind := "unknown"
174 str := rawV.FullKey()
175
176 switch rawV.(type) {
177 case *ResourceVariable:
178 kind = "resource"
179 case *UserVariable:
180 kind = "user"
181 }
182
183 result += fmt.Sprintf(" %s: %s\n", kind, str)
184 }
185 }
146 } 186 }
147 187
148 return strings.TrimSpace(result) 188 return strings.TrimSpace(result)