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
5050
5151 pVal := richParameterValue (block )
5252
53+ requiredValue := true
5354 def := types .NullString ()
5455 defAttr := block .GetAttribute ("default" )
5556 if ! defAttr .IsNil () {
5657 def = types .ToHCLString (block , defAttr )
58+ requiredValue = false
5759 }
5860
5961 ftmeta := optionalString (block , "styling" )
@@ -77,7 +79,7 @@ func ParameterFromBlock(block *terraform.Block) (*types.Parameter, hcl.Diagnosti
7779 Icon : optionalString (block , "icon" ),
7880 Options : make ([]* types.ParameterOption , 0 ),
7981 Validations : make ([]* types.ParameterValidation , 0 ),
80- Required : optionalBoolean ( block , "required" ) ,
82+ Required : requiredValue ,
8183 DisplayName : optionalString (block , "display_name" ),
8284 Order : optionalInteger (block , "order" ),
8385 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) {
7474 Icon : st .optionalString ("icon" ),
7575 Options : options ,
7676 Validations : validations ,
77- Required : st .optionalBool ("required " ),
77+ Required : ! st .optionalBool ("optional " ),
7878 DisplayName : st .optionalString ("display_name" ),
7979 Order : st .optionalInteger ("order" ),
8080 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 {
118118 Icon : r .Icon ,
119119 Option : providerOptions (r .Options ),
120120 Validation : providerValidations (r .Validations ),
121- Optional : false ,
121+ Optional : ! r . Required ,
122122 Order : int (r .Order ),
123123 Ephemeral : r .Ephemeral ,
124124 }).ValidateInput (valuePtr )
You can’t perform that action at this time.
0 commit comments