File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -50,10 +50,12 @@ func ParameterFromBlock(block *terraform.Block) (*types.Parameter, hcl.Diagnosti
50
50
51
51
pVal := richParameterValue (block )
52
52
53
+ requiredValue := true
53
54
def := types .NullString ()
54
55
defAttr := block .GetAttribute ("default" )
55
56
if ! defAttr .IsNil () {
56
57
def = types .ToHCLString (block , defAttr )
58
+ requiredValue = false
57
59
}
58
60
59
61
ftmeta := optionalString (block , "styling" )
@@ -77,7 +79,7 @@ func ParameterFromBlock(block *terraform.Block) (*types.Parameter, hcl.Diagnosti
77
79
Icon : optionalString (block , "icon" ),
78
80
Options : make ([]* types.ParameterOption , 0 ),
79
81
Validations : make ([]* types.ParameterValidation , 0 ),
80
- Required : optionalBoolean ( block , "required" ) ,
82
+ Required : requiredValue ,
81
83
DisplayName : optionalString (block , "display_name" ),
82
84
Order : optionalInteger (block , "order" ),
83
85
Ephemeral : optionalBoolean (block , "ephemeral" ),
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ func ParameterFromState(block *tfjson.StateResource) (types.Parameter, error) {
74
74
Icon : st .optionalString ("icon" ),
75
75
Options : options ,
76
76
Validations : validations ,
77
- Required : st .optionalBool ("required " ),
77
+ Required : ! st .optionalBool ("optional " ),
78
78
DisplayName : st .optionalString ("display_name" ),
79
79
Order : st .optionalInteger ("order" ),
80
80
Ephemeral : st .optionalBool ("ephemeral" ),
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ func (r *ParameterData) Valid(value HCLString) hcl.Diagnostics {
118
118
Icon : r .Icon ,
119
119
Option : providerOptions (r .Options ),
120
120
Validation : providerValidations (r .Validations ),
121
- Optional : false ,
121
+ Optional : ! r . Required ,
122
122
Order : int (r .Order ),
123
123
Ephemeral : r .Ephemeral ,
124
124
}).ValidateInput (valuePtr )
You can’t perform that action at this time.
0 commit comments