Skip to content

Commit d545a0d

Browse files
author
Mauren Berti
committed
Changes from code review.
1 parent c6ea1a7 commit d545a0d

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

rancher2/schema_app_v2.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@ func appV2Fields() map[string]*schema.Schema {
9191
DiffSuppressFunc: suppressAppDiff,
9292
},
9393
"deployment_values": {
94-
Type: schema.TypeString,
95-
Computed: true,
96-
Sensitive: false,
97-
Description: "App v2 computed values YAML file",
94+
Type: schema.TypeString,
95+
Computed: true,
96+
Sensitive: false,
97+
Description: "Values YAML file including computed values. This field prevents incorrect discrepancies from " +
98+
"showing in the terraform plan output when files change but values stay the same, due to additional " +
99+
"computed values included by the provider itself.",
98100
},
99101
"cleanup_on_fail": {
100102
Type: schema.TypeBool,
@@ -142,7 +144,7 @@ func validateAppSchema(val interface{}, key string) (warns []string, errs []erro
142144
}
143145
_, err := ghodssyamlToMapInterface(v)
144146
if err != nil {
145-
errs = append(errs, fmt.Errorf("%q must be in yaml format, error: %v", key, err))
147+
errs = append(errs, fmt.Errorf("[ERROR] %q must be in YAML format, error: %v", key, err))
146148
return
147149
}
148150
return

rancher2/structure_app_v2.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ func expandChartInstallV2(in *schema.ResourceData, chartInfo *types.ChartInfo) (
7171
globalInfo := generateGlobalInfoMap(in)
7272
valuesData := v3.MapStringInterface{}
7373
if v, ok := in.Get("values").(string); ok {
74-
values, err := unmarshallValuesContent(v)
74+
values, err := unmarshalValuesContent(v)
7575
if err != nil {
7676
return "", nil, err
7777
}
@@ -201,7 +201,7 @@ func expandChartUpgradeV2(in *schema.ResourceData, chartInfo *types.ChartInfo) (
201201
globalInfo := generateGlobalInfoMap(in)
202202
valuesData := v3.MapStringInterface{}
203203
if v, ok := in.Get("values").(string); ok {
204-
values, err := unmarshallValuesContent(v)
204+
values, err := unmarshalValuesContent(v)
205205
if err != nil {
206206
return "", nil, err
207207
}
@@ -257,10 +257,10 @@ func expandChartUpgradeV2(in *schema.ResourceData, chartInfo *types.ChartInfo) (
257257
return namespace, out, nil
258258
}
259259

260-
func unmarshallValuesContent(v string) (map[string]interface{}, error) {
260+
func unmarshalValuesContent(v string) (map[string]interface{}, error) {
261261
values, err := ghodssyamlToMapInterface(v)
262262
if err != nil {
263-
return nil, fmt.Errorf("failed to unmarshal chart install values yaml: %#v", err)
263+
return nil, fmt.Errorf("[ERROR] failed to unmarshal chart install values YAML: %#v", err)
264264
}
265265
if values == nil {
266266
values = map[string]interface{}{}

0 commit comments

Comments
 (0)