Updating some logic and tests
These fixes are needed to make the provider work with master again. These are still some issues, but they seem not to be related to the provider, but the changes in `helper/schema`.
This commit is contained in:
parent
3898098c78
commit
19776ba402
|
@ -397,6 +397,11 @@ func resourceCloudStackEgressFirewallDeleteRule(
|
||||||
uuids := rule["uuids"].(map[string]interface{})
|
uuids := rule["uuids"].(map[string]interface{})
|
||||||
|
|
||||||
for k, id := range uuids {
|
for k, id := range uuids {
|
||||||
|
// We don't care about the count here, so just continue
|
||||||
|
if k == "#" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Create the parameter struct
|
// Create the parameter struct
|
||||||
p := cs.Firewall.NewDeleteEgressFirewallRuleParams(id.(string))
|
p := cs.Firewall.NewDeleteEgressFirewallRuleParams(id.(string))
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ func testAccCheckCloudStackEgressFirewallRulesExist(n string) resource.TestCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, uuid := range rs.Primary.Attributes {
|
for k, uuid := range rs.Primary.Attributes {
|
||||||
if !strings.Contains(k, "uuids") {
|
if !strings.Contains(k, ".uuids.") || strings.HasSuffix(k, ".uuids.#") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ func testAccCheckCloudStackEgressFirewallDestroy(s *terraform.State) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, uuid := range rs.Primary.Attributes {
|
for k, uuid := range rs.Primary.Attributes {
|
||||||
if !strings.Contains(k, "uuids") {
|
if !strings.Contains(k, ".uuids.") || strings.HasSuffix(k, ".uuids.#") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,25 +165,23 @@ resource "cloudstack_egress_firewall" "foo" {
|
||||||
ipaddress = "%s"
|
ipaddress = "%s"
|
||||||
|
|
||||||
rule {
|
rule {
|
||||||
source_cidr = "10.0.0.0/24"
|
source_cidr = "%s/32"
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
ports = ["80", "1000-2000"]
|
ports = ["80", "1000-2000"]
|
||||||
}
|
}
|
||||||
}`, CLOUDSTACK_NETWORK_1)
|
}`,
|
||||||
|
CLOUDSTACK_NETWORK_1,
|
||||||
|
CLOUDSTACK_NETWORK_1_IPADDRESS)
|
||||||
|
|
||||||
var testAccCloudStackEgressFirewall_update = fmt.Sprintf(`
|
var testAccCloudStackEgressFirewall_update = fmt.Sprintf(`
|
||||||
resource "cloudstack_egress_firewall" "foo" {
|
resource "cloudstack_egress_firewall" "foo" {
|
||||||
ipaddress = "%s"
|
ipaddress = "%s"
|
||||||
|
|
||||||
rule {
|
rule {
|
||||||
source_cidr = "10.0.0.0/24"
|
source_cidr = "%s/32"
|
||||||
protocol = "tcp"
|
protocol = "tcp"
|
||||||
ports = ["80", "1000-2000"]
|
ports = ["80", "443", 1000-2000"]
|
||||||
}
|
}
|
||||||
|
}`,
|
||||||
rule {
|
CLOUDSTACK_NETWORK_1,
|
||||||
source_cidr = "172.16.100.0/24"
|
CLOUDSTACK_NETWORK_1_IPADDRESS)
|
||||||
protocol = "tcp"
|
|
||||||
ports = ["80", "443"]
|
|
||||||
}
|
|
||||||
}`, CLOUDSTACK_NETWORK_1)
|
|
||||||
|
|
|
@ -393,6 +393,11 @@ func resourceCloudStackFirewallDeleteRule(
|
||||||
uuids := rule["uuids"].(map[string]interface{})
|
uuids := rule["uuids"].(map[string]interface{})
|
||||||
|
|
||||||
for k, id := range uuids {
|
for k, id := range uuids {
|
||||||
|
// We don't care about the count here, so just continue
|
||||||
|
if k == "#" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Create the parameter struct
|
// Create the parameter struct
|
||||||
p := cs.Firewall.NewDeleteFirewallRuleParams(id.(string))
|
p := cs.Firewall.NewDeleteFirewallRuleParams(id.(string))
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ func testAccCheckCloudStackFirewallRulesExist(n string) resource.TestCheckFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, uuid := range rs.Primary.Attributes {
|
for k, uuid := range rs.Primary.Attributes {
|
||||||
if !strings.Contains(k, "uuids") {
|
if !strings.Contains(k, ".uuids.") || strings.HasSuffix(k, ".uuids.#") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ func testAccCheckCloudStackFirewallDestroy(s *terraform.State) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, uuid := range rs.Primary.Attributes {
|
for k, uuid := range rs.Primary.Attributes {
|
||||||
if !strings.Contains(k, "uuids") {
|
if !strings.Contains(k, ".uuids.") || strings.HasSuffix(k, ".uuids.#") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -417,6 +417,11 @@ func resourceCloudStackNetworkACLRuleDeleteRule(
|
||||||
uuids := rule["uuids"].(map[string]interface{})
|
uuids := rule["uuids"].(map[string]interface{})
|
||||||
|
|
||||||
for k, id := range uuids {
|
for k, id := range uuids {
|
||||||
|
// We don't care about the count here, so just continue
|
||||||
|
if k == "#" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Create the parameter struct
|
// Create the parameter struct
|
||||||
p := cs.NetworkACL.NewDeleteNetworkACLParams(id.(string))
|
p := cs.NetworkACL.NewDeleteNetworkACLParams(id.(string))
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,7 @@ func testAccCheckCloudStackNetworkACLRulesExist(n string) resource.TestCheckFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, uuid := range rs.Primary.Attributes {
|
for k, uuid := range rs.Primary.Attributes {
|
||||||
if !strings.Contains(k, "uuids") {
|
if !strings.Contains(k, ".uuids.") || strings.HasSuffix(k, ".uuids.#") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ func testAccCheckCloudStackNetworkACLRuleDestroy(s *terraform.State) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, uuid := range rs.Primary.Attributes {
|
for k, uuid := range rs.Primary.Attributes {
|
||||||
if !strings.Contains(k, "uuids") {
|
if !strings.Contains(k, ".uuids.") || strings.HasSuffix(k, ".uuids.#") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue