From 16a963313fe21196660ab83f2f061799668fe66a Mon Sep 17 00:00:00 2001 From: Guillaume Giamarchi Date: Thu, 19 Feb 2015 22:55:54 +0100 Subject: [PATCH] FWaaS version is actually v1 not v2 Rename files and methods. Confusion have been made between neutron version and FWaaS extension version. --- builtin/providers/openstack/provider.go | 6 +-- ...o => resource_openstack_fw_firewall_v1.go} | 30 +++++++------- ...resource_openstack_fw_firewall_v1_test.go} | 24 +++++------ ....go => resource_openstack_fw_policy_v1.go} | 18 ++++----- ...> resource_openstack_fw_policy_v1_test.go} | 40 +++++++++---------- ...v2.go => resource_openstack_fw_rule_v1.go} | 18 ++++----- ... => resource_openstack_fw_rule_v1_test.go} | 26 ++++++------ 7 files changed, 81 insertions(+), 81 deletions(-) rename builtin/providers/openstack/{resource_openstack_fw_firewall_v2.go => resource_openstack_fw_firewall_v1.go} (87%) rename builtin/providers/openstack/{resource_openstack_fw_firewall_v2_test.go => resource_openstack_fw_firewall_v1_test.go} (78%) rename builtin/providers/openstack/{resource_openstack_fw_policy_v2.go => resource_openstack_fw_policy_v1.go} (90%) rename builtin/providers/openstack/{resource_openstack_fw_policy_v2_test.go => resource_openstack_fw_policy_v1_test.go} (75%) rename builtin/providers/openstack/{resource_openstack_fw_rule_v2.go => resource_openstack_fw_rule_v1.go} (92%) rename builtin/providers/openstack/{resource_openstack_fw_rule_v2_test.go => resource_openstack_fw_rule_v1_test.go} (86%) diff --git a/builtin/providers/openstack/provider.go b/builtin/providers/openstack/provider.go index 7e0880007..a43242333 100644 --- a/builtin/providers/openstack/provider.go +++ b/builtin/providers/openstack/provider.go @@ -64,9 +64,9 @@ func Provider() terraform.ResourceProvider { "openstack_compute_keypair_v2": resourceComputeKeypairV2(), "openstack_compute_secgroup_v2": resourceComputeSecGroupV2(), "openstack_compute_floatingip_v2": resourceComputeFloatingIPV2(), - "openstack_fw_firewall_v2": resourceFWFirewallV2(), - "openstack_fw_policy_v2": resourceFWPolicyV2(), - "openstack_fw_rule_v2": resourceFWRuleV2(), + "openstack_fw_firewall_v1": resourceFWFirewallV1(), + "openstack_fw_policy_v1": resourceFWPolicyV1(), + "openstack_fw_rule_v1": resourceFWRuleV1(), "openstack_lb_monitor_v1": resourceLBMonitorV1(), "openstack_lb_pool_v1": resourceLBPoolV1(), "openstack_lb_vip_v1": resourceLBVipV1(), diff --git a/builtin/providers/openstack/resource_openstack_fw_firewall_v2.go b/builtin/providers/openstack/resource_openstack_fw_firewall_v1.go similarity index 87% rename from builtin/providers/openstack/resource_openstack_fw_firewall_v2.go rename to builtin/providers/openstack/resource_openstack_fw_firewall_v1.go index 2d10fdc3c..21c93d33d 100644 --- a/builtin/providers/openstack/resource_openstack_fw_firewall_v2.go +++ b/builtin/providers/openstack/resource_openstack_fw_firewall_v1.go @@ -12,12 +12,12 @@ import ( "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/firewalls" ) -func resourceFWFirewallV2() *schema.Resource { +func resourceFWFirewallV1() *schema.Resource { return &schema.Resource{ - Create: resourceFirewallCreate, - Read: resourceFirewallRead, - Update: resourceFirewallUpdate, - Delete: resourceFirewallDelete, + Create: resourceFWFirewallV1Create, + Read: resourceFWFirewallV1Read, + Update: resourceFWFirewallV1Update, + Delete: resourceFWFirewallV1Delete, Schema: map[string]*schema.Schema{ "region": &schema.Schema{ @@ -52,7 +52,7 @@ func resourceFWFirewallV2() *schema.Resource { } } -func resourceFirewallCreate(d *schema.ResourceData, meta interface{}) error { +func resourceFWFirewallV1Create(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) networkingClient, err := config.networkingV2Client(d.Get("region").(string)) @@ -82,7 +82,7 @@ func resourceFirewallCreate(d *schema.ResourceData, meta interface{}) error { stateConf := &resource.StateChangeConf{ Pending: []string{"PENDING_CREATE"}, Target: "ACTIVE", - Refresh: WaitForFirewallActive(networkingClient, firewall.ID), + Refresh: waitForFirewallActive(networkingClient, firewall.ID), Timeout: 30 * time.Second, Delay: 0, MinTimeout: 2 * time.Second, @@ -95,7 +95,7 @@ func resourceFirewallCreate(d *schema.ResourceData, meta interface{}) error { return nil } -func resourceFirewallRead(d *schema.ResourceData, meta interface{}) error { +func resourceFWFirewallV1Read(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] Retrieve information about firewall: %s", d.Id()) config := meta.(*Config) @@ -151,7 +151,7 @@ func resourceFirewallRead(d *schema.ResourceData, meta interface{}) error { return nil } -func resourceFirewallUpdate(d *schema.ResourceData, meta interface{}) error { +func resourceFWFirewallV1Update(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) networkingClient, err := config.networkingV2Client(d.Get("region").(string)) @@ -183,7 +183,7 @@ func resourceFirewallUpdate(d *schema.ResourceData, meta interface{}) error { stateConf := &resource.StateChangeConf{ Pending: []string{"PENDING_CREATE", "PENDING_UPDATE"}, Target: "ACTIVE", - Refresh: WaitForFirewallActive(networkingClient, d.Id()), + Refresh: waitForFirewallActive(networkingClient, d.Id()), Timeout: 30 * time.Second, Delay: 0, MinTimeout: 2 * time.Second, @@ -194,7 +194,7 @@ func resourceFirewallUpdate(d *schema.ResourceData, meta interface{}) error { return firewalls.Update(networkingClient, d.Id(), opts).Err } -func resourceFirewallDelete(d *schema.ResourceData, meta interface{}) error { +func resourceFWFirewallV1Delete(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] Destroy firewall: %s", d.Id()) config := meta.(*Config) @@ -206,7 +206,7 @@ func resourceFirewallDelete(d *schema.ResourceData, meta interface{}) error { stateConf := &resource.StateChangeConf{ Pending: []string{"PENDING_CREATE", "PENDING_UPDATE"}, Target: "ACTIVE", - Refresh: WaitForFirewallActive(networkingClient, d.Id()), + Refresh: waitForFirewallActive(networkingClient, d.Id()), Timeout: 30 * time.Second, Delay: 0, MinTimeout: 2 * time.Second, @@ -223,7 +223,7 @@ func resourceFirewallDelete(d *schema.ResourceData, meta interface{}) error { stateConf = &resource.StateChangeConf{ Pending: []string{"DELETING"}, Target: "DELETED", - Refresh: WaitForFirewallDeletion(networkingClient, d.Id()), + Refresh: waitForFirewallDeletion(networkingClient, d.Id()), Timeout: 2 * time.Minute, Delay: 0, MinTimeout: 2 * time.Second, @@ -234,7 +234,7 @@ func resourceFirewallDelete(d *schema.ResourceData, meta interface{}) error { return err } -func WaitForFirewallActive(networkingClient *gophercloud.ServiceClient, id string) resource.StateRefreshFunc { +func waitForFirewallActive(networkingClient *gophercloud.ServiceClient, id string) resource.StateRefreshFunc { return func() (interface{}, string, error) { fw, err := firewalls.Get(networkingClient, id).Extract() @@ -247,7 +247,7 @@ func WaitForFirewallActive(networkingClient *gophercloud.ServiceClient, id strin } } -func WaitForFirewallDeletion(networkingClient *gophercloud.ServiceClient, id string) resource.StateRefreshFunc { +func waitForFirewallDeletion(networkingClient *gophercloud.ServiceClient, id string) resource.StateRefreshFunc { return func() (interface{}, string, error) { fw, err := firewalls.Get(networkingClient, id).Extract() diff --git a/builtin/providers/openstack/resource_openstack_fw_firewall_v2_test.go b/builtin/providers/openstack/resource_openstack_fw_firewall_v1_test.go similarity index 78% rename from builtin/providers/openstack/resource_openstack_fw_firewall_v2_test.go rename to builtin/providers/openstack/resource_openstack_fw_firewall_v1_test.go index cc5343660..34112f778 100644 --- a/builtin/providers/openstack/resource_openstack_fw_firewall_v2_test.go +++ b/builtin/providers/openstack/resource_openstack_fw_firewall_v1_test.go @@ -11,32 +11,32 @@ import ( "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/firewalls" ) -func TestAccOpenstackFirewall(t *testing.T) { +func TestAccFWFirewallV1(t *testing.T) { var policyID *string resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOpenstackFirewallDestroy, + CheckDestroy: testAccCheckFWFirewallV1Destroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testFirewallConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckFirewallExists("openstack_fw_firewall_v2.accept_test", "", "", policyID), + testAccCheckFWFirewallV1Exists("openstack_fw_firewall_v1.accept_test", "", "", policyID), ), }, resource.TestStep{ Config: testFirewallConfigUpdated, Check: resource.ComposeTestCheckFunc( - testAccCheckFirewallExists("openstack_fw_firewall_v2.accept_test", "accept_test", "terraform acceptance test", policyID), + testAccCheckFWFirewallV1Exists("openstack_fw_firewall_v1.accept_test", "accept_test", "terraform acceptance test", policyID), ), }, }, }) } -func testAccCheckOpenstackFirewallDestroy(s *terraform.State) error { +func testAccCheckFWFirewallV1Destroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) networkingClient, err := config.networkingV2Client(OS_REGION_NAME) @@ -59,7 +59,7 @@ func testAccCheckOpenstackFirewallDestroy(s *terraform.State) error { return nil } -func testAccCheckFirewallExists(n, expectedName, expectedDescription string, policyID *string) resource.TestCheckFunc { +func testAccCheckFWFirewallV1Exists(n, expectedName, expectedDescription string, policyID *string) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -117,23 +117,23 @@ func testAccCheckFirewallExists(n, expectedName, expectedDescription string, pol } const testFirewallConfig = ` -resource "openstack_fw_firewall_v2" "accept_test" { - policy_id = "${openstack_fw_policy_v2.accept_test_policy_1.id}" +resource "openstack_fw_firewall_v1" "accept_test" { + policy_id = "${openstack_fw_policy_v1.accept_test_policy_1.id}" } -resource "openstack_fw_policy_v2" "accept_test_policy_1" { +resource "openstack_fw_policy_v1" "accept_test_policy_1" { name = "policy-1" } ` const testFirewallConfigUpdated = ` -resource "openstack_fw_firewall_v2" "accept_test" { +resource "openstack_fw_firewall_v1" "accept_test" { name = "accept_test" description = "terraform acceptance test" - policy_id = "${openstack_fw_policy_v2.accept_test_policy_2.id}" + policy_id = "${openstack_fw_policy_v1.accept_test_policy_2.id}" } -resource "openstack_fw_policy_v2" "accept_test_policy_2" { +resource "openstack_fw_policy_v1" "accept_test_policy_2" { name = "policy-2" } ` diff --git a/builtin/providers/openstack/resource_openstack_fw_policy_v2.go b/builtin/providers/openstack/resource_openstack_fw_policy_v1.go similarity index 90% rename from builtin/providers/openstack/resource_openstack_fw_policy_v2.go rename to builtin/providers/openstack/resource_openstack_fw_policy_v1.go index ad096397b..e9fc1645b 100644 --- a/builtin/providers/openstack/resource_openstack_fw_policy_v2.go +++ b/builtin/providers/openstack/resource_openstack_fw_policy_v1.go @@ -11,12 +11,12 @@ import ( "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/policies" ) -func resourceFWPolicyV2() *schema.Resource { +func resourceFWPolicyV1() *schema.Resource { return &schema.Resource{ - Create: resourceFirewallPolicyCreate, - Read: resourceFirewallPolicyRead, - Update: resourceFirewallPolicyUpdate, - Delete: resourceFirewallPolicyDelete, + Create: resourceFWPolicyV1Create, + Read: resourceFWPolicyV1Read, + Update: resourceFWPolicyV1Update, + Delete: resourceFWPolicyV1Delete, Schema: map[string]*schema.Schema{ "region": &schema.Schema{ @@ -60,7 +60,7 @@ func resourceFWPolicyV2() *schema.Resource { } } -func resourceFirewallPolicyCreate(d *schema.ResourceData, meta interface{}) error { +func resourceFWPolicyV1Create(d *schema.ResourceData, meta interface{}) error { // TODO To remove time.Sleep(time.Second * 5) @@ -107,7 +107,7 @@ func resourceFirewallPolicyCreate(d *schema.ResourceData, meta interface{}) erro return nil } -func resourceFirewallPolicyRead(d *schema.ResourceData, meta interface{}) error { +func resourceFWPolicyV1Read(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] Retrieve information about firewall policy: %s", d.Id()) config := meta.(*Config) @@ -163,7 +163,7 @@ func resourceFirewallPolicyRead(d *schema.ResourceData, meta interface{}) error return nil } -func resourceFirewallPolicyUpdate(d *schema.ResourceData, meta interface{}) error { +func resourceFWPolicyV1Update(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) networkingClient, err := config.networkingV2Client(d.Get("region").(string)) @@ -199,7 +199,7 @@ func resourceFirewallPolicyUpdate(d *schema.ResourceData, meta interface{}) erro return policies.Update(networkingClient, d.Id(), opts).Err } -func resourceFirewallPolicyDelete(d *schema.ResourceData, meta interface{}) error { +func resourceFWPolicyV1Delete(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] Destroy firewall policy: %s", d.Id()) config := meta.(*Config) diff --git a/builtin/providers/openstack/resource_openstack_fw_policy_v2_test.go b/builtin/providers/openstack/resource_openstack_fw_policy_v1_test.go similarity index 75% rename from builtin/providers/openstack/resource_openstack_fw_policy_v2_test.go rename to builtin/providers/openstack/resource_openstack_fw_policy_v1_test.go index ed268b7c3..1a37a383f 100644 --- a/builtin/providers/openstack/resource_openstack_fw_policy_v2_test.go +++ b/builtin/providers/openstack/resource_openstack_fw_policy_v1_test.go @@ -11,33 +11,33 @@ import ( "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/policies" ) -func TestAccOpenstackFirewallPolicy(t *testing.T) { +func TestAccFWPolicyV1(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOpenstackFirewallPolicyDestroy, + CheckDestroy: testAccCheckFWPolicyV1Destroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testFirewallPolicyConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckFirewallPolicyExists( - "openstack_fw_policy_v2.accept_test", + testAccCheckFWPolicyV1Exists( + "openstack_fw_policy_v1.accept_test", "", "", 0), ), }, resource.TestStep{ Config: testFirewallPolicyConfigAddRules, Check: resource.ComposeTestCheckFunc( - testAccCheckFirewallPolicyExists( - "openstack_fw_policy_v2.accept_test", + testAccCheckFWPolicyV1Exists( + "openstack_fw_policy_v1.accept_test", "accept_test", "terraform acceptance test", 2), ), }, resource.TestStep{ Config: testFirewallPolicyUpdateDeleteRule, Check: resource.ComposeTestCheckFunc( - testAccCheckFirewallPolicyExists( - "openstack_fw_policy_v2.accept_test", + testAccCheckFWPolicyV1Exists( + "openstack_fw_policy_v1.accept_test", "accept_test", "terraform acceptance test", 1), ), }, @@ -45,7 +45,7 @@ func TestAccOpenstackFirewallPolicy(t *testing.T) { }) } -func testAccCheckOpenstackFirewallPolicyDestroy(s *terraform.State) error { +func testAccCheckFWPolicyV1Destroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) networkingClient, err := config.networkingV2Client(OS_REGION_NAME) @@ -53,7 +53,7 @@ func testAccCheckOpenstackFirewallPolicyDestroy(s *terraform.State) error { return fmt.Errorf("(testAccCheckOpenstackFirewallPolicyDestroy) Error creating OpenStack networking client: %s", err) } for _, rs := range s.RootModule().Resources { - if rs.Type != "openstack_fw_policy_v2" { + if rs.Type != "openstack_fw_policy_v1" { continue } _, err = policies.Get(networkingClient, rs.Primary.ID).Extract() @@ -68,7 +68,7 @@ func testAccCheckOpenstackFirewallPolicyDestroy(s *terraform.State) error { return nil } -func testAccCheckFirewallPolicyExists(n, name, description string, ruleCount int) resource.TestCheckFunc { +func testAccCheckFWPolicyV1Exists(n, name, description string, ruleCount int) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -123,42 +123,42 @@ func testAccCheckFirewallPolicyExists(n, name, description string, ruleCount int } const testFirewallPolicyConfig = ` -resource "openstack_fw_policy_v2" "accept_test" { +resource "openstack_fw_policy_v1" "accept_test" { } ` const testFirewallPolicyConfigAddRules = ` -resource "openstack_fw_policy_v2" "accept_test" { +resource "openstack_fw_policy_v1" "accept_test" { name = "accept_test" description = "terraform acceptance test" rules = [ - "${openstack_fw_rule_v2.accept_test_udp_deny.id}", - "${openstack_fw_rule_v2.accept_test_tcp_allow.id}" + "${openstack_fw_rule_v1.accept_test_udp_deny.id}", + "${openstack_fw_rule_v1.accept_test_tcp_allow.id}" ] } -resource "openstack_fw_rule_v2" "accept_test_tcp_allow" { +resource "openstack_fw_rule_v1" "accept_test_tcp_allow" { protocol = "tcp" action = "allow" } -resource "openstack_fw_rule_v2" "accept_test_udp_deny" { +resource "openstack_fw_rule_v1" "accept_test_udp_deny" { protocol = "udp" action = "deny" } ` const testFirewallPolicyUpdateDeleteRule = ` -resource "openstack_fw_policy_v2" "accept_test" { +resource "openstack_fw_policy_v1" "accept_test" { name = "accept_test" description = "terraform acceptance test" rules = [ - "${openstack_fw_rule_v2.accept_test_udp_deny.id}" + "${openstack_fw_rule_v1.accept_test_udp_deny.id}" ] } -resource "openstack_fw_rule_v2" "accept_test_udp_deny" { +resource "openstack_fw_rule_v1" "accept_test_udp_deny" { protocol = "udp" action = "deny" } diff --git a/builtin/providers/openstack/resource_openstack_fw_rule_v2.go b/builtin/providers/openstack/resource_openstack_fw_rule_v1.go similarity index 92% rename from builtin/providers/openstack/resource_openstack_fw_rule_v2.go rename to builtin/providers/openstack/resource_openstack_fw_rule_v1.go index 9aa110757..bd418e9b8 100644 --- a/builtin/providers/openstack/resource_openstack_fw_rule_v2.go +++ b/builtin/providers/openstack/resource_openstack_fw_rule_v1.go @@ -10,12 +10,12 @@ import ( "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/rules" ) -func resourceFWRuleV2() *schema.Resource { +func resourceFWRuleV1() *schema.Resource { return &schema.Resource{ - Create: resourceFirewallRuleCreate, - Read: resourceFirewallRuleRead, - Update: resourceFirewallRuleUpdate, - Delete: resourceFirewallRuleDelete, + Create: resourceFWRuleV1Create, + Read: resourceFWRuleV1Read, + Update: resourceFWRuleV1Update, + Delete: resourceFWRuleV1Delete, Schema: map[string]*schema.Schema{ "region": &schema.Schema{ @@ -75,7 +75,7 @@ func resourceFWRuleV2() *schema.Resource { } } -func resourceFirewallRuleCreate(d *schema.ResourceData, meta interface{}) error { +func resourceFWRuleV1Create(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) networkingClient, err := config.networkingV2Client(d.Get("region").(string)) @@ -114,7 +114,7 @@ func resourceFirewallRuleCreate(d *schema.ResourceData, meta interface{}) error return nil } -func resourceFirewallRuleRead(d *schema.ResourceData, meta interface{}) error { +func resourceFWRuleV1Read(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] Retrieve information about firewall rule: %s", d.Id()) config := meta.(*Config) @@ -191,7 +191,7 @@ func resourceFirewallRuleRead(d *schema.ResourceData, meta interface{}) error { return nil } -func resourceFirewallRuleUpdate(d *schema.ResourceData, meta interface{}) error { +func resourceFWRuleV1Update(d *schema.ResourceData, meta interface{}) error { config := meta.(*Config) networkingClient, err := config.networkingV2Client(d.Get("region").(string)) if err != nil { @@ -241,7 +241,7 @@ func resourceFirewallRuleUpdate(d *schema.ResourceData, meta interface{}) error return rules.Update(networkingClient, d.Id(), opts).Err } -func resourceFirewallRuleDelete(d *schema.ResourceData, meta interface{}) error { +func resourceFWRuleV1Delete(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] Destroy firewall rule: %s", d.Id()) config := meta.(*Config) diff --git a/builtin/providers/openstack/resource_openstack_fw_rule_v2_test.go b/builtin/providers/openstack/resource_openstack_fw_rule_v1_test.go similarity index 86% rename from builtin/providers/openstack/resource_openstack_fw_rule_v2_test.go rename to builtin/providers/openstack/resource_openstack_fw_rule_v1_test.go index 748177375..ba96bb8b1 100644 --- a/builtin/providers/openstack/resource_openstack_fw_rule_v2_test.go +++ b/builtin/providers/openstack/resource_openstack_fw_rule_v1_test.go @@ -12,17 +12,17 @@ import ( "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/rules" ) -func TestAccOpenstackFirewallRule(t *testing.T) { +func TestAccFWRuleV1(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, - CheckDestroy: testAccCheckOpenstackFirewallRuleDestroy, + CheckDestroy: testAccCheckFWRuleV1Destroy, Steps: []resource.TestStep{ resource.TestStep{ Config: testFirewallRuleMinimalConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckFirewallRuleExists( - "openstack_fw_rule_v2.accept_test_minimal", + testAccCheckFWRuleV1Exists( + "openstack_fw_rule_v1.accept_test_minimal", &rules.Rule{ Protocol: "udp", Action: "deny", @@ -34,8 +34,8 @@ func TestAccOpenstackFirewallRule(t *testing.T) { resource.TestStep{ Config: testFirewallRuleConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckFirewallRuleExists( - "openstack_fw_rule_v2.accept_test", + testAccCheckFWRuleV1Exists( + "openstack_fw_rule_v1.accept_test", &rules.Rule{ Name: "accept_test", Protocol: "udp", @@ -53,8 +53,8 @@ func TestAccOpenstackFirewallRule(t *testing.T) { resource.TestStep{ Config: testFirewallRuleUpdateAllFieldsConfig, Check: resource.ComposeTestCheckFunc( - testAccCheckFirewallRuleExists( - "openstack_fw_rule_v2.accept_test", + testAccCheckFWRuleV1Exists( + "openstack_fw_rule_v1.accept_test", &rules.Rule{ Name: "accept_test_updated_2", Protocol: "tcp", @@ -73,7 +73,7 @@ func TestAccOpenstackFirewallRule(t *testing.T) { }) } -func testAccCheckOpenstackFirewallRuleDestroy(s *terraform.State) error { +func testAccCheckFWRuleV1Destroy(s *terraform.State) error { config := testAccProvider.Meta().(*Config) networkingClient, err := config.networkingV2Client(OS_REGION_NAME) @@ -96,7 +96,7 @@ func testAccCheckOpenstackFirewallRuleDestroy(s *terraform.State) error { return nil } -func testAccCheckFirewallRuleExists(n string, expected *rules.Rule) resource.TestCheckFunc { +func testAccCheckFWRuleV1Exists(n string, expected *rules.Rule) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -148,14 +148,14 @@ func testAccCheckFirewallRuleExists(n string, expected *rules.Rule) resource.Tes } const testFirewallRuleMinimalConfig = ` -resource "openstack_fw_rule_v2" "accept_test_minimal" { +resource "openstack_fw_rule_v1" "accept_test_minimal" { protocol = "udp" action = "deny" } ` const testFirewallRuleConfig = ` -resource "openstack_fw_rule_v2" "accept_test" { +resource "openstack_fw_rule_v1" "accept_test" { name = "accept_test" description = "Terraform accept test" protocol = "udp" @@ -170,7 +170,7 @@ resource "openstack_fw_rule_v2" "accept_test" { ` const testFirewallRuleUpdateAllFieldsConfig = ` -resource "openstack_fw_rule_v2" "accept_test" { +resource "openstack_fw_rule_v1" "accept_test" { name = "accept_test_updated_2" description = "Terraform accept test updated" protocol = "tcp"