Skip to content

Commit 3d3c0e6

Browse files
committed
fix: acceptance tests
1 parent e4537b1 commit 3d3c0e6

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

cloudstack/resource_cloudstack_loadbalancer_rule.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func resourceCloudStackLoadBalancerRule() *schema.Resource {
100100
"cidrlist": {
101101
Type: schema.TypeSet,
102102
Optional: true,
103-
Computed: true,
103+
//Computed: true,
104104
ForceNew: true,
105105
Elem: &schema.Schema{Type: schema.TypeString},
106106
Set: schema.HashString,
@@ -151,13 +151,16 @@ func resourceCloudStackLoadBalancerRuleCreate(d *schema.ResourceData, meta inter
151151
if protocol, ok := d.GetOk("protocol"); ok {
152152
p.SetProtocol(protocol.(string))
153153
}
154-
//TEST
155-
var cidrList []string
156-
for _, id := range d.Get("cidrlist").(*schema.Set).List() {
157-
cidrList = append(cidrList, id.(string))
158-
}
159154

160-
p.SetCidrlist(cidrList)
155+
// Set CIDR list
156+
if cidr, ok := d.GetOk("cidrlist"); ok {
157+
var cidrList []string
158+
for _, id := range cidr.(*schema.Set).List() {
159+
cidrList = append(cidrList, id.(string))
160+
}
161+
162+
p.SetCidrlist(cidrList)
163+
}
161164

162165
// Set the ipaddress id
163166
p.SetPublicipid(d.Get("ip_address_id").(string))

cloudstack/resource_cloudstack_loadbalancer_rule_test.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ func TestAccCloudStackLoadBalancerRule_forceNew(t *testing.T) {
112112
"cloudstack_loadbalancer_rule.foo", "public_port", "80"),
113113
resource.TestCheckResourceAttr(
114114
"cloudstack_loadbalancer_rule.foo", "private_port", "80"),
115-
resource.TestCheckResourceAttr(
116-
"cloudstack_loadbalancer_rule.foo", "cidrlist.0", "10.0.0.0/8"),
117115
),
118116
},
119117

@@ -181,8 +179,6 @@ func TestAccCloudStackLoadBalancerRule_vpcUpdate(t *testing.T) {
181179
"cloudstack_loadbalancer_rule.foo", "public_port", "80"),
182180
resource.TestCheckResourceAttr(
183181
"cloudstack_loadbalancer_rule.foo", "private_port", "80"),
184-
resource.TestCheckResourceAttr(
185-
"cloudstack_loadbalancer_rule.foo", "cidrlist.0", "10.0.0.0/8"),
186182
),
187183
},
188184

@@ -200,8 +196,6 @@ func TestAccCloudStackLoadBalancerRule_vpcUpdate(t *testing.T) {
200196
"cloudstack_loadbalancer_rule.foo", "private_port", "443"),
201197
resource.TestCheckResourceAttr(
202198
"cloudstack_loadbalancer_rule.foo", "cidrlist.0", "20.0.0.0/8"),
203-
resource.TestCheckResourceAttr(
204-
"cloudstack_loadbalancer_rule.foo", "cidrlist.1", "30.0.0.0/8"),
205199
),
206200
},
207201
},
@@ -300,7 +294,6 @@ resource "cloudstack_loadbalancer_rule" "foo" {
300294
public_port = 80
301295
private_port = 80
302296
member_ids = [cloudstack_instance.foobar1.id]
303-
cidrlist = ["10.0.0.0/8"]
304297
}`
305298

306299
const testAccCloudStackLoadBalancerRule_update = `
@@ -334,7 +327,6 @@ resource "cloudstack_loadbalancer_rule" "foo" {
334327
public_port = 80
335328
private_port = 80
336329
member_ids = [cloudstack_instance.foobar1.id]
337-
cidrlist = ["10.0.0.0/8"]
338330
}`
339331

340332
const testAccCloudStackLoadBalancerRule_forcenew = `
@@ -412,7 +404,6 @@ resource "cloudstack_loadbalancer_rule" "foo" {
412404
public_port = 80
413405
private_port = 80
414406
member_ids = [cloudstack_instance.foobar1.id]
415-
cidrlist = ["10.0.0.0/8"]
416407
}`
417408

418409
const testAccCloudStackLoadBalancerRule_vpc_update = `

0 commit comments

Comments
 (0)