From 1d02ed51c17b503ed15ceb823f0142224221499c Mon Sep 17 00:00:00 2001 From: = Date: Thu, 6 Apr 2017 16:27:22 -0600 Subject: [PATCH] fixed nits --- .../providers/opc/import_ip_address_association_test.go | 8 ++------ builtin/providers/opc/provider.go | 2 +- builtin/providers/opc/resource_ip_address_association.go | 6 +++++- .../providers/opc/resource_ip_address_association_test.go | 5 +---- .../r/opc_compute_ip_address_association.html.markdown | 4 ++-- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/builtin/providers/opc/import_ip_address_association_test.go b/builtin/providers/opc/import_ip_address_association_test.go index 7730e6cdd..a68f6daf8 100644 --- a/builtin/providers/opc/import_ip_address_association_test.go +++ b/builtin/providers/opc/import_ip_address_association_test.go @@ -11,17 +11,13 @@ func TestAccOPCIPAddressAssociation_importBasic(t *testing.T) { resourceName := "opc_compute_ip_address_association.test" ri := acctest.RandInt() - config := testAccIPAddressAssociationBasic(ri) - resource.Test(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, Providers: testAccProviders, CheckDestroy: testAccCheckIPAddressAssociationDestroy, Steps: []resource.TestStep{ { - Config: config, + Config: testAccIPAddressAssociationBasic(ri), }, { ResourceName: resourceName, diff --git a/builtin/providers/opc/provider.go b/builtin/providers/opc/provider.go index b03f68f58..354439340 100644 --- a/builtin/providers/opc/provider.go +++ b/builtin/providers/opc/provider.go @@ -72,7 +72,7 @@ func Provider() terraform.ResourceProvider { "opc_compute_vnic_set": resourceOPCVNICSet(), "opc_compute_security_protocol": resourceOPCSecurityProtocol(), "opc_compute_ip_address_prefix_set": resourceOPCIPAddressPrefixSet(), - "opc_compute_ip_address_association": resourceOPCIPAddressAssociation(), + "opc_compute_ip_address_association": resourceOPCIPAddressAssociation(), }, ConfigureFunc: providerConfigure, diff --git a/builtin/providers/opc/resource_ip_address_association.go b/builtin/providers/opc/resource_ip_address_association.go index 7659fbf34..32ebf43d9 100644 --- a/builtin/providers/opc/resource_ip_address_association.go +++ b/builtin/providers/opc/resource_ip_address_association.go @@ -90,7 +90,11 @@ func resourceOPCIPAddressAssociationRead(d *schema.ResourceData, meta interface{ d.SetId("") return nil } - return fmt.Errorf("Error reading IP Address Association %s: %s", d.Id(), err) + return fmt.Errorf("Error reading IP Address Association %s: %s", getInput.Name, err) + } + if result == nil { + d.SetId("") + return fmt.Errorf("Error reading IP Address Association %s: %s", getInput.Name, err) } d.Set("name", result.Name) diff --git a/builtin/providers/opc/resource_ip_address_association_test.go b/builtin/providers/opc/resource_ip_address_association_test.go index 9c3804d1e..a08abfbc1 100644 --- a/builtin/providers/opc/resource_ip_address_association_test.go +++ b/builtin/providers/opc/resource_ip_address_association_test.go @@ -140,9 +140,6 @@ data "opc_compute_network_interface" "eth0" { instance_id = "${opc_compute_instance.test.id}" interface = "eth0" } -data "opc_compute_vnic" "foo" { - name = "${data.opc_compute_network_interface.eth0.vnic}" -} resource "opc_compute_ip_address_reservation" "test" { name = "testing-ip-address-association-%d" description = "testing-desc-%d" @@ -151,7 +148,7 @@ resource "opc_compute_ip_address_reservation" "test" { resource "opc_compute_ip_address_association" "test" { name = "testing-acc-%d" ip_address_reservation = "${opc_compute_ip_address_reservation.test.name}" - vnic = "${data.opc_compute_vnic.foo.name}" + vnic = "${data.opc_compute_network_interface.eth0.vnic}" description = "acctesting ip address association test %d" tags = ["tag1", "tag2"] }`, rInt, rInt, rInt, rInt, rInt, rInt, rInt) diff --git a/website/source/docs/providers/opc/r/opc_compute_ip_address_association.html.markdown b/website/source/docs/providers/opc/r/opc_compute_ip_address_association.html.markdown index 44429a030..b531cf559 100644 --- a/website/source/docs/providers/opc/r/opc_compute_ip_address_association.html.markdown +++ b/website/source/docs/providers/opc/r/opc_compute_ip_address_association.html.markdown @@ -8,7 +8,7 @@ description: |- # opc\_compute\_ip\_address\_association -The ``opc_compute_ip_address_association`` resource creates and manages an IP address association in an OPC identity domain. +The ``opc_compute_ip_address_association`` resource creates and manages an IP address association between an IP address reservation and a virtual NIC in an OPC identity domain. ## Example Usage @@ -41,7 +41,7 @@ In addition to the above, the following variables are exported: ## Import -IP Address Prefix Set can be imported using the `resource name`, e.g. +IP Address Associations can be imported using the `resource name`, e.g. ``` terraform import opc_compute_ip_address_association.default example