@@ -10,7 +10,9 @@ import (
10
10
"github.com/hashicorp/terraform-plugin-framework-validators/float64validator"
11
11
"github.com/hashicorp/terraform-plugin-framework-validators/int64validator"
12
12
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
13
+ "github.com/hashicorp/terraform-plugin-framework-validators/objectvalidator"
13
14
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
15
+ "github.com/hashicorp/terraform-plugin-framework/path"
14
16
"github.com/hashicorp/terraform-plugin-framework/resource"
15
17
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
16
18
"github.com/hashicorp/terraform-plugin-framework/resource/schema/booldefault"
@@ -109,7 +111,7 @@ func ResourceSchema(ctx context.Context) schema.Schema {
109
111
},
110
112
"action" : schema.StringAttribute {
111
113
Description : "The action to perform when the rule matches.\n Available values: \" block\" , \" challenge\" , \" compress_response\" , \" execute\" , \" js_challenge\" , \" log\" , \" managed_challenge\" , \" redirect\" , \" rewrite\" , \" route\" , \" score\" , \" serve_error\" , \" set_config\" , \" skip\" , \" set_cache_settings\" , \" log_custom_field\" , \" ddos_dynamic\" , \" force_connection_close\" ." ,
112
- Optional : true ,
114
+ Required : true ,
113
115
Validators : []validator.String {
114
116
stringvalidator .OneOfCaseInsensitive (
115
117
"block" ,
@@ -1045,13 +1047,16 @@ func ResourceSchema(ctx context.Context) schema.Schema {
1045
1047
},
1046
1048
"expression" : schema.StringAttribute {
1047
1049
Description : "The expression defining which traffic will match the rule." ,
1048
- Optional : true ,
1050
+ Required : true ,
1049
1051
},
1050
1052
"logging" : schema.SingleNestedAttribute {
1051
1053
Description : "An object configuring the rule's logging behavior." ,
1052
1054
Computed : true ,
1053
1055
Optional : true ,
1054
- CustomType : customfield.NewNestedObjectType [RulesetRulesLoggingModel ](ctx ),
1056
+ Validators : []validator.Object {
1057
+ objectvalidator .AlsoRequires (path .MatchRelative ().AtName ("enabled" )),
1058
+ },
1059
+ CustomType : customfield.NewNestedObjectType [RulesetRulesLoggingModel ](ctx ),
1055
1060
Attributes : map [string ]schema.Attribute {
1056
1061
"enabled" : schema.BoolAttribute {
1057
1062
Description : "Whether to generate a log when the rule matches." ,
0 commit comments