Skip to content

Commit a451bbf

Browse files
Rakhi Narayangovindrao55
authored andcommitted
fixing all match criteria in oci_core_drg_route_distribution_statement resource
1 parent 8f47e5b commit a451bbf

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

examples/networking/drg_route/drg_routing.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,19 @@ resource "oci_core_drg_route_distribution_statement" "test_vcn_drg_route_distrib
7676
priority = 10
7777

7878

79+
}
80+
81+
resource "oci_core_drg_route_distribution_statement" "test_vcn_drg_route_distribution_statements_empty" {
82+
// Required
83+
drg_route_distribution_id = oci_core_drg_route_distribution.test_vcn_drg_route_distribution.id
84+
action = "ACCEPT"
85+
86+
match_criteria {
87+
}
88+
89+
priority = 50
90+
91+
7992
}
8093

8194
data "oci_core_drg_route_distribution" "test_vcn_drg_route_distribution_data" {

oci/core_drg_route_distribution_statement_resource.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func CoreDrgRouteDistributionStatementResource() *schema.Resource {
5151
Type: schema.TypeList,
5252
Required: true,
5353
MaxItems: 1,
54-
MinItems: 1,
54+
MinItems: 0,
5555
Elem: &schema.Resource{
5656
Schema: map[string]*schema.Schema{
5757
// Required
@@ -62,6 +62,7 @@ func CoreDrgRouteDistributionStatementResource() *schema.Resource {
6262
ValidateFunc: validation.StringInSlice([]string{
6363
"DRG_ATTACHMENT_ID",
6464
"DRG_ATTACHMENT_TYPE",
65+
"",
6566
}, true),
6667
},
6768
// Optional
@@ -143,7 +144,7 @@ func (s *CoreDrgRouteDistributionStatementResourceCrud) Create() error {
143144

144145
converted, err := s.mapToDrgRouteDistributionMatchCriteria(fieldKeyFormat)
145146
if err != nil {
146-
return fmt.Errorf("unable to convert icmp_options, encountered error: %v", err)
147+
return fmt.Errorf("unable to convert match criteria, encountered error: %v", err)
147148
}
148149

149150
statement.MatchCriteria = []oci_core.DrgRouteDistributionMatchCriteria{converted}
@@ -368,6 +369,7 @@ func (s *CoreDrgRouteDistributionStatementResourceCrud) mapToDrgRouteDistributio
368369
matchType = matchTypeRaw.(string)
369370
} else {
370371
matchType = "" // default value
372+
return baseObject, nil
371373
}
372374
switch strings.ToLower(matchType) {
373375
case strings.ToLower("DRG_ATTACHMENT_ID"):

0 commit comments

Comments
 (0)