Copilot commented on code in PR #317:
URL:
https://github.com/apache/cloudstack-terraform-provider/pull/317#discussion_r3786152513
##########
cloudstack/resource_cloudstack_loadbalancer_rule_test.go:
##########
@@ -210,6 +210,36 @@ func TestAccCloudStackLoadBalancerRule_vpcUpdate(t
*testing.T) {
})
}
+// TestAccCloudStackLoadBalancerRule_internal exercises a pure internal LB:
+// network_id set, ip_address_id omitted entirely -- no public IP at all.
+// Real CloudStack's createLoadBalancerRule marks publicipid optional for
+// exactly this VPC-internal case; before this fix the schema's
+// Required:true on ip_address_id made it impossible to even plan such a
+// config, regardless of what the real API allowed.
+func TestAccCloudStackLoadBalancerRule_internal(t *testing.T) {
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testAccPreCheck(t) },
+ Providers: testAccProviders,
+ CheckDestroy: testAccCheckCloudStackLoadBalancerRuleDestroy,
+ Steps: []resource.TestStep{
+ {
+ Config:
testAccCloudStackLoadBalancerRule_internal,
+ Check: resource.ComposeTestCheckFunc(
+
testAccCheckCloudStackLoadBalancerRuleExist("cloudstack_loadbalancer_rule.foo",
nil),
+ resource.TestCheckResourceAttr(
+
"cloudstack_loadbalancer_rule.foo", "name", "terraform-ilb"),
+ resource.TestCheckResourceAttr(
+
"cloudstack_loadbalancer_rule.foo", "ip_address_id", ""),
+ resource.TestCheckResourceAttr(
Review Comment:
The new internal-LB acceptance test asserts `ip_address_id == ""`, but when
`ip_address_id` is omitted from config and Read() intentionally avoids setting
it, Terraform state may not contain the attribute at all. That makes
`TestCheckResourceAttr(..., "ip_address_id", "")` brittle and it can fail even
when behavior is correct. Prefer asserting the attribute is absent.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]