Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(CLOUDDEV-1134): fix add sg without port #178

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
13 changes: 9 additions & 4 deletions edgecenter/resource_edgecenter_securitygroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ func resourceSecurityGroup() *schema.Resource {
"port_range_min": {
Type: schema.TypeInt,
Optional: true,
Default: 1,
Computed: true,
ValidateFunc: validation.IntBetween(1, 65535),
},
"port_range_max": {
Type: schema.TypeInt,
Optional: true,
Default: 65535,
Computed: true,
ValidateFunc: validation.IntBetween(1, 65535),
},
"description": {
Expand Down Expand Up @@ -250,8 +250,13 @@ func resourceSecurityGroupCreate(ctx context.Context, d *schema.ResourceData, m
return diag.FromErr(fmt.Errorf("value of the port_range_min cannot be greater than port_range_max"))
}

sgrOpts.PortRangeMax = &portRangeMax
sgrOpts.PortRangeMin = &portRangeMin
if portRangeMax != 0 {
sgrOpts.PortRangeMax = &portRangeMax
}

if portRangeMin != 0 {
sgrOpts.PortRangeMin = &portRangeMin
}

rules[i] = sgrOpts
}
Expand Down
Loading