@@ -152,7 +152,9 @@ func parameterDataSource() *schema.Resource {
152
152
// Always set back the value, as it can be sourced from the default
153
153
rd .Set ("value" , value )
154
154
155
- // Set the form_type as it could have changed in the validation.
155
+ // Set the form_type, as if it was unset, a default form_type will be updated on
156
+ // the parameter struct. Always set back the updated form_type to be more
157
+ // specific than the default empty string.
156
158
rd .Set ("form_type" , parameter .FormType )
157
159
158
160
return nil
@@ -397,9 +399,13 @@ func (v *Parameter) ValidateInput(input *string) (string, diag.Diagnostics) {
397
399
var err error
398
400
var optionType OptionType
399
401
402
+ valuePath := cty.Path {}
400
403
value := input
401
404
if input == nil {
402
405
value = v .Default
406
+ if v .Default != nil {
407
+ valuePath = defaultValuePath
408
+ }
403
409
}
404
410
405
411
// optionType might differ from parameter.Type. This is ok, and parameter.Type
@@ -436,7 +442,7 @@ func (v *Parameter) ValidateInput(input *string) (string, diag.Diagnostics) {
436
442
forcedValue = * value
437
443
}
438
444
439
- d := v .validValue (forcedValue , optionType , optionValues , cty. Path {} )
445
+ d := v .validValue (forcedValue , optionType , optionValues , valuePath )
440
446
if d .HasError () {
441
447
return "" , d
442
448
}
@@ -511,7 +517,7 @@ func (v *Parameter) validValue(value string, optionType OptionType, optionValues
511
517
if len (optionValues ) > 0 {
512
518
if v .Type == OptionTypeListString && optionType == OptionTypeString {
513
519
// If the type is list(string) and optionType is string, we have
514
- // to ensure all elements of the default exist as options.
520
+ // to ensure all elements of the value exist as options.
515
521
listValues , err := valueIsListString (value )
516
522
if err != nil {
517
523
return diag.Diagnostics {
0 commit comments