From 47a169d0ef3b9708f8e021097cfd1fae7dc50e07 Mon Sep 17 00:00:00 2001 From: Guido van der Hart Date: Thu, 28 Nov 2024 13:19:29 +0100 Subject: [PATCH] feat(security-groups): Make it possible to specify list of CIDRs in IpRange variable for security group rules --- cloud/services/security/securitygroup.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cloud/services/security/securitygroup.go b/cloud/services/security/securitygroup.go index d6b9980bf..911569d0a 100644 --- a/cloud/services/security/securitygroup.go +++ b/cloud/services/security/securitygroup.go @@ -19,6 +19,7 @@ package security import ( "fmt" "net/http" + "strings" "errors" @@ -135,9 +136,10 @@ func (s *Service) CreateSecurityGroupRule(securityGroupId string, flow string, i } else if securityGroupMemberId != "" && ipRange != "" { return nil, errors.New("Get Both ipRange and securityGroupMemberId") } else { + ipRanges := strings.Split(ipRange, ",") rule = osc.SecurityGroupRule{ IpProtocol: &ipProtocol, - IpRanges: &[]string{ipRange}, + IpRanges: &ipRanges, FromPortRange: &fromPortRange, ToPortRange: &toPortRange, } @@ -202,9 +204,10 @@ func (s *Service) DeleteSecurityGroupRule(securityGroupId string, flow string, i ToPortRange: &toPortRange, } } else { + ipRanges := strings.Split(ipRange, ",") rule = osc.SecurityGroupRule{ IpProtocol: &ipProtocol, - IpRanges: &[]string{ipRange}, + IpRanges: &ipRanges, FromPortRange: &fromPortRange, ToPortRange: &toPortRange, }