core/provider-split: Split out the Oracle OPC provider to new structure (#14362)
* core/providersplit: Split OPC Provider to separate repo As we march towards Terraform 0.10.0, we are going to start building the terraform providers as separate binaries - this will allow us to continually release them. Before we go to 0.10.0, we need to be able to continue building providers in the same manner, therefore, we have hardcoded the path of the provider in the generate-plugins.go file The interim solution will require us to vendor the opc provider and any child dependencies, but when we get to 0.10.0, we will no longer have to do this - the core will auto download the plugin binary. The plugin package will have it's own dependencies vendored as well. * core/providersplit: Removing the builtin version of OPC provider * core/providersplit: Vendoring the OPC plugin * core/providersplit: update internal plugin list * core/providersplit: remove unused govendor item
This commit is contained in:
parent
73dbded87e
commit
055c18e302
|
@ -1,12 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/hashicorp/terraform/builtin/providers/opc"
|
||||
"github.com/hashicorp/terraform/plugin"
|
||||
)
|
||||
|
||||
func main() {
|
||||
plugin.Serve(&plugin.ServeOpts{
|
||||
ProviderFunc: opc.Provider,
|
||||
})
|
||||
}
|
|
@ -1,101 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCDataSourceNetworkInterface_basic(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resName := "data.opc_compute_network_interface.test"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccDataSourceNetworkInterfaceBasic(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(resName, "ip_network", fmt.Sprintf("testing-ip-network-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "vnic", fmt.Sprintf("ip-network-test-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "shared_network", "false"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCDataSourceNetworkInterface_sharedNetwork(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resName := "data.opc_compute_network_interface.test"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccDataSourceNetworkInterfaceShared(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(resName, "nat.#", "1"),
|
||||
resource.TestCheckResourceAttr(resName, "shared_network", "true"),
|
||||
resource.TestCheckResourceAttr(resName, "sec_lists.#", "1"),
|
||||
resource.TestCheckResourceAttr(resName, "name_servers.#", "0"),
|
||||
resource.TestCheckResourceAttr(resName, "vnic_sets.#", "0"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccDataSourceNetworkInterfaceBasic(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_network" "foo" {
|
||||
name = "testing-ip-network-%d"
|
||||
description = "testing-ip-network-instance"
|
||||
ip_address_prefix = "10.1.12.0/24"
|
||||
}
|
||||
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "test-%d"
|
||||
label = "test"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
networking_info {
|
||||
index = 0
|
||||
ip_network = "${opc_compute_ip_network.foo.id}"
|
||||
vnic = "ip-network-test-%d"
|
||||
shared_network = false
|
||||
}
|
||||
}
|
||||
|
||||
data "opc_compute_network_interface" "test" {
|
||||
instance_name = "${opc_compute_instance.test.name}"
|
||||
instance_id = "${opc_compute_instance.test.id}"
|
||||
interface = "eth0"
|
||||
}`, rInt, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccDataSourceNetworkInterfaceShared(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "test-%d"
|
||||
label = "test"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
tags = ["tag1", "tag2"]
|
||||
networking_info {
|
||||
index = 0
|
||||
nat = ["ippool:/oracle/public/ippool"]
|
||||
shared_network = true
|
||||
}
|
||||
}
|
||||
|
||||
data "opc_compute_network_interface" "test" {
|
||||
instance_name = "${opc_compute_instance.test.name}"
|
||||
instance_id = "${opc_compute_instance.test.id}"
|
||||
interface = "eth0"
|
||||
}`, rInt)
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCVNIC_Basic(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccVnicBasic(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(
|
||||
"data.opc_compute_vnic.foo", "mac_address", "02:5a:cd:ec:2e:4c"),
|
||||
resource.TestCheckResourceAttr(
|
||||
"data.opc_compute_vnic.foo", "transit_flag", "false"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccVnicBasic(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_network" "foo" {
|
||||
name = "testing-vnic-data-%d"
|
||||
description = "testing-vnic-data"
|
||||
ip_address_prefix = "10.1.13.0/24"
|
||||
}
|
||||
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "test-%d"
|
||||
label = "test"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
networking_info {
|
||||
index = 0
|
||||
ip_network = "${opc_compute_ip_network.foo.id}"
|
||||
vnic = "test-vnic-data-%d"
|
||||
shared_network = false
|
||||
mac_address = "02:5a:cd:ec:2e:4c"
|
||||
}
|
||||
}
|
||||
|
||||
data "opc_compute_network_interface" "eth0" {
|
||||
instance_name = "${opc_compute_instance.test.name}"
|
||||
instance_id = "${opc_compute_instance.test.id}"
|
||||
interface = "eth0"
|
||||
}
|
||||
|
||||
data "opc_compute_vnic" "foo" {
|
||||
name = "${data.opc_compute_network_interface.eth0.vnic}"
|
||||
}`, rInt, rInt, rInt)
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCACL_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_acl.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccACLBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckACLDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
func TestAccOPCACL_importDisabled(t *testing.T) {
|
||||
resourceName := "opc_compute_acl.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccACLDisabled, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckACLDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCImageList_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_image_list.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccImageList_basic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckImageListDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCImageList_importComplete(t *testing.T) {
|
||||
resourceName := "opc_compute_image_list.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccImageList_complete, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckImageListDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCInstance_importBasic(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
|
||||
resourceName := "opc_compute_instance.test"
|
||||
instanceName := fmt.Sprintf("acc-test-instance-%d", rInt)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckInstanceDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccInstanceBasic(rInt),
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
ImportStateIdPrefix: instanceName + "/",
|
||||
ImportStateVerifyIgnore: []string{"instance_attributes"},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCIPAddressAssociation_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_ip_address_association.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckIPAddressAssociationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccIPAddressAssociationBasic(ri),
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCIPAddressPrefixSet_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_ip_address_prefix_set.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := testAccIPAddressPrefixSetBasic(ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckIPAddressPrefixSetDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCIPAddressReservation_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_ip_address_reservation.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := testAccOPCIPAddressReservationConfig_Basic(ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckIPAddressReservationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
func TestAccOPCIPAddressReservation_importDisabled(t *testing.T) {
|
||||
resourceName := "opc_compute_ip_address_reservation.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := testAccOPCIPAddressReservationConfig_Basic(ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckIPAddressReservationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCIPAssociation_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_ip_association.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccIPAssociationBasic, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckIPAssociationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCIPNetworkExchange_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_ip_network_exchange.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccIPNetworkExchangeBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckIPNetworkExchangeDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCIPNetwork_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_ip_network.test"
|
||||
|
||||
rInt := acctest.RandInt()
|
||||
config := testAccOPCIPNetworkConfig_Basic(rInt)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(resourceName, testAccOPCCheckIPNetworkDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCIPReservation_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_ip_reservation.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccIPReservationBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckIPReservationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCRoute_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_route.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := testAccOPCRouteConfig_Basic(ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckRouteDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCSecRule_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_sec_rule.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecRuleBasic, ri, ri, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecRuleDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecRule_importComplete(t *testing.T) {
|
||||
resourceName := "opc_compute_sec_rule.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecRuleComplete, ri, ri, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecRuleDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCSecurityApplication_importICMP(t *testing.T) {
|
||||
resourceName := "opc_compute_security_application.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityApplicationICMP, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSecurityApplicationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecurityApplication_importTCP(t *testing.T) {
|
||||
resourceName := "opc_compute_security_application.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityApplicationTCP, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSecurityApplicationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCSecurityAssociation_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_security_association.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccSecurityAssociationBasic, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSecurityAssociationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecurityAssociation_importComplete(t *testing.T) {
|
||||
resourceName := "opc_compute_security_association.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccSecurityAssociationComplete, ri, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSecurityAssociationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCSecurityIPList_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_security_ip_list.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityIPListBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityIPListDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCSecurityList_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_security_list.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityListBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityListDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecurityList_importComplete(t *testing.T) {
|
||||
resourceName := "opc_compute_security_list.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityListComplete, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityListDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCSecurityProtocol_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_security_protocol.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityProtocolBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityProtocolDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
func TestAccOPCSecurityProtocol_importComplete(t *testing.T) {
|
||||
resourceName := "opc_compute_security_protocol.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityProtocolComplete, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityProtocolDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCSecurityRule_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_security_rule.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := testAccOPCSecurityRuleConfig_Basic(ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityRuleDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecurityRule_importFull(t *testing.T) {
|
||||
resourceName := "opc_compute_security_rule.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := testAccOPCSecurityRuleConfig_Full(ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityRuleDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCSSHKey_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_ssh_key.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSSHKeyBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSSHKeyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSSHKey_importDisabled(t *testing.T) {
|
||||
resourceName := "opc_compute_ssh_key.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSSHKeyDisabled, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSSHKeyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCStorageVolumeSnapshot_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_storage_volume_snapshot.test"
|
||||
rInt := acctest.RandInt()
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeSnapshotDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccStorageVolumeSnapshot_basic(rInt),
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,163 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"fmt"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCStorageVolume_importBasic(t *testing.T) {
|
||||
resourceName := "opc_compute_storage_volume.test"
|
||||
rInt := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccStorageVolumeBasic, rInt)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_importComplete(t *testing.T) {
|
||||
resourceName := "opc_compute_storage_volume.test"
|
||||
rInt := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccStorageVolumeComplete, rInt)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_importMaxSize(t *testing.T) {
|
||||
resourceName := "opc_compute_storage_volume.test"
|
||||
rInt := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccStorageVolumeBasicMaxSize, rInt)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_importBootable(t *testing.T) {
|
||||
resourceName := "opc_compute_storage_volume.test"
|
||||
rInt := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccStorageVolumeBootable, rInt, rInt)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_importImageListEntry(t *testing.T) {
|
||||
resourceName := "opc_compute_storage_volume.test"
|
||||
rInt := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccStorageVolumeImageListEntry, rInt, rInt)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_importLowLatency(t *testing.T) {
|
||||
resourceName := "opc_compute_storage_volume.test"
|
||||
rInt := acctest.RandInt()
|
||||
config := testAccStorageVolumeLowLatency(rInt)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_importFromSnapshot(t *testing.T) {
|
||||
resourceName := "opc_compute_storage_volume.test"
|
||||
rInt := acctest.RandInt()
|
||||
config := testAccStorageVolumeFromSnapshot(rInt)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(resourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
},
|
||||
{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/helper/schema"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
var testAccProviders map[string]terraform.ResourceProvider
|
||||
var testAccProvider *schema.Provider
|
||||
|
||||
func init() {
|
||||
testAccProvider = Provider().(*schema.Provider)
|
||||
testAccProviders = map[string]terraform.ResourceProvider{
|
||||
"opc": testAccProvider,
|
||||
}
|
||||
}
|
||||
|
||||
func TestProvider(t *testing.T) {
|
||||
if err := Provider().(*schema.Provider).InternalValidate(); err != nil {
|
||||
t.Fatalf("Error creating Provider: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProvider_impl(t *testing.T) {
|
||||
var _ terraform.ResourceProvider = Provider()
|
||||
}
|
||||
|
||||
func testAccPreCheck(t *testing.T) {
|
||||
required := []string{"OPC_USERNAME", "OPC_PASSWORD", "OPC_IDENTITY_DOMAIN", "OPC_ENDPOINT"}
|
||||
for _, prop := range required {
|
||||
if os.Getenv(prop) == "" {
|
||||
t.Fatalf("%s must be set for acceptance test", prop)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type OPCResourceState struct {
|
||||
*compute.Client
|
||||
*terraform.InstanceState
|
||||
}
|
||||
|
||||
func opcResourceCheck(resourceName string, f func(checker *OPCResourceState) error) resource.TestCheckFunc {
|
||||
return func(s *terraform.State) error {
|
||||
rs, ok := s.RootModule().Resources[resourceName]
|
||||
if !ok {
|
||||
return fmt.Errorf("Resource not found: %s", resourceName)
|
||||
}
|
||||
|
||||
state := &OPCResourceState{
|
||||
Client: testAccProvider.Meta().(*compute.Client),
|
||||
InstanceState: rs.Primary,
|
||||
}
|
||||
|
||||
return f(state)
|
||||
}
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCACL_Basic(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccACLBasic, ri)
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckACLDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckACLExists,
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCACL_Update(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccACLBasic, ri)
|
||||
updatedConfig := fmt.Sprintf(testAccACLDisabled, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckACLDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccCheckACLExists,
|
||||
},
|
||||
{
|
||||
Config: updatedConfig,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckACLExists,
|
||||
resource.TestCheckResourceAttr("opc_compute_acl.test", "enabled", "false"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckACLExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).ACLs()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_acl" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetACLInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetACL(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of ACL %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckACLDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).ACLs()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_acl" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetACLInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetACL(&input); err == nil {
|
||||
return fmt.Errorf("ACL %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var testAccACLBasic = `
|
||||
resource "opc_compute_acl" "test" {
|
||||
name = "test_acl-%d"
|
||||
description = "test acl"
|
||||
}
|
||||
`
|
||||
|
||||
var testAccACLDisabled = `
|
||||
resource "opc_compute_acl" "test" {
|
||||
name = "test_acl-%d"
|
||||
description = "test acl"
|
||||
enabled = false
|
||||
}
|
||||
`
|
|
@ -1,161 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCImageListEntry_Basic(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccImageListEntry_basic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckImageListEntryDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccCheckImageListEntryExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCImageListEntry_Complete(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccImageListEntry_Complete, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckImageListEntryDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccCheckImageListEntryExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCImageListEntry_CompleteExpanded(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccImageListEntry_CompleteExpanded, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckImageListEntryDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccCheckImageListEntryExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckImageListEntryExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).ImageListEntries()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_image_list_entry" {
|
||||
continue
|
||||
}
|
||||
|
||||
name, version, err := parseOPCImageListEntryID(rs.Primary.ID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing the Image List ID: '%s': %+v", rs.Primary.ID, err)
|
||||
}
|
||||
|
||||
input := compute.GetImageListEntryInput{
|
||||
Name: *name,
|
||||
Version: *version,
|
||||
}
|
||||
|
||||
if _, err := client.GetImageListEntry(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of Image List Entry %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckImageListEntryDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).ImageListEntries()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_image_list_entry" {
|
||||
continue
|
||||
}
|
||||
|
||||
name, version, err := parseOPCImageListEntryID(rs.Primary.ID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing the Image List ID: %+v", err)
|
||||
}
|
||||
|
||||
input := compute.GetImageListEntryInput{
|
||||
Name: *name,
|
||||
Version: *version,
|
||||
}
|
||||
if info, err := client.GetImageListEntry(&input); err == nil {
|
||||
return fmt.Errorf("Image List Entry %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var testAccImageListEntry_basic = `
|
||||
resource "opc_compute_image_list" "test" {
|
||||
name = "test-acc-image-list-entry-basic-%d"
|
||||
description = "Acceptance Test TestAccOPCImageListEntry_Basic"
|
||||
default = 1
|
||||
}
|
||||
|
||||
resource "opc_compute_image_list_entry" "test" {
|
||||
name = "${opc_compute_image_list.test.name}"
|
||||
machine_images = [ "/oracle/public/oel_6.7_apaas_16.4.5_1610211300" ]
|
||||
version = 1
|
||||
}
|
||||
`
|
||||
|
||||
var testAccImageListEntry_Complete = `
|
||||
resource "opc_compute_image_list" "test" {
|
||||
name = "test-acc-image-list-entry-basic-%d"
|
||||
description = "Acceptance Test TestAccOPCImageListEntry_Basic"
|
||||
default = 1
|
||||
}
|
||||
|
||||
resource "opc_compute_image_list_entry" "test" {
|
||||
name = "${opc_compute_image_list.test.name}"
|
||||
machine_images = [ "/oracle/public/oel_6.7_apaas_16.4.5_1610211300" ]
|
||||
attributes = "{\"hello\":\"world\"}"
|
||||
version = 1
|
||||
}
|
||||
`
|
||||
|
||||
var testAccImageListEntry_CompleteExpanded = `
|
||||
resource "opc_compute_image_list" "test" {
|
||||
name = "test-acc-image-list-entry-basic-%d"
|
||||
description = "Acceptance Test TestAccOPCImageListEntry_Basic"
|
||||
default = 1
|
||||
}
|
||||
|
||||
resource "opc_compute_image_list_entry" "test" {
|
||||
name = "${opc_compute_image_list.test.name}"
|
||||
machine_images = [ "/oracle/public/oel_6.7_apaas_16.4.5_1610211300" ]
|
||||
attributes = <<JSON
|
||||
{
|
||||
"hello": "world"
|
||||
}
|
||||
JSON
|
||||
version = 1
|
||||
}
|
||||
`
|
|
@ -1,98 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCImageList_Basic(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccImageList_basic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckImageListDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccCheckImageListExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCImageList_Complete(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccImageList_complete, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckImageListDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccCheckImageListExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckImageListExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).ImageList()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_image_list" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetImageListInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetImageList(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of Image List %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckImageListDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).ImageList()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_image_list" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetImageListInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetImageList(&input); err == nil {
|
||||
return fmt.Errorf("Image List %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var testAccImageList_basic = `
|
||||
resource "opc_compute_image_list" "test" {
|
||||
name = "test-acc-image-list-basic-%d"
|
||||
description = "Image List (Basic)"
|
||||
}
|
||||
`
|
||||
|
||||
var testAccImageList_complete = `
|
||||
resource "opc_compute_image_list" "test" {
|
||||
name = "test-acc-image-list-complete-%d"
|
||||
description = "Image List (Complete)"
|
||||
default = 2
|
||||
}
|
||||
`
|
|
@ -1,308 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCInstance_basic(t *testing.T) {
|
||||
resName := "opc_compute_instance.test"
|
||||
rInt := acctest.RandInt()
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckInstanceDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccInstanceBasic(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckInstanceExists,
|
||||
resource.TestCheckResourceAttr(resName, "name", fmt.Sprintf("acc-test-instance-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "label", "TestAccOPCInstance_basic"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCInstance_sharedNetworking(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resName := "opc_compute_instance.test"
|
||||
dataName := "data.opc_compute_network_interface.test"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckInstanceDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccInstanceSharedNetworking(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckInstanceExists,
|
||||
resource.TestCheckResourceAttrSet(resName, "id"),
|
||||
resource.TestCheckResourceAttrSet(resName, "availability_domain"),
|
||||
resource.TestCheckResourceAttrSet(resName, "domain"),
|
||||
resource.TestCheckResourceAttrSet(resName, "hostname"),
|
||||
resource.TestCheckResourceAttrSet(resName, "ip_address"),
|
||||
resource.TestCheckResourceAttr(resName, "name", fmt.Sprintf("acc-test-instance-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "networking_info.#", "1"),
|
||||
// Default Placement Reqs
|
||||
resource.TestCheckResourceAttr(resName, "placement_requirements.#", "2"),
|
||||
resource.TestCheckResourceAttr(resName, "placement_requirements.0", "/system/compute/allow_instances"),
|
||||
resource.TestCheckResourceAttr(resName, "placement_requirements.1", "/system/compute/placement/default"),
|
||||
resource.TestCheckResourceAttr(resName, "platform", "linux"),
|
||||
resource.TestCheckResourceAttr(resName, "priority", "/oracle/public/default"),
|
||||
resource.TestCheckResourceAttr(resName, "reverse_dns", "true"),
|
||||
resource.TestCheckResourceAttr(resName, "state", "running"),
|
||||
resource.TestCheckResourceAttr(resName, "tags.#", "2"),
|
||||
resource.TestCheckResourceAttrSet(resName, "vcable"),
|
||||
resource.TestCheckResourceAttr(resName, "virtio", "false"),
|
||||
|
||||
// Check Data Source to validate networking attributes
|
||||
resource.TestCheckResourceAttr(dataName, "shared_network", "true"),
|
||||
resource.TestCheckResourceAttr(dataName, "nat.#", "1"),
|
||||
resource.TestCheckResourceAttr(dataName, "sec_lists.#", "1"),
|
||||
resource.TestCheckResourceAttr(dataName, "name_servers.#", "0"),
|
||||
resource.TestCheckResourceAttr(dataName, "vnic_sets.#", "0"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCInstance_ipNetwork(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resName := "opc_compute_instance.test"
|
||||
dataName := "data.opc_compute_network_interface.test"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckInstanceDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccInstanceIPNetworking(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckInstanceExists,
|
||||
resource.TestCheckResourceAttrSet(resName, "id"),
|
||||
resource.TestCheckResourceAttrSet(resName, "availability_domain"),
|
||||
resource.TestCheckResourceAttrSet(resName, "domain"),
|
||||
resource.TestCheckResourceAttrSet(resName, "ip_address"),
|
||||
resource.TestCheckResourceAttr(resName, "name", fmt.Sprintf("acc-test-instance-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "networking_info.#", "1"),
|
||||
// Default Placement Reqs
|
||||
resource.TestCheckResourceAttr(resName, "placement_requirements.#", "2"),
|
||||
resource.TestCheckResourceAttr(resName, "placement_requirements.0", "/system/compute/allow_instances"),
|
||||
resource.TestCheckResourceAttr(resName, "placement_requirements.1", "/system/compute/placement/default"),
|
||||
resource.TestCheckResourceAttr(resName, "platform", "linux"),
|
||||
resource.TestCheckResourceAttr(resName, "priority", "/oracle/public/default"),
|
||||
resource.TestCheckResourceAttr(resName, "reverse_dns", "true"),
|
||||
resource.TestCheckResourceAttr(resName, "state", "running"),
|
||||
resource.TestCheckResourceAttr(resName, "virtio", "false"),
|
||||
|
||||
// Check Data Source to validate networking attributes
|
||||
resource.TestCheckResourceAttr(dataName, "ip_network", fmt.Sprintf("testing-ip-network-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(dataName, "vnic", fmt.Sprintf("ip-network-test-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(dataName, "shared_network", "false"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCInstance_storage(t *testing.T) {
|
||||
resName := "opc_compute_instance.test"
|
||||
rInt := acctest.RandInt()
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckInstanceDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccInstanceStorage(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckInstanceExists,
|
||||
resource.TestCheckResourceAttr(resName, "storage.#", "2"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCInstance_emptyLabel(t *testing.T) {
|
||||
resName := "opc_compute_instance.test"
|
||||
rInt := acctest.RandInt()
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckInstanceDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccInstanceEmptyLabel(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckInstanceExists,
|
||||
resource.TestCheckResourceAttr(resName, "name", fmt.Sprintf("acc-test-instance-%d", rInt)),
|
||||
resource.TestCheckResourceAttrSet(resName, "label"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccOPCCheckInstanceExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).Instances()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_instance" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := &compute.GetInstanceInput{
|
||||
ID: rs.Primary.ID,
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
_, err := client.GetInstance(input)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error retrieving state of Instance %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccOPCCheckInstanceDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).Instances()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_instance" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := &compute.GetInstanceInput{
|
||||
ID: rs.Primary.ID,
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetInstance(input); err == nil {
|
||||
return fmt.Errorf("Instance %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccInstanceBasic(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "acc-test-instance-%d"
|
||||
label = "TestAccOPCInstance_basic"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
instance_attributes = <<JSON
|
||||
{
|
||||
"foo": "bar"
|
||||
}
|
||||
JSON
|
||||
}`, rInt)
|
||||
}
|
||||
|
||||
func testAccInstanceSharedNetworking(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "acc-test-instance-%d"
|
||||
label = "TestAccOPCInstance_sharedNetworking"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
tags = ["tag1", "tag2"]
|
||||
networking_info {
|
||||
index = 0
|
||||
nat = ["ippool:/oracle/public/ippool"]
|
||||
shared_network = true
|
||||
}
|
||||
}
|
||||
|
||||
data "opc_compute_network_interface" "test" {
|
||||
instance_name = "${opc_compute_instance.test.name}"
|
||||
instance_id = "${opc_compute_instance.test.id}"
|
||||
interface = "eth0"
|
||||
}
|
||||
`, rInt)
|
||||
}
|
||||
|
||||
func testAccInstanceIPNetworking(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_network" "foo" {
|
||||
name = "testing-ip-network-%d"
|
||||
description = "testing-ip-network-instance"
|
||||
ip_address_prefix = "10.1.12.0/24"
|
||||
}
|
||||
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "acc-test-instance-%d"
|
||||
label = "TestAccOPCInstance_ipNetwork"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
networking_info {
|
||||
index = 0
|
||||
ip_network = "${opc_compute_ip_network.foo.id}"
|
||||
vnic = "ip-network-test-%d"
|
||||
shared_network = false
|
||||
}
|
||||
}
|
||||
|
||||
data "opc_compute_network_interface" "test" {
|
||||
instance_id = "${opc_compute_instance.test.id}"
|
||||
instance_name = "${opc_compute_instance.test.name}"
|
||||
interface = "eth0"
|
||||
}
|
||||
`, rInt, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccInstanceStorage(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_storage_volume" "foo" {
|
||||
name = "acc-test-instance-%d"
|
||||
size = 1
|
||||
}
|
||||
|
||||
resource "opc_compute_storage_volume" "bar" {
|
||||
name = "acc-test-instance-2-%d"
|
||||
size = 1
|
||||
}
|
||||
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "acc-test-instance-%d"
|
||||
label = "TestAccOPCInstance_basic"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
storage {
|
||||
volume = "${opc_compute_storage_volume.foo.name}"
|
||||
index = 1
|
||||
}
|
||||
storage {
|
||||
volume = "${opc_compute_storage_volume.bar.name}"
|
||||
index = 2
|
||||
}
|
||||
}`, rInt, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccInstanceEmptyLabel(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "acc-test-instance-%d"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
instance_attributes = <<JSON
|
||||
{
|
||||
"foo": "bar"
|
||||
}
|
||||
JSON
|
||||
}`, rInt)
|
||||
}
|
|
@ -1,155 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCIPAddressAssociation_Basic(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resourceName := "opc_compute_ip_address_association.test"
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckIPAddressAssociationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccIPAddressAssociationBasic(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckIPAddressAssociationExists,
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "tags.#", "2"),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: testAccIPAddressAssociationBasic_Update(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "tags.#", "1"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCIPAddressAssociation_Full(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resourceName := "opc_compute_ip_address_association.test"
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckIPAddressAssociationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccIPAddressAssociationFull(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckIPAddressAssociationExists,
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "vnic", fmt.Sprintf("test-vnic-data-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "ip_address_reservation", fmt.Sprintf("testing-ip-address-association-%d", rInt)),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckIPAddressAssociationExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).IPAddressAssociations()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ip_address_association" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetIPAddressAssociationInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetIPAddressAssociation(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of IP Address Association %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckIPAddressAssociationDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).IPAddressAssociations()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ip_address_association" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetIPAddressAssociationInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetIPAddressAssociation(&input); err == nil {
|
||||
return fmt.Errorf("IP Address Association %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccIPAddressAssociationBasic(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_address_association" "test" {
|
||||
name = "testing-acc-%d"
|
||||
description = "acctesting ip address association test %d"
|
||||
tags = ["tag1", "tag2"]
|
||||
}`, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccIPAddressAssociationBasic_Update(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_address_association" "test" {
|
||||
name = "testing-acc-%d"
|
||||
description = "acctesting ip address association test updated %d"
|
||||
tags = ["tag1"]
|
||||
}`, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccIPAddressAssociationFull(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_network" "foo" {
|
||||
name = "testing-vnic-data-%d"
|
||||
description = "testing-ip-address-association"
|
||||
ip_address_prefix = "10.1.13.0/24"
|
||||
}
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "test-%d"
|
||||
label = "test"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
networking_info {
|
||||
index = 0
|
||||
ip_network = "${opc_compute_ip_network.foo.id}"
|
||||
vnic = "test-vnic-data-%d"
|
||||
shared_network = false
|
||||
mac_address = "02:5a:cd:ec:2e:4c"
|
||||
}
|
||||
}
|
||||
data "opc_compute_network_interface" "eth0" {
|
||||
instance_name = "${opc_compute_instance.test.name}"
|
||||
instance_id = "${opc_compute_instance.test.id}"
|
||||
interface = "eth0"
|
||||
}
|
||||
resource "opc_compute_ip_address_reservation" "test" {
|
||||
name = "testing-ip-address-association-%d"
|
||||
description = "testing-desc-%d"
|
||||
ip_address_pool = "public-ippool"
|
||||
}
|
||||
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_network_interface.eth0.vnic}"
|
||||
description = "acctesting ip address association test %d"
|
||||
tags = ["tag1", "tag2"]
|
||||
}`, rInt, rInt, rInt, rInt, rInt, rInt, rInt)
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCIPAddressPrefixSet_Basic(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resourceName := "opc_compute_ip_address_prefix_set.test"
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckIPAddressPrefixSetDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccIPAddressPrefixSetBasic(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckIPAddressPrefixSetExists,
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "tags.#", "2"),
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "prefixes.#", "2"),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: testAccIPAddressPrefixSetBasic_Update(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "tags.#", "1"),
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "prefixes.0", "171.120.0.0/24"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckIPAddressPrefixSetExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).IPAddressPrefixSets()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ip_address_prefix_set" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetIPAddressPrefixSetInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetIPAddressPrefixSet(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of IP Address Prefix Set %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckIPAddressPrefixSetDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).IPAddressPrefixSets()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ip_address_prefix_set" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetIPAddressPrefixSetInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetIPAddressPrefixSet(&input); err == nil {
|
||||
return fmt.Errorf("IP Address Prefix Set %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccIPAddressPrefixSetBasic(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_address_prefix_set" "test" {
|
||||
name = "testing-acc-%d"
|
||||
prefixes = ["172.120.0.0/24", "192.168.0.0/16"]
|
||||
description = "acctesting ip address prefix test %d"
|
||||
tags = ["tag1", "tag2"]
|
||||
}`, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccIPAddressPrefixSetBasic_Update(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_address_prefix_set" "test" {
|
||||
name = "testing-acc-%d"
|
||||
description = "acctesting ip address prefix test updated %d"
|
||||
prefixes = ["171.120.0.0/24", "192.168.0.0/16"]
|
||||
tags = ["tag1"]
|
||||
}`, rInt, rInt)
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCIPAddressReservation_Basic(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resName := "opc_compute_ip_address_reservation.test"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckIPAddressReservationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccOPCIPAddressReservationConfig_Basic(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckIPAddressReservationExists,
|
||||
resource.TestCheckResourceAttr(resName, "name", fmt.Sprintf("testing-ip-address-reservation-%d", rInt)),
|
||||
resource.TestCheckResourceAttrSet(resName, "ip_address"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccOPCCheckIPAddressReservationExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).IPAddressReservations()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ip_address_reservation" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetIPAddressReservationInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetIPAddressReservation(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of IP Address Reservation %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
func testAccOPCCheckIPAddressReservationDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).IPAddressReservations()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ip_address_reservation" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetIPAddressReservationInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetIPAddressReservation(&input); err == nil {
|
||||
return fmt.Errorf("IP Address Reservation %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccOPCIPAddressReservationConfig_Basic(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_address_reservation" "test" {
|
||||
name = "testing-ip-address-reservation-%d"
|
||||
description = "testing-desc-%d"
|
||||
ip_address_pool = "public-ippool"
|
||||
}`, rInt, rInt)
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCIPAssociation_Basic(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccIPAssociationBasic, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckIPAssociationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckIPAssociationExists,
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccOPCCheckIPAssociationExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).IPAssociations()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ip_association" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetIPAssociationInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetIPAssociation(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of IP Association %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccOPCCheckIPAssociationDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).IPAssociations()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ip_association" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetIPAssociationInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetIPAssociation(&input); err == nil {
|
||||
return fmt.Errorf("IP Association %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var testAccIPAssociationBasic = `
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "test-acc-ip-ass-instance-%d"
|
||||
label = "testAccIPAssociationBasic"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
}
|
||||
|
||||
resource "opc_compute_ip_reservation" "test" {
|
||||
name = "test-acc-ip-ass-reservation-%d"
|
||||
parent_pool = "/oracle/public/ippool"
|
||||
permanent = true
|
||||
}
|
||||
|
||||
resource "opc_compute_ip_association" "test" {
|
||||
vcable = "${opc_compute_instance.test.vcable}"
|
||||
parent_pool = "ipreservation:${opc_compute_ip_reservation.test.name}"
|
||||
}
|
||||
`
|
|
@ -1,73 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCIPNetworkExchange_Basic(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccIPNetworkExchangeBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckIPNetworkExchangeDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccCheckIPNetworkExchangeExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckIPNetworkExchangeExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).IPNetworkExchanges()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ip_network_exchange" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetIPNetworkExchangeInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetIPNetworkExchange(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of ip network exchange %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckIPNetworkExchangeDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).IPNetworkExchanges()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ip_network_exchange" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetIPNetworkExchangeInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetIPNetworkExchange(&input); err == nil {
|
||||
return fmt.Errorf("IPNetworkExchange %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var testAccIPNetworkExchangeBasic = `
|
||||
resource "opc_compute_ip_network_exchange" "test" {
|
||||
name = "test_ip_network_exchange-%d"
|
||||
description = "test ip network exchange"
|
||||
}
|
||||
`
|
|
@ -1,115 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCIPNetwork_Basic(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resName := "opc_compute_ip_network.test"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(resName, testAccOPCCheckIPNetworkDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccOPCIPNetworkConfig_Basic(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
opcResourceCheck(resName, testAccOPCCheckIPNetworkExists),
|
||||
resource.TestCheckResourceAttr(resName, "ip_address_prefix", "10.0.12.0/24"),
|
||||
resource.TestCheckResourceAttr(resName, "public_napt_enabled", "false"),
|
||||
resource.TestCheckResourceAttr(resName, "description", fmt.Sprintf("testing-desc-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "name", fmt.Sprintf("testing-ip-network-%d", rInt)),
|
||||
resource.TestMatchResourceAttr(resName, "uri", regexp.MustCompile("testing-ip-network")),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCIPNetwork_Update(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resName := "opc_compute_ip_network.test"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(resName, testAccOPCCheckIPNetworkDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccOPCIPNetworkConfig_Basic(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
opcResourceCheck(resName, testAccOPCCheckIPNetworkExists),
|
||||
resource.TestCheckResourceAttr(resName, "ip_address_prefix", "10.0.12.0/24"),
|
||||
resource.TestCheckResourceAttr(resName, "public_napt_enabled", "false"),
|
||||
resource.TestCheckResourceAttr(resName, "description", fmt.Sprintf("testing-desc-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "name", fmt.Sprintf("testing-ip-network-%d", rInt)),
|
||||
resource.TestMatchResourceAttr(resName, "uri", regexp.MustCompile("testing-ip-network")),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: testAccOPCIPNetworkConfig_BasicUpdate(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
opcResourceCheck(resName, testAccOPCCheckIPNetworkExists),
|
||||
resource.TestCheckResourceAttr(resName, "ip_address_prefix", "10.0.12.0/24"),
|
||||
resource.TestCheckResourceAttr(resName, "public_napt_enabled", "true"),
|
||||
resource.TestCheckResourceAttr(resName, "description", fmt.Sprintf("testing-desc-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "name", fmt.Sprintf("testing-ip-network-%d", rInt)),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccOPCIPNetworkConfig_Basic(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_network" "test" {
|
||||
name = "testing-ip-network-%d"
|
||||
description = "testing-desc-%d"
|
||||
ip_address_prefix = "10.0.12.0/24"
|
||||
}`, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccOPCIPNetworkConfig_BasicUpdate(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_network" "test" {
|
||||
name = "testing-ip-network-%d"
|
||||
description = "testing-desc-%d"
|
||||
ip_address_prefix = "10.0.12.0/24"
|
||||
public_napt_enabled = true
|
||||
}`, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccOPCCheckIPNetworkExists(state *OPCResourceState) error {
|
||||
name := state.Attributes["name"]
|
||||
|
||||
input := &compute.GetIPNetworkInput{
|
||||
Name: name,
|
||||
}
|
||||
|
||||
if _, err := state.Client.IPNetworks().GetIPNetwork(input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of IP Network '%s': %v", name, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccOPCCheckIPNetworkDestroyed(state *OPCResourceState) error {
|
||||
name := state.Attributes["name"]
|
||||
|
||||
input := &compute.GetIPNetworkInput{
|
||||
Name: name,
|
||||
}
|
||||
|
||||
if info, _ := state.Client.IPNetworks().GetIPNetwork(input); info != nil {
|
||||
return fmt.Errorf("IP Network '%s' still exists: %+v", name, info)
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCIPReservation_Basic(t *testing.T) {
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccIPReservationBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckIPReservationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccCheckIPReservationExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckIPReservationExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).IPReservations()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ip_reservation" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetIPReservationInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetIPReservation(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of IP Reservation %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckIPReservationDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).IPReservations()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ip_reservation" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetIPReservationInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetIPReservation(&input); err == nil {
|
||||
return fmt.Errorf("IP Reservation %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var testAccIPReservationBasic = `
|
||||
resource "opc_compute_ip_reservation" "test" {
|
||||
name = "acc-test-ip-reservation-%d"
|
||||
parent_pool = "/oracle/public/ippool"
|
||||
permanent = true
|
||||
}
|
||||
`
|
|
@ -1,163 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCRoute_Basic(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resName := "opc_compute_route.test"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckRouteDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccOPCRouteConfig_Basic(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckRouteExists,
|
||||
resource.TestCheckResourceAttr(resName, "admin_distance", "1"),
|
||||
resource.TestCheckResourceAttr(resName, "ip_address_prefix", "10.0.12.0/24"),
|
||||
resource.TestCheckResourceAttr(resName, "name", fmt.Sprintf("testing-route-%d", rInt)),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: testAccOPCRouteConfig_BasicUpdate(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckRouteExists,
|
||||
resource.TestCheckResourceAttr(resName, "admin_distance", "2"),
|
||||
resource.TestCheckResourceAttr(resName, "ip_address_prefix", "10.0.14.0/24"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccOPCRouteConfig_Basic(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_network" "foo" {
|
||||
name = "testing-route-%d"
|
||||
description = "testing-route"
|
||||
ip_address_prefix = "10.1.14.0/24"
|
||||
}
|
||||
|
||||
resource "opc_compute_instance" "foo" {
|
||||
name = "test-route-%d"
|
||||
label = "testing"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
networking_info {
|
||||
index = 0
|
||||
ip_network = "${opc_compute_ip_network.foo.id}"
|
||||
vnic = "test-vnic-set-%d"
|
||||
shared_network = false
|
||||
}
|
||||
}
|
||||
|
||||
data "opc_compute_network_interface" "foo" {
|
||||
instance_name = "${opc_compute_instance.foo.name}"
|
||||
instance_id = "${opc_compute_instance.foo.id}"
|
||||
interface = "eth0"
|
||||
}
|
||||
|
||||
resource "opc_compute_vnic_set" "test" {
|
||||
name = "route-test-%d"
|
||||
description = "route-testing-%d"
|
||||
virtual_nics = ["${data.opc_compute_network_interface.foo.vnic}"]
|
||||
}
|
||||
|
||||
resource "opc_compute_route" "test" {
|
||||
name = "testing-route-%d"
|
||||
description = "testing-desc-%d"
|
||||
admin_distance = 1
|
||||
ip_address_prefix = "10.0.12.0/24"
|
||||
next_hop_vnic_set = "${opc_compute_vnic_set.test.name}"
|
||||
}`, rInt, rInt, rInt, rInt, rInt, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccOPCRouteConfig_BasicUpdate(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_network" "foo" {
|
||||
name = "testing-route-%d"
|
||||
description = "testing-route"
|
||||
ip_address_prefix = "10.1.14.0/24"
|
||||
}
|
||||
|
||||
resource "opc_compute_instance" "foo" {
|
||||
name = "test-route-%d"
|
||||
label = "testing"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
networking_info {
|
||||
index = 0
|
||||
ip_network = "${opc_compute_ip_network.foo.id}"
|
||||
vnic = "test-vnic-set-%d"
|
||||
shared_network = false
|
||||
}
|
||||
}
|
||||
|
||||
data "opc_compute_network_interface" "foo" {
|
||||
instance_name = "${opc_compute_instance.foo.name}"
|
||||
instance_id = "${opc_compute_instance.foo.id}"
|
||||
interface = "eth0"
|
||||
}
|
||||
|
||||
resource "opc_compute_vnic_set" "test" {
|
||||
name = "route-test-%d"
|
||||
description = "route-testing-%d"
|
||||
virtual_nics = ["${data.opc_compute_network_interface.foo.vnic}"]
|
||||
}
|
||||
|
||||
resource "opc_compute_route" "test" {
|
||||
name = "testing-route-%d"
|
||||
description = "testing-desc-%d"
|
||||
admin_distance = 2
|
||||
ip_address_prefix = "10.0.14.0/24"
|
||||
next_hop_vnic_set = "${opc_compute_vnic_set.test.name}"
|
||||
}`, rInt, rInt, rInt, rInt, rInt, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccOPCCheckRouteExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).Routes()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_route" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetRouteInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetRoute(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of Rule %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccOPCCheckRouteDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).Routes()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_route" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetRouteInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetRoute(&input); err == nil {
|
||||
return fmt.Errorf("Rule %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCSecRule_Basic(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecRuleBasic, ri, ri, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecRuleDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccCheckSecRuleExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecRule_Complete(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecRuleComplete, ri, ri, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecRuleDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccCheckSecRuleExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckSecRuleExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecRules()
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_sec_rule" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecRuleInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetSecRule(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of Sec Rule %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckSecRuleDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecRules()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_sec_rule" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecRuleInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetSecRule(&input); err == nil {
|
||||
return fmt.Errorf("Sec Rule %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var testAccOPCSecRuleBasic = `
|
||||
resource "opc_compute_security_list" "test" {
|
||||
name = "acc-test-sec-rule-list-%d"
|
||||
policy = "PERMIT"
|
||||
outbound_cidr_policy = "DENY"
|
||||
}
|
||||
|
||||
resource "opc_compute_security_application" "test" {
|
||||
name = "acc-test-sec-rule-app-%d"
|
||||
protocol = "tcp"
|
||||
dport = "8080"
|
||||
}
|
||||
|
||||
resource "opc_compute_security_ip_list" "test" {
|
||||
name = "acc-test-sec-rule-ip-list-%d"
|
||||
ip_entries = ["217.138.34.4"]
|
||||
}
|
||||
|
||||
resource "opc_compute_sec_rule" "test" {
|
||||
name = "acc-test-sec-rule-%d"
|
||||
source_list = "seclist:${opc_compute_security_list.test.name}"
|
||||
destination_list = "seciplist:${opc_compute_security_ip_list.test.name}"
|
||||
action = "PERMIT"
|
||||
application = "${opc_compute_security_application.test.name}"
|
||||
}
|
||||
`
|
||||
|
||||
var testAccOPCSecRuleComplete = `
|
||||
resource "opc_compute_security_list" "test" {
|
||||
name = "acc-test-sec-rule-list-%d"
|
||||
policy = "PERMIT"
|
||||
outbound_cidr_policy = "DENY"
|
||||
}
|
||||
|
||||
resource "opc_compute_security_application" "test" {
|
||||
name = "acc-test-sec-rule-app-%d"
|
||||
protocol = "tcp"
|
||||
dport = "8080"
|
||||
}
|
||||
|
||||
resource "opc_compute_security_ip_list" "test" {
|
||||
name = "acc-test-sec-rule-ip-list-%d"
|
||||
ip_entries = ["217.138.34.4"]
|
||||
}
|
||||
|
||||
resource "opc_compute_sec_rule" "test" {
|
||||
name = "acc-test-sec-rule-%d"
|
||||
source_list = "seclist:${opc_compute_security_list.test.name}"
|
||||
destination_list = "seciplist:${opc_compute_security_ip_list.test.name}"
|
||||
action = "PERMIT"
|
||||
application = "${opc_compute_security_application.test.name}"
|
||||
disabled = false
|
||||
description = "This is a test description"
|
||||
}
|
||||
`
|
|
@ -1,101 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCSecurityApplication_ICMP(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityApplicationICMP, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSecurityApplicationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccOPCCheckSecurityApplicationExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecurityApplication_TCP(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityApplicationTCP, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSecurityApplicationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccOPCCheckSecurityApplicationExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccOPCCheckSecurityApplicationExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecurityApplications()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_security_application" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecurityApplicationInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetSecurityApplication(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of Security Application %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccOPCCheckSecurityApplicationDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecurityApplications()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_security_application" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecurityApplicationInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetSecurityApplication(&input); err == nil {
|
||||
return fmt.Errorf("Security Application %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
const testAccOPCSecurityApplicationTCP = `
|
||||
resource "opc_compute_security_application" "test" {
|
||||
name = "acc-security-application-tcp-%d"
|
||||
protocol = "tcp"
|
||||
dport = "8080"
|
||||
description = "Terraform Acceptance Test"
|
||||
}
|
||||
`
|
||||
|
||||
const testAccOPCSecurityApplicationICMP = `
|
||||
resource "opc_compute_security_application" "test" {
|
||||
name = "acc-security-application-tcp-%d"
|
||||
protocol = "icmp"
|
||||
icmptype = "echo"
|
||||
description = "Terraform Acceptance Test"
|
||||
}
|
||||
`
|
|
@ -1,128 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCSecurityAssociation_Basic(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccSecurityAssociationBasic, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSecurityAssociationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckSecurityAssociationExists,
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecurityAssociation_Complete(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccSecurityAssociationComplete, ri, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSecurityAssociationDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckSecurityAssociationExists,
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccOPCCheckSecurityAssociationExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecurityAssociations()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_security_association" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecurityAssociationInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetSecurityAssociation(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of Security Association %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccOPCCheckSecurityAssociationDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecurityAssociations()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_security_association" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecurityAssociationInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetSecurityAssociation(&input); err == nil {
|
||||
return fmt.Errorf("Security Association %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
var testAccSecurityAssociationBasic = `
|
||||
resource "opc_compute_security_list" "test" {
|
||||
name = "acc-test-sec-ass-sec-list-%d"
|
||||
policy = "PERMIT"
|
||||
outbound_cidr_policy = "DENY"
|
||||
}
|
||||
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "acc-test-sec-ass-instance-%d"
|
||||
label = "Security Associations Test Instance"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
}
|
||||
|
||||
resource "opc_compute_security_association" "test" {
|
||||
vcable = "${opc_compute_instance.test.vcable}"
|
||||
seclist = "${opc_compute_security_list.test.name}"
|
||||
}
|
||||
`
|
||||
|
||||
var testAccSecurityAssociationComplete = `
|
||||
resource "opc_compute_security_list" "test" {
|
||||
name = "acc-test-sec-ass-sec-list-%d"
|
||||
policy = "PERMIT"
|
||||
outbound_cidr_policy = "DENY"
|
||||
}
|
||||
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "acc-test-sec-ass-instance-%d"
|
||||
label = "Security Associations Test Instance"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
}
|
||||
|
||||
resource "opc_compute_security_association" "test" {
|
||||
name = "acc-test-sec-ass-%d"
|
||||
vcable = "${opc_compute_instance.test.vcable}"
|
||||
seclist = "${opc_compute_security_list.test.name}"
|
||||
}
|
||||
`
|
|
@ -1,117 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCSecurityIPList_Basic(t *testing.T) {
|
||||
listResourceName := "opc_compute_security_ip_list.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityIPListBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityIPListDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckSecurityIPListExists,
|
||||
resource.TestCheckResourceAttr(listResourceName, "ip_entries.0", "192.168.0.1"),
|
||||
resource.TestCheckResourceAttr(listResourceName, "ip_entries.1", "192.168.0.2"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecurityIPList_Updated(t *testing.T) {
|
||||
listResourceName := "opc_compute_security_ip_list.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityIPListBasic, ri)
|
||||
config2 := fmt.Sprintf(testAccOPCSecurityIPListUpdated, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityIPListDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckSecurityIPListExists,
|
||||
resource.TestCheckResourceAttr(listResourceName, "description", "Terraform Acceptance Test"),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: config2,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckSecurityIPListExists,
|
||||
resource.TestCheckResourceAttr(listResourceName, "description", ""),
|
||||
resource.TestCheckResourceAttr(listResourceName, "ip_entries.0", "192.168.0.1"),
|
||||
resource.TestCheckResourceAttr(listResourceName, "ip_entries.1", "192.168.0.3"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckSecurityIPListExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecurityIPLists()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_security_ip_list" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecurityIPListInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetSecurityIPList(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of Security IP List %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckSecurityIPListDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecurityIPLists()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_security_ip_list" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecurityIPListInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetSecurityIPList(&input); err == nil {
|
||||
return fmt.Errorf("Security IP List %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
const testAccOPCSecurityIPListBasic = `
|
||||
resource "opc_compute_security_ip_list" "test" {
|
||||
name = "acc-security-application-tcp-%d"
|
||||
ip_entries = ["192.168.0.1", "192.168.0.2"]
|
||||
description = "Terraform Acceptance Test"
|
||||
}
|
||||
`
|
||||
|
||||
const testAccOPCSecurityIPListUpdated = `
|
||||
resource "opc_compute_security_ip_list" "test" {
|
||||
name = "acc-security-application-tcp-%d"
|
||||
ip_entries = ["192.168.0.1", "192.168.0.3"]
|
||||
}
|
||||
`
|
|
@ -1,100 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCSecurityList_basic(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityListBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityListDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccCheckSecurityListExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecurityList_complete(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityListComplete, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityListDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: testAccCheckSecurityListExists,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckSecurityListExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecurityLists()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_security_list" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecurityListInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetSecurityList(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of Security List %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckSecurityListDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecurityLists()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_security_list" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecurityListInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetSecurityList(&input); err == nil {
|
||||
return fmt.Errorf("Security List %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
const testAccOPCSecurityListBasic = `
|
||||
resource "opc_compute_security_list" "test" {
|
||||
name = "acc-test-sec-list-%d"
|
||||
policy = "PERMIT"
|
||||
outbound_cidr_policy = "DENY"
|
||||
}
|
||||
`
|
||||
|
||||
const testAccOPCSecurityListComplete = `
|
||||
resource "opc_compute_security_list" "test" {
|
||||
name = "acc-test-sec-list-%d"
|
||||
description = "Acceptance Test Security List Complete"
|
||||
policy = "PERMIT"
|
||||
outbound_cidr_policy = "DENY"
|
||||
}
|
||||
`
|
|
@ -1,153 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCSecurityProtocol_Basic(t *testing.T) {
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityProtocolBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityProtocolDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckSecurityProtocolExists,
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecurityProtocol_Complete(t *testing.T) {
|
||||
protocolResourceName := "opc_compute_security_protocol.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityProtocolComplete, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityProtocolDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckSecurityProtocolExists,
|
||||
resource.TestCheckResourceAttr(protocolResourceName, "description", "Terraform Acceptance Test"),
|
||||
resource.TestCheckResourceAttr(protocolResourceName, "dst_ports.0", "2025-2030"),
|
||||
resource.TestCheckResourceAttr(protocolResourceName, "src_ports.0", "3025-3030"),
|
||||
resource.TestCheckResourceAttr(protocolResourceName, "ip_protocol", "tcp"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecurityProtocol_Update(t *testing.T) {
|
||||
protocolResourceName := "opc_compute_security_protocol.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSecurityProtocolComplete, ri)
|
||||
config2 := fmt.Sprintf(testAccOPCSecurityProtocolUpdated, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityProtocolDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckSecurityProtocolExists,
|
||||
resource.TestCheckResourceAttr(protocolResourceName, "description", "Terraform Acceptance Test"),
|
||||
resource.TestCheckResourceAttr(protocolResourceName, "dst_ports.0", "2025-2030"),
|
||||
resource.TestCheckResourceAttr(protocolResourceName, "src_ports.0", "3025-3030"),
|
||||
resource.TestCheckResourceAttr(protocolResourceName, "ip_protocol", "tcp"),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: config2,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckSecurityProtocolExists,
|
||||
resource.TestCheckResourceAttr(protocolResourceName, "description", ""),
|
||||
resource.TestCheckResourceAttr(protocolResourceName, "dst_ports.1", "2040-2050"),
|
||||
resource.TestCheckResourceAttr(protocolResourceName, "src_ports.1", "3040-3050"),
|
||||
resource.TestCheckResourceAttr(protocolResourceName, "ip_protocol", "udp"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckSecurityProtocolExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecurityProtocols()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_security_protocol" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecurityProtocolInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetSecurityProtocol(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of Security Protocol %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckSecurityProtocolDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecurityProtocols()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_security_protocol" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecurityProtocolInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetSecurityProtocol(&input); err == nil {
|
||||
return fmt.Errorf("Security Protocol %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
const testAccOPCSecurityProtocolBasic = `
|
||||
resource "opc_compute_security_protocol" "test" {
|
||||
name = "acc-security-protocol-%d"
|
||||
description = "Terraform Acceptance Test"
|
||||
}
|
||||
`
|
||||
|
||||
const testAccOPCSecurityProtocolComplete = `
|
||||
resource "opc_compute_security_protocol" "test" {
|
||||
name = "acc-security-protocol-%d"
|
||||
description = "Terraform Acceptance Test"
|
||||
dst_ports = ["2025-2030"]
|
||||
src_ports = ["3025-3030"]
|
||||
ip_protocol = "tcp"
|
||||
}
|
||||
`
|
||||
|
||||
const testAccOPCSecurityProtocolUpdated = `
|
||||
resource "opc_compute_security_protocol" "test" {
|
||||
name = "acc-security-protocol-%d"
|
||||
dst_ports = ["2025-2030", "2040-2050"]
|
||||
src_ports = ["3025-3030", "3040-3050"]
|
||||
ip_protocol = "udp"
|
||||
}
|
||||
`
|
|
@ -1,159 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCSecurityRule_Basic(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resName := "opc_compute_security_rule.test"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityRuleDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccOPCSecurityRuleConfig_Basic(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckSecurityRuleExists,
|
||||
resource.TestCheckResourceAttr(resName, "name", fmt.Sprintf("testing-security-rule-%d", rInt)),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: testAccOPCSecurityRuleConfig_BasicUpdate(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckSecurityRuleExists,
|
||||
resource.TestCheckResourceAttr(resName, "enabled", "false"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSecurityRule_Full(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
resName := "opc_compute_security_rule.test"
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckSecurityRuleDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccOPCSecurityRuleConfig_Full(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckSecurityRuleExists,
|
||||
resource.TestCheckResourceAttr(resName, "name", fmt.Sprintf("testing-security-rule-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "acl", fmt.Sprintf("test-security-rule-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "src_vnic_set", fmt.Sprintf("test-security-rule-src-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "dst_vnic_set", fmt.Sprintf("test-security-rule-dst-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "dst_ip_address_prefixes.0", fmt.Sprintf("test-security-rule-dst-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "src_ip_address_prefixes.0", fmt.Sprintf("test-security-rule-src-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(resName, "security_protocols.0", fmt.Sprintf("test-security-rule-%d", rInt)),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckSecurityRuleExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecurityRules()
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_sec_rule" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecurityRuleInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetSecurityRule(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of Security Rule %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckSecurityRuleDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SecurityRules()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_security_rule" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSecurityRuleInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetSecurityRule(&input); err == nil {
|
||||
return fmt.Errorf("Security Rule %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccOPCSecurityRuleConfig_Basic(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_security_rule" "test" {
|
||||
name = "testing-security-rule-%d"
|
||||
description = "testing-desc-%d"
|
||||
flow_direction = "ingress"
|
||||
}`, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccOPCSecurityRuleConfig_BasicUpdate(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_security_rule" "test" {
|
||||
name = "testing-security-rule-%d"
|
||||
description = "testing-desc-%d"
|
||||
flow_direction = "egress"
|
||||
enabled = false
|
||||
}`, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccOPCSecurityRuleConfig_Full(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_acl" "test" {
|
||||
name = "test-security-rule-%d"
|
||||
}
|
||||
|
||||
resource "opc_compute_vnic_set" "src" {
|
||||
name = "test-security-rule-src-%d"
|
||||
}
|
||||
|
||||
resource "opc_compute_vnic_set" "dst" {
|
||||
name = "test-security-rule-dst-%d"
|
||||
}
|
||||
|
||||
resource "opc_compute_security_protocol" "test" {
|
||||
name = "test-security-rule-%d"
|
||||
}
|
||||
|
||||
resource "opc_compute_ip_address_prefix_set" "src" {
|
||||
name = "test-security-rule-src-%d"
|
||||
}
|
||||
|
||||
resource "opc_compute_ip_address_prefix_set" "dst" {
|
||||
name = "test-security-rule-dst-%d"
|
||||
}
|
||||
|
||||
resource "opc_compute_security_rule" "test" {
|
||||
name = "testing-security-rule-%d"
|
||||
description = "testing-desc-%d"
|
||||
flow_direction = "ingress"
|
||||
acl = "${opc_compute_acl.test.name}"
|
||||
src_vnic_set = "${opc_compute_vnic_set.src.name}"
|
||||
dst_vnic_set = "${opc_compute_vnic_set.dst.name}"
|
||||
dst_ip_address_prefixes = ["${opc_compute_ip_address_prefix_set.dst.name}"]
|
||||
src_ip_address_prefixes = ["${opc_compute_ip_address_prefix_set.src.name}"]
|
||||
security_protocols = ["${opc_compute_security_protocol.test.name}"]
|
||||
}`, rInt, rInt, rInt, rInt, rInt, rInt, rInt, rInt)
|
||||
}
|
|
@ -1,152 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCSSHKey_basic(t *testing.T) {
|
||||
ruleResourceName := "opc_compute_ssh_key.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSSHKeyBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSSHKeyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckSSHKeyExists,
|
||||
resource.TestCheckResourceAttr(ruleResourceName, "key", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Wa2OClh4LDCpR4A1x251PfzeUHvA3uo3Z4joYKIlQXP6242588bq6eh79ihm+HZAuxNoIkkS4OMIelUtiHcYSMYK7niXpato3cUdQHXjwchZjc3wwcXC/hAWK2QJkO7yLgCuYMTqyz2saZ/9zW12QS24rJH1DKFDbq4V40+HF7PQoq6G40Dp0X+slZri223pHJiqHKlyhUZuvMar7QnLZlZ7jenPyqVSpY7IC5KPj6geQSD2tSnVKjRo4TWVkIexSo6iHEu5vzcjVYGBw9RVGhmOd8pCcbB85M01MJFdbqLMjUHREE7/t767hmem3YdSPhMvnbBNPb7VSB+8ZQKn"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSSHKey_update(t *testing.T) {
|
||||
ruleResourceName := "opc_compute_ssh_key.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSSHKeyBasic, ri)
|
||||
updatedConfig := fmt.Sprintf(testAccOPCSSHKeyUpdated, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSSHKeyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckSSHKeyExists,
|
||||
resource.TestCheckResourceAttr(ruleResourceName, "key", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Wa2OClh4LDCpR4A1x251PfzeUHvA3uo3Z4joYKIlQXP6242588bq6eh79ihm+HZAuxNoIkkS4OMIelUtiHcYSMYK7niXpato3cUdQHXjwchZjc3wwcXC/hAWK2QJkO7yLgCuYMTqyz2saZ/9zW12QS24rJH1DKFDbq4V40+HF7PQoq6G40Dp0X+slZri223pHJiqHKlyhUZuvMar7QnLZlZ7jenPyqVSpY7IC5KPj6geQSD2tSnVKjRo4TWVkIexSo6iHEu5vzcjVYGBw9RVGhmOd8pCcbB85M01MJFdbqLMjUHREE7/t767hmem3YdSPhMvnbBNPb7VSB+8ZQKn"),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: updatedConfig,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckSSHKeyExists,
|
||||
resource.TestCheckResourceAttr(ruleResourceName, "key", "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDeXD/4cetIxK3a/mNbE8F0oYFOicK07Am6YyS0tV4Etak29fB2FoRwGAMETN0w7kKa8nKyvjZBH2mTkdAELoSbB70yZLNSufK7GMyLQXRG8c51xFDhTjLXZ92zSN6ZZBrnc7Z7iXCHsfAyXcrTmv9jgm3nE0QF1/AJgHXNa6GqzsyjilKkRjQBhUTqkTQylyVytPJHgM5W/v2vStfFK5wY9h9oDiHJiNACPOxE8v9A+u9MnKaq+E6AuarA0VQJbPWqVzoHWMUXL0ck+WYfZyX17VPB6c18h4Wn27lNxCEE7jaMLIVbMpAW5ICW1UVnrT6/ZoSTseJjEBlukPlZVQu7"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCSSHKey_disable(t *testing.T) {
|
||||
ruleResourceName := "opc_compute_ssh_key.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccOPCSSHKeyBasic, ri)
|
||||
updatedConfig := fmt.Sprintf(testAccOPCSSHKeyDisabled, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckSSHKeyDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckSSHKeyExists,
|
||||
resource.TestCheckResourceAttr(ruleResourceName, "enabled", "true"),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: updatedConfig,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckSSHKeyExists,
|
||||
resource.TestCheckResourceAttr(ruleResourceName, "enabled", "false"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccOPCCheckSSHKeyExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SSHKeys()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ssh_key" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSSHKeyInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetSSHKey(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of SSH Key %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccOPCCheckSSHKeyDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).SSHKeys()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_ssh_key" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetSSHKeyInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetSSHKey(&input); err == nil {
|
||||
return fmt.Errorf("SSH Key %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
const testAccOPCSSHKeyBasic = `
|
||||
resource "opc_compute_ssh_key" "test" {
|
||||
name = "acc-ssh-key-%d"
|
||||
key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Wa2OClh4LDCpR4A1x251PfzeUHvA3uo3Z4joYKIlQXP6242588bq6eh79ihm+HZAuxNoIkkS4OMIelUtiHcYSMYK7niXpato3cUdQHXjwchZjc3wwcXC/hAWK2QJkO7yLgCuYMTqyz2saZ/9zW12QS24rJH1DKFDbq4V40+HF7PQoq6G40Dp0X+slZri223pHJiqHKlyhUZuvMar7QnLZlZ7jenPyqVSpY7IC5KPj6geQSD2tSnVKjRo4TWVkIexSo6iHEu5vzcjVYGBw9RVGhmOd8pCcbB85M01MJFdbqLMjUHREE7/t767hmem3YdSPhMvnbBNPb7VSB+8ZQKn"
|
||||
enabled = true
|
||||
}
|
||||
`
|
||||
|
||||
const testAccOPCSSHKeyUpdated = `
|
||||
resource "opc_compute_ssh_key" "test" {
|
||||
name = "acc-ssh-key-%d"
|
||||
key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDeXD/4cetIxK3a/mNbE8F0oYFOicK07Am6YyS0tV4Etak29fB2FoRwGAMETN0w7kKa8nKyvjZBH2mTkdAELoSbB70yZLNSufK7GMyLQXRG8c51xFDhTjLXZ92zSN6ZZBrnc7Z7iXCHsfAyXcrTmv9jgm3nE0QF1/AJgHXNa6GqzsyjilKkRjQBhUTqkTQylyVytPJHgM5W/v2vStfFK5wY9h9oDiHJiNACPOxE8v9A+u9MnKaq+E6AuarA0VQJbPWqVzoHWMUXL0ck+WYfZyX17VPB6c18h4Wn27lNxCEE7jaMLIVbMpAW5ICW1UVnrT6/ZoSTseJjEBlukPlZVQu7"
|
||||
enabled = true
|
||||
}
|
||||
`
|
||||
|
||||
const testAccOPCSSHKeyDisabled = `
|
||||
resource "opc_compute_ssh_key" "test" {
|
||||
name = "acc-ssh-key-%d"
|
||||
key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7Wa2OClh4LDCpR4A1x251PfzeUHvA3uo3Z4joYKIlQXP6242588bq6eh79ihm+HZAuxNoIkkS4OMIelUtiHcYSMYK7niXpato3cUdQHXjwchZjc3wwcXC/hAWK2QJkO7yLgCuYMTqyz2saZ/9zW12QS24rJH1DKFDbq4V40+HF7PQoq6G40Dp0X+slZri223pHJiqHKlyhUZuvMar7QnLZlZ7jenPyqVSpY7IC5KPj6geQSD2tSnVKjRo4TWVkIexSo6iHEu5vzcjVYGBw9RVGhmOd8pCcbB85M01MJFdbqLMjUHREE7/t767hmem3YdSPhMvnbBNPb7VSB+8ZQKn"
|
||||
enabled = false
|
||||
}
|
||||
`
|
|
@ -1,88 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCStorageVolumeSnapshot_basic(t *testing.T) {
|
||||
snapshotName := "opc_compute_storage_volume_snapshot.test"
|
||||
rInt := acctest.RandInt()
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(snapshotName, testAccCheckStorageVolumeSnapshotDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccStorageVolumeSnapshot_basic(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(opcResourceCheck(snapshotName, testAccCheckStorageVolumeSnapshotExists),
|
||||
resource.TestCheckResourceAttr(snapshotName, "name", fmt.Sprintf("test-acc-stor-vol-%d", rInt)),
|
||||
resource.TestCheckResourceAttr(snapshotName, "parent_volume_bootable", "false"),
|
||||
resource.TestCheckResourceAttr(snapshotName, "collocated", "true"),
|
||||
resource.TestCheckResourceAttr(snapshotName, "size", "5"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckStorageVolumeSnapshotExists(state *OPCResourceState) error {
|
||||
client := state.Client.StorageVolumeSnapshots()
|
||||
snapshotName := state.Attributes["name"]
|
||||
|
||||
input := &compute.GetStorageVolumeSnapshotInput{
|
||||
Name: snapshotName,
|
||||
}
|
||||
|
||||
info, err := client.GetStorageVolumeSnapshot(input)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error retrieving state of snapshot '%s': %v", snapshotName, err)
|
||||
}
|
||||
|
||||
if info == nil {
|
||||
return fmt.Errorf("No info found for snapshot '%s'", snapshotName)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckStorageVolumeSnapshotDestroyed(state *OPCResourceState) error {
|
||||
client := state.Client.StorageVolumeSnapshots()
|
||||
snapshotName := state.Attributes["name"]
|
||||
|
||||
input := &compute.GetStorageVolumeSnapshotInput{
|
||||
Name: snapshotName,
|
||||
}
|
||||
info, err := client.GetStorageVolumeSnapshot(input)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error retrieving state of snapshot '%s': %v", snapshotName, err)
|
||||
}
|
||||
|
||||
if info != nil {
|
||||
return fmt.Errorf("Snapshot '%s' still exists", snapshotName)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccStorageVolumeSnapshot_basic(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_storage_volume" "foo" {
|
||||
name = "test-acc-stor-vol-%d"
|
||||
description = "testAccStorageVolumeSnapshot_basic"
|
||||
size = 5
|
||||
}
|
||||
|
||||
resource "opc_compute_storage_volume_snapshot" "test" {
|
||||
name = "test-acc-stor-vol-%d"
|
||||
description = "storage volume snapshot"
|
||||
collocated = true
|
||||
volume_name = "${opc_compute_storage_volume.foo.name}"
|
||||
}
|
||||
`, rInt, rInt)
|
||||
}
|
|
@ -1,333 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccOPCStorageVolume_Basic(t *testing.T) {
|
||||
volumeResourceName := "opc_compute_storage_volume.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccStorageVolumeBasic, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeExists),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_Complete(t *testing.T) {
|
||||
volumeResourceName := "opc_compute_storage_volume.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccStorageVolumeComplete, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeExists),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_MaxSize(t *testing.T) {
|
||||
volumeResourceName := "opc_compute_storage_volume.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccStorageVolumeBasicMaxSize, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeExists),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_Update(t *testing.T) {
|
||||
volumeResourceName := "opc_compute_storage_volume.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccStorageVolumeComplete, ri)
|
||||
updatedConfig := fmt.Sprintf(testAccStorageVolumeUpdated, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeExists),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: updatedConfig,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeExists),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_Bootable(t *testing.T) {
|
||||
volumeResourceName := "opc_compute_storage_volume.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccStorageVolumeBootable, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeExists),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_ImageListEntry(t *testing.T) {
|
||||
volumeResourceName := "opc_compute_storage_volume.test"
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccStorageVolumeImageListEntry, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: config,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeExists),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_LowLatency(t *testing.T) {
|
||||
volumeResourceName := "opc_compute_storage_volume.test"
|
||||
rInt := acctest.RandInt()
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccStorageVolumeLowLatency(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeExists),
|
||||
resource.TestCheckResourceAttr(volumeResourceName, "storage_type", "/oracle/public/storage/latency"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccOPCStorageVolume_FromSnapshot(t *testing.T) {
|
||||
volumeResourceName := "opc_compute_storage_volume.test"
|
||||
rInt := acctest.RandInt()
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() {
|
||||
testAccPreCheck(t)
|
||||
},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeDestroyed),
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccStorageVolumeFromSnapshot(rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
opcResourceCheck(volumeResourceName, testAccCheckStorageVolumeExists),
|
||||
resource.TestCheckResourceAttr(volumeResourceName, "name", fmt.Sprintf("test-acc-stor-vol-final-%d", rInt)),
|
||||
resource.TestCheckResourceAttrSet(volumeResourceName, "snapshot"),
|
||||
resource.TestCheckResourceAttrSet(volumeResourceName, "snapshot_id"),
|
||||
resource.TestCheckResourceAttr(volumeResourceName, "size", "5"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccCheckStorageVolumeExists(state *OPCResourceState) error {
|
||||
sv := state.Client.StorageVolumes()
|
||||
volumeName := state.Attributes["name"]
|
||||
|
||||
input := compute.GetStorageVolumeInput{
|
||||
Name: volumeName,
|
||||
}
|
||||
info, err := sv.GetStorageVolume(&input)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error retrieving state of volume %s: %s", volumeName, err)
|
||||
}
|
||||
|
||||
if info == nil {
|
||||
return fmt.Errorf("No info found for volume %s", volumeName)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccCheckStorageVolumeDestroyed(state *OPCResourceState) error {
|
||||
sv := state.Client.StorageVolumes()
|
||||
|
||||
volumeName := state.Attributes["name"]
|
||||
|
||||
input := compute.GetStorageVolumeInput{
|
||||
Name: volumeName,
|
||||
}
|
||||
info, err := sv.GetStorageVolume(&input)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error retrieving state of volume %s: %s", volumeName, err)
|
||||
}
|
||||
|
||||
if info != nil {
|
||||
return fmt.Errorf("Volume %s still exists", volumeName)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
const testAccStorageVolumeBasic = `
|
||||
resource "opc_compute_storage_volume" "test" {
|
||||
name = "test-acc-stor-vol-%d"
|
||||
size = 1
|
||||
}
|
||||
`
|
||||
|
||||
const testAccStorageVolumeComplete = `
|
||||
resource "opc_compute_storage_volume" "test" {
|
||||
name = "test-acc-stor-vol-%d"
|
||||
description = "Provider Acceptance Tests Storage Volume Initial"
|
||||
size = 2
|
||||
tags = ["foo"]
|
||||
}
|
||||
`
|
||||
|
||||
const testAccStorageVolumeUpdated = `
|
||||
resource "opc_compute_storage_volume" "test" {
|
||||
name = "test-acc-stor-vol-%d"
|
||||
description = "Provider Acceptance Tests Storage Volume Updated"
|
||||
size = 2
|
||||
tags = ["bar", "foo"]
|
||||
}
|
||||
`
|
||||
|
||||
const testAccStorageVolumeBootable = `
|
||||
resource "opc_compute_image_list" "test" {
|
||||
name = "test-acc-stor-vol-bootable-image-list-%d"
|
||||
description = "Provider Acceptance Tests Storage Volume Bootable"
|
||||
}
|
||||
|
||||
resource "opc_compute_image_list_entry" "test" {
|
||||
name = "${opc_compute_image_list.test.name}"
|
||||
machine_images = [ "/oracle/public/oel_6.7_apaas_16.4.5_1610211300" ]
|
||||
version = 1
|
||||
}
|
||||
|
||||
resource "opc_compute_storage_volume" "test" {
|
||||
name = "test-acc-stor-vol-bootable-%d"
|
||||
description = "Provider Acceptance Tests Storage Volume Bootable"
|
||||
size = 20
|
||||
tags = ["bar", "foo"]
|
||||
bootable = true
|
||||
image_list = "${opc_compute_image_list.test.name}"
|
||||
image_list_entry = "${opc_compute_image_list_entry.test.version}"
|
||||
}
|
||||
`
|
||||
|
||||
const testAccStorageVolumeImageListEntry = `
|
||||
resource "opc_compute_image_list" "test" {
|
||||
name = "test-acc-stor-vol-bootable-image-list-%d"
|
||||
description = "Provider Acceptance Tests Storage Volume Image List Entry"
|
||||
}
|
||||
|
||||
resource "opc_compute_image_list_entry" "test" {
|
||||
name = "${opc_compute_image_list.test.name}"
|
||||
machine_images = [ "/oracle/public/oel_6.7_apaas_16.4.5_1610211300" ]
|
||||
version = 1
|
||||
}
|
||||
|
||||
resource "opc_compute_storage_volume" "test" {
|
||||
name = "test-acc-stor-vol-image-list-entry-%d"
|
||||
description = "Provider Acceptance Tests Storage Volume Image List Entry"
|
||||
size = 20
|
||||
tags = ["bar", "foo"]
|
||||
image_list_entry = "${opc_compute_image_list_entry.test.version}"
|
||||
}
|
||||
`
|
||||
|
||||
const testAccStorageVolumeBasicMaxSize = `
|
||||
resource "opc_compute_storage_volume" "test" {
|
||||
name = "test-acc-stor-vol-%d"
|
||||
description = "Provider Acceptance Tests Storage Volume Max Size"
|
||||
size = 2048
|
||||
}
|
||||
`
|
||||
|
||||
func testAccStorageVolumeFromSnapshot(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
// Initial Storage Volume to create snapshot with
|
||||
resource "opc_compute_storage_volume" "foo" {
|
||||
name = "test-acc-stor-vol-%d"
|
||||
description = "Acc Test intermediary storage volume for snapshot"
|
||||
size = 5
|
||||
}
|
||||
|
||||
resource "opc_compute_storage_volume_snapshot" "foo" {
|
||||
description = "testing-acc"
|
||||
name = "test-acc-stor-snapshot-%d"
|
||||
collocated = true
|
||||
volume_name = "${opc_compute_storage_volume.foo.name}"
|
||||
}
|
||||
|
||||
// Create storage volume from snapshot
|
||||
resource "opc_compute_storage_volume" "test" {
|
||||
name = "test-acc-stor-vol-final-%d"
|
||||
description = "storage volume from snapshot"
|
||||
size = 5
|
||||
snapshot_id = "${opc_compute_storage_volume_snapshot.foo.snapshot_id}"
|
||||
}`, rInt, rInt, rInt)
|
||||
}
|
||||
|
||||
func testAccStorageVolumeLowLatency(rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_storage_volume" "test" {
|
||||
name = "test-acc-stor-vol-ll-%d"
|
||||
description = "Acc Test Storage Volume Low Latency"
|
||||
storage_type = "/oracle/public/storage/latency"
|
||||
size = 5
|
||||
}`, rInt)
|
||||
}
|
|
@ -1,203 +0,0 @@
|
|||
package opc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-oracle-terraform/compute"
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
)
|
||||
|
||||
func TestAccOPCVNICSet_Basic(t *testing.T) {
|
||||
rInt := acctest.RandInt()
|
||||
rName := fmt.Sprintf("testing-acc-%d", rInt)
|
||||
rDesc := fmt.Sprintf("acctesting vnic set %d", rInt)
|
||||
resourceName := "opc_compute_vnic_set.test"
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccOPCCheckVNICSetDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
{
|
||||
Config: testAccVnicSetBasic(rName, rDesc, rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckVNICSetExists,
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "name", rName),
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "description", rDesc),
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "tags.#", "2"),
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "virtual_nics.#", "2"),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: testAccVnicSetBasic_Update(rName, rDesc, rInt),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccOPCCheckVNICSetExists,
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "name", rName),
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "description", fmt.Sprintf("%s-updated", rDesc)),
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "tags.#", "1"),
|
||||
resource.TestCheckResourceAttr(
|
||||
resourceName, "virtual_nics.#", "2"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func testAccOPCCheckVNICSetExists(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).VirtNICSets()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_vnic_set" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetVirtualNICSetInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if _, err := client.GetVirtualNICSet(&input); err != nil {
|
||||
return fmt.Errorf("Error retrieving state of VNIC Set %s: %s", input.Name, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccOPCCheckVNICSetDestroy(s *terraform.State) error {
|
||||
client := testAccProvider.Meta().(*compute.Client).VirtNICSets()
|
||||
|
||||
for _, rs := range s.RootModule().Resources {
|
||||
if rs.Type != "opc_compute_vnic_set" {
|
||||
continue
|
||||
}
|
||||
|
||||
input := compute.GetVirtualNICSetInput{
|
||||
Name: rs.Primary.Attributes["name"],
|
||||
}
|
||||
if info, err := client.GetVirtualNICSet(&input); err == nil {
|
||||
return fmt.Errorf("VNIC Set %s still exists: %#v", input.Name, info)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func testAccVnicSetBasic(rName, rDesc string, rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_network" "foo" {
|
||||
name = "testing-vnic-set-%d"
|
||||
description = "testing-vnic-set"
|
||||
ip_address_prefix = "10.1.14.0/24"
|
||||
}
|
||||
|
||||
resource "opc_compute_ip_network" "bar" {
|
||||
name = "testing-vnic-set2-%d"
|
||||
description = "testing-vnic-set2"
|
||||
ip_address_prefix = "10.1.15.0/24"
|
||||
}
|
||||
|
||||
resource "opc_compute_instance" "foo" {
|
||||
name = "test-vnic-set-%d"
|
||||
label = "testing"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
networking_info {
|
||||
index = 0
|
||||
ip_network = "${opc_compute_ip_network.foo.id}"
|
||||
vnic = "test-vnic-set-%d"
|
||||
shared_network = false
|
||||
}
|
||||
networking_info {
|
||||
index = 1
|
||||
ip_network = "${opc_compute_ip_network.bar.id}"
|
||||
vnic = "test-vnic-set2-%d"
|
||||
shared_network = false
|
||||
}
|
||||
}
|
||||
|
||||
data "opc_compute_network_interface" "foo" {
|
||||
instance_name = "${opc_compute_instance.foo.name}"
|
||||
instance_id = "${opc_compute_instance.foo.id}"
|
||||
interface = "eth0"
|
||||
}
|
||||
|
||||
data "opc_compute_network_interface" "bar" {
|
||||
instance_name = "${opc_compute_instance.foo.name}"
|
||||
instance_id = "${opc_compute_instance.foo.id}"
|
||||
interface = "eth1"
|
||||
}
|
||||
|
||||
resource "opc_compute_vnic_set" "test" {
|
||||
name = "%s"
|
||||
description = "%s"
|
||||
tags = ["tag1", "tag2"]
|
||||
virtual_nics = [
|
||||
"${data.opc_compute_network_interface.foo.vnic}",
|
||||
"${data.opc_compute_network_interface.bar.vnic}",
|
||||
]
|
||||
}`, rInt, rInt, rInt, rInt, rInt, rName, rDesc)
|
||||
}
|
||||
|
||||
func testAccVnicSetBasic_Update(rName, rDesc string, rInt int) string {
|
||||
return fmt.Sprintf(`
|
||||
resource "opc_compute_ip_network" "foo" {
|
||||
name = "testing-vnic-set-%d"
|
||||
description = "testing-vnic-set"
|
||||
ip_address_prefix = "10.1.14.0/24"
|
||||
}
|
||||
|
||||
resource "opc_compute_ip_network" "bar" {
|
||||
name = "testing-vnic-set2-%d"
|
||||
description = "testing-vnic-set2"
|
||||
ip_address_prefix = "10.1.15.0/24"
|
||||
}
|
||||
|
||||
resource "opc_compute_instance" "foo" {
|
||||
name = "test-vnic-set-%d"
|
||||
label = "testing"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
networking_info {
|
||||
index = 0
|
||||
ip_network = "${opc_compute_ip_network.foo.id}"
|
||||
vnic = "test-vnic-set-%d"
|
||||
shared_network = false
|
||||
}
|
||||
networking_info {
|
||||
index = 1
|
||||
ip_network = "${opc_compute_ip_network.bar.id}"
|
||||
vnic = "test-vnic-set2-%d"
|
||||
shared_network = false
|
||||
}
|
||||
}
|
||||
|
||||
data "opc_compute_network_interface" "foo" {
|
||||
instance_name = "${opc_compute_instance.foo.name}"
|
||||
instance_id = "${opc_compute_instance.foo.id}"
|
||||
interface = "eth0"
|
||||
}
|
||||
|
||||
data "opc_compute_network_interface" "bar" {
|
||||
instance_name = "${opc_compute_instance.foo.name}"
|
||||
instance_id = "${opc_compute_instance.foo.id}"
|
||||
interface = "eth1"
|
||||
}
|
||||
|
||||
resource "opc_compute_vnic_set" "test" {
|
||||
name = "%s"
|
||||
description = "%s-updated"
|
||||
tags = ["tag1"]
|
||||
virtual_nics = [
|
||||
"${data.opc_compute_network_interface.foo.vnic}",
|
||||
"${data.opc_compute_network_interface.bar.vnic}",
|
||||
]
|
||||
}`, rInt, rInt, rInt, rInt, rInt, rName, rDesc)
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
package opc
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestValidateIPPrefixCIDR(t *testing.T) {
|
||||
validPrefixes := []string{
|
||||
"10.0.1.0/24",
|
||||
"10.1.0.0/16",
|
||||
"192.168.0.1/32",
|
||||
"10.20.0.0/18",
|
||||
"10.0.12.0/24",
|
||||
}
|
||||
|
||||
for _, v := range validPrefixes {
|
||||
_, errors := validateIPPrefixCIDR(v, "prefix")
|
||||
if len(errors) != 0 {
|
||||
t.Fatalf("%q should be a valid IP Address Prefix: %q", v, errors)
|
||||
}
|
||||
}
|
||||
|
||||
invalidPrefixes := []string{
|
||||
"10.0.0.1/35",
|
||||
"192.168.1.256/16",
|
||||
"256.0.1/16",
|
||||
}
|
||||
|
||||
for _, v := range invalidPrefixes {
|
||||
_, errors := validateIPPrefixCIDR(v, "prefix")
|
||||
if len(errors) == 0 {
|
||||
t.Fatalf("%q should not be a valid IP Address", v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateAdminDistance(t *testing.T) {
|
||||
validDistances := []int{
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
}
|
||||
|
||||
for _, v := range validDistances {
|
||||
_, errors := validateAdminDistance(v, "distance")
|
||||
if len(errors) != 0 {
|
||||
t.Fatalf("%q should be a valid Admin Distance: %q", v, errors)
|
||||
}
|
||||
}
|
||||
|
||||
invalidDistances := []int{
|
||||
-1,
|
||||
4,
|
||||
3,
|
||||
42,
|
||||
}
|
||||
|
||||
for _, v := range invalidDistances {
|
||||
_, errors := validateAdminDistance(v, "distance")
|
||||
if len(errors) == 0 {
|
||||
t.Fatalf("%q should not be a valid Admin Distance", v)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateIPProtocol(t *testing.T) {
|
||||
validProtocols := []string{
|
||||
"all",
|
||||
"ah",
|
||||
"esp",
|
||||
"icmp",
|
||||
"icmpv6",
|
||||
"igmp",
|
||||
"ipip",
|
||||
"gre",
|
||||
"mplsip",
|
||||
"ospf",
|
||||
"pim",
|
||||
"rdp",
|
||||
"sctp",
|
||||
"tcp",
|
||||
"udp",
|
||||
}
|
||||
|
||||
for _, v := range validProtocols {
|
||||
_, errors := validateIPProtocol(v, "ip_protocol")
|
||||
if len(errors) != 0 {
|
||||
t.Fatalf("%q should be a valid Admin Distance: %q", v, errors)
|
||||
}
|
||||
}
|
||||
|
||||
invalidProtocols := []string{
|
||||
"bad",
|
||||
"real bad",
|
||||
"are you even trying at this point?",
|
||||
}
|
||||
for _, v := range invalidProtocols {
|
||||
_, errors := validateIPProtocol(v, "ip_protocol")
|
||||
if len(errors) == 0 {
|
||||
t.Fatalf("%q should not be a valid IP Protocol", v)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -50,7 +50,6 @@ import (
|
|||
ns1provider "github.com/hashicorp/terraform/builtin/providers/ns1"
|
||||
nullprovider "github.com/hashicorp/terraform/builtin/providers/null"
|
||||
oneandoneprovider "github.com/hashicorp/terraform/builtin/providers/oneandone"
|
||||
opcprovider "github.com/hashicorp/terraform/builtin/providers/opc"
|
||||
openstackprovider "github.com/hashicorp/terraform/builtin/providers/openstack"
|
||||
opsgenieprovider "github.com/hashicorp/terraform/builtin/providers/opsgenie"
|
||||
ovhprovider "github.com/hashicorp/terraform/builtin/providers/ovh"
|
||||
|
@ -83,6 +82,9 @@ import (
|
|||
"github.com/hashicorp/terraform/plugin"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
|
||||
//New Provider Builds
|
||||
opcprovider "github.com/hashicorp/terraform-provider-opc/opc"
|
||||
|
||||
// Legacy, will remove once it conforms with new structure
|
||||
chefprovisioner "github.com/hashicorp/terraform/builtin/provisioners/chef"
|
||||
)
|
||||
|
@ -132,7 +134,6 @@ var InternalProviders = map[string]plugin.ProviderFunc{
|
|||
"ns1": ns1provider.Provider,
|
||||
"null": nullprovider.Provider,
|
||||
"oneandone": oneandoneprovider.Provider,
|
||||
"opc": opcprovider.Provider,
|
||||
"openstack": openstackprovider.Provider,
|
||||
"opsgenie": opsgenieprovider.Provider,
|
||||
"ovh": ovhprovider.Provider,
|
||||
|
@ -170,4 +171,7 @@ func init() {
|
|||
// Legacy provisioners that don't match our heuristics for auto-finding
|
||||
// built-in provisioners.
|
||||
InternalProvisioners["chef"] = func() terraform.ResourceProvisioner { return new(chefprovisioner.ResourceProvisioner) }
|
||||
|
||||
// New Provider Layouts
|
||||
InternalProviders["opc"] = func() terraform.ResourceProvider { return opcprovider.Provider() }
|
||||
}
|
||||
|
|
|
@ -271,6 +271,9 @@ IMPORTS
|
|||
"github.com/hashicorp/terraform/plugin"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
|
||||
//New Provider Builds
|
||||
opcprovider "github.com/hashicorp/terraform-provider-opc/opc"
|
||||
|
||||
// Legacy, will remove once it conforms with new structure
|
||||
chefprovisioner "github.com/hashicorp/terraform/builtin/provisioners/chef"
|
||||
)
|
||||
|
@ -287,6 +290,9 @@ func init() {
|
|||
// Legacy provisioners that don't match our heuristics for auto-finding
|
||||
// built-in provisioners.
|
||||
InternalProvisioners["chef"] = func() terraform.ResourceProvisioner { return new(chefprovisioner.ResourceProvisioner) }
|
||||
|
||||
// New Provider Layouts
|
||||
InternalProviders["opc"] = func() terraform.ResourceProvider { return opcprovider.Provider() }
|
||||
}
|
||||
|
||||
`
|
||||
|
|
|
@ -0,0 +1,373 @@
|
|||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
|
@ -92,7 +92,6 @@ func resourceOPCIPAddressReservationRead(d *schema.ResourceData, meta interface{
|
|||
d.Set("name", result.Name)
|
||||
d.Set("description", result.Description)
|
||||
d.Set("ip_address_pool", result.IPAddressPool)
|
||||
d.Set("ip_address", result.IPAddress)
|
||||
d.Set("uri", result.Uri)
|
||||
|
||||
if err := setStringList(d, "tags", result.Tags); err != nil {
|
|
@ -2197,6 +2197,12 @@
|
|||
"revision": "19f2c401e122352c047a84d6584dd51e2fb8fcc4",
|
||||
"revisionTime": "2017-03-08T19:39:51Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "hLWb02UbO5qsAjY/ybjHn/hpTII=",
|
||||
"path": "github.com/hashicorp/terraform-provider-opc/opc",
|
||||
"revision": "6460e4eec5cffcc804fe9911860df0c13c5d945f",
|
||||
"revisionTime": "2017-05-10T18:47:02Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "2fkVZIzvxIGBLhSiVnkTgGiqpQ4=",
|
||||
"path": "github.com/hashicorp/vault/api",
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_network_interface"
|
||||
sidebar_current: "docs-opc-datasource-network-interface"
|
||||
description: |-
|
||||
Gets information about the configuration of an instance's network interface
|
||||
---
|
||||
|
||||
# opc\_compute\_network\_interface
|
||||
|
||||
Use this data source to access the configuration of an instance's network interface
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
data "opc_compute_network_interface" "foo" {
|
||||
instance_id = "${opc_compute_instance.my_instance.id}"
|
||||
instance_name = "${opc_compute_instance.my_instance.name}"
|
||||
interface = "eth0"
|
||||
}
|
||||
|
||||
output "mac_address" {
|
||||
value = "${data.opc_compute_network_interface.foo.mac_address}"
|
||||
}
|
||||
|
||||
output "vnic" {
|
||||
value = "${data.opc_compute_network_interface.foo.vnic}"
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
* `instance_name` is the name of the instance.
|
||||
* `instance_id` is the id of the instance.
|
||||
* `interface` is the name of the attached interface. `eth0`, `eth1`, ... `eth9`.
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
* `dns` - Array of DNS servers for the interface.
|
||||
* `ip_address` - IP Address assigned to the interface.
|
||||
* `ip_network` - The IP Network assigned to the interface.
|
||||
* `mac_address` - The MAC address of the interface.
|
||||
* `model` - The model of the NIC card used.
|
||||
* `name_servers` - Array of name servers for the interface.
|
||||
* `nat` - The IP Reservation (in IP Networks) associated with the interface.
|
||||
* `search_domains` - The search domains that are sent through DHCP as option 119.
|
||||
* `sec_lists` - The security lists the interface is added to.
|
||||
* `shared_network` - Whether or not the interface is inside the Shared Network or an IP Network.
|
||||
* `vnic` - The name of the vNIC created for the IP Network.
|
||||
* `vnic_sets` - The array of vNIC Sets the interface was added to.
|
|
@ -1,38 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_vnic"
|
||||
sidebar_current: "docs-opc-datasource-vnic"
|
||||
description: |-
|
||||
Gets information about the configuration of a Virtual NIC.
|
||||
---
|
||||
|
||||
# opc\_compute\_vnic
|
||||
|
||||
Use this data source to access the configuration of a Virtual NIC.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
data "opc_compute_vnic" "current" {
|
||||
name = "my_vnic_name"
|
||||
}
|
||||
|
||||
output "mac_address" {
|
||||
value = "${data.opc_compute_vnic.current.mac_address}"
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
* `name` is the name of the Virtual NIC.
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
* `description` is a description of the Virtual NIC.
|
||||
|
||||
* `mac_address` is the MAC Address of the Virtual NIC.
|
||||
|
||||
* `tags` is a list of Tags associated with the Virtual NIC.
|
||||
|
||||
* `transit_flag` is `true` if the Virtual NIC is of the type `transit`.
|
||||
|
||||
* `uri` is the Unique Resource Locator of the Virtual NIC.
|
|
@ -1,54 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Provider: Oracle Public Cloud"
|
||||
sidebar_current: "docs-opc-index"
|
||||
description: |-
|
||||
The Oracle Public Cloud provider is used to interact with the many resources supported by the Oracle Public Cloud. The provider needs to be configured with credentials for the Oracle Public Cloud API.
|
||||
---
|
||||
|
||||
# Oracle Public Cloud Provider
|
||||
|
||||
The Oracle Public Cloud provider is used to interact with the many resources supported by the Oracle Public Cloud. The provider needs to be configured with credentials for the Oracle Public Cloud API.
|
||||
|
||||
Use the navigation to the left to read about the available resources.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
# Configure the Oracle Public Cloud
|
||||
provider "opc" {
|
||||
user = "..."
|
||||
password = "..."
|
||||
identity_domain = "..."
|
||||
endpoint = "..."
|
||||
}
|
||||
|
||||
# Create an IP Reservation
|
||||
resource "opc_compute_ip_reservation" "production" {
|
||||
parent_pool = "/oracle/public/ippool"
|
||||
permanent = true
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `user` - (Optional) The username to use, generally your email address. It can also
|
||||
be sourced from the `OPC_USERNAME` environment variable.
|
||||
|
||||
* `password` - (Optional) The password associated with the username to use. It can also be sourced from
|
||||
the `OPC_PASSWORD` environment variable.
|
||||
|
||||
* `identity_domain` - (Optional) The identity domain to use. It can also be sourced from
|
||||
the `OPC_IDENTITY_DOMAIN` environment variable.
|
||||
|
||||
* `endpoint` - (Optional) The API endpoint to use, associated with your Oracle Public Cloud account. This is known as the `REST Endpoint` within the Oracle portal. It can also be sourced from the `OPC_ENDPOINT` environment variable.
|
||||
|
||||
* `max_retry_timeout` - (Optional) The maximum number of seconds to wait for a successful response when operating on resources within Oracle Public Cloud. It can also be sourced from the `OPC_MAX_RETRY_TIMEOUT` environment variable. Defaults to 3000 seconds.
|
||||
|
||||
## Testing
|
||||
|
||||
Credentials must be provided via the `OPC_USERNAME`, `OPC_PASSWORD`,
|
||||
`OPC_IDENTITY_DOMAIN` and `OPC_ENDPOINT` environment variables in order to run
|
||||
acceptance tests.
|
|
@ -1,45 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_acl"
|
||||
sidebar_current: "docs-opc-resource-acl"
|
||||
description: |-
|
||||
Creates and manages an ACL in an OPC identity domain.
|
||||
---
|
||||
|
||||
# opc\_compute\_acl
|
||||
|
||||
The ``opc_compute_acl`` resource creates and manages an ACL in an OPC identity domain.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_acl" "default" {
|
||||
name = "ACL1"
|
||||
description = "This is a description for an acl"
|
||||
tags = ["tag1", "tag2"]
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) The name of the ACL.
|
||||
|
||||
* `enabled` - (Optional) Enables or disables the ACL. Set to true by default.
|
||||
|
||||
* `description` - (Optional) A description of the ACL.
|
||||
|
||||
* `tags` - (Optional) List of tags that may be applied to the ACL.
|
||||
|
||||
In addition to the above, the following values are exported:
|
||||
|
||||
* `uri` - The Uniform Resource Identifier for the ACL
|
||||
|
||||
## Import
|
||||
|
||||
ACL's can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_acl.acl1 example
|
||||
```
|
|
@ -1,39 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_image_list"
|
||||
sidebar_current: "docs-opc-resource-image-list-type"
|
||||
description: |-
|
||||
Creates and manages an Image List in an OPC identity domain.
|
||||
---
|
||||
|
||||
# opc\_compute\_image\_list
|
||||
|
||||
The ``opc_compute_image_list`` resource creates and manages an Image List in an OPC identity domain.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_image_list" "test" {
|
||||
name = "imagelist1"
|
||||
description = "This is a description of the Image List"
|
||||
default = 21
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) The name of the Image List.
|
||||
|
||||
* `description` - (Required) A description of the Image List.
|
||||
|
||||
* `default` - (Required) The image list entry to be used, by default, when launching instances using this image list. Defaults to `1`.
|
||||
|
||||
## Import
|
||||
|
||||
Image List's can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_image_list.imagelist1 example
|
||||
```
|
|
@ -1,58 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_image_list_entry"
|
||||
sidebar_current: "docs-opc-resource-image-list-entry"
|
||||
description: |-
|
||||
Creates and manages an Image List Entry in an OPC identity domain.
|
||||
---
|
||||
|
||||
# opc\_compute\_image\_list_entry
|
||||
|
||||
The ``opc_compute_image_list_entry`` resource creates and manages an Image List Entry in an OPC identity domain.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_image_list" "test" {
|
||||
name = "imagelist1"
|
||||
description = "This is a description of the Image List"
|
||||
default = 21
|
||||
}
|
||||
|
||||
resource "opc_compute_image_list_entry" "test" {
|
||||
name = "${opc_compute_image_list.test.name}"
|
||||
machine_images = [ "/oracle/public/oel_6.7_apaas_16.4.5_1610211300" ]
|
||||
version = 1
|
||||
attributes = <<JSON
|
||||
{
|
||||
"foo": "bar"
|
||||
}
|
||||
JSON
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) The name of the Image List.
|
||||
|
||||
* `machine_images` - (Required) An array of machine images.
|
||||
|
||||
* `version` - (Required) The unique version of the image list entry, as an integer.
|
||||
|
||||
* `attributes` - (Optional) JSON String of optional data that will be passed to an instance of this machine image when it is launched.
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
In addition to the above arguments, the following attributes are exported
|
||||
|
||||
* `uri` - The Unique Resource Identifier for the Image List Entry.
|
||||
|
||||
## Import
|
||||
|
||||
Image List's can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_image_list_entry.entry1 example
|
||||
```
|
|
@ -1,198 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_instance"
|
||||
sidebar_current: "docs-opc-resource-instance"
|
||||
description: |-
|
||||
Creates and manages an instance in an OPC identity domain.
|
||||
---
|
||||
|
||||
# opc\_compute\_instance
|
||||
|
||||
The ``opc_compute_instance`` resource creates and manages an instance in an OPC identity domain.
|
||||
|
||||
~> **Caution:** The ``opc_compute_instance`` resource can completely delete your
|
||||
instance just as easily as it can create it. To avoid costly accidents,
|
||||
consider setting
|
||||
[``prevent_destroy``](/docs/configuration/resources.html#prevent_destroy)
|
||||
on your instance resources as an extra safety measure.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_ip_network" "test" {
|
||||
name = "internal-network"
|
||||
description = "Terraform Provisioned Internal Network"
|
||||
ip_address_prefix = "10.0.1.0/24"
|
||||
public_napt_enabled = false
|
||||
}
|
||||
|
||||
resource "opc_compute_storage_volume" "test" {
|
||||
name = "internal"
|
||||
size = 100
|
||||
}
|
||||
|
||||
resource "opc_compute_instance" "test" {
|
||||
name = "instance1"
|
||||
label = "Terraform Provisioned Instance"
|
||||
shape = "oc3"
|
||||
image_list = "/oracle/public/oel_6.7_apaas_16.4.5_1610211300"
|
||||
|
||||
storage {
|
||||
volume = "${opc_compute_storage_volume.test.name}"
|
||||
index = 1
|
||||
}
|
||||
|
||||
networking_info {
|
||||
index = 0
|
||||
nat = ["ippool:/oracle/public/ippool"]
|
||||
shared_network = true
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) The name of the instance.
|
||||
|
||||
* `shape` - (Required) The shape of the instance, e.g. `oc4`.
|
||||
|
||||
* `instance_attributes` - (Optional) A JSON string of custom attributes. See [Attributes](#attributes) below for more information.
|
||||
|
||||
* `boot_order` - (Optional) The index number of the bootable storage volume, presented as a list, that should be used to boot the instance. The only valid value is `[1]`. If you set this attribute, you must also specify a bootable storage volume with index number 1 in the volume sub-parameter of storage_attachments. When you specify boot_order, you don't need to specify the imagelist attribute, because the instance is booted using the image on the specified bootable storage volume. If you specify both boot_order and imagelist, the imagelist attribute is ignored.
|
||||
|
||||
* `hostname` - (Optional) The host name assigned to the instance. On an Oracle Linux instance, this host name is displayed in response to the hostname command. Only relative DNS is supported. The domain name is suffixed to the host name that you specify. The host name must not end with a period. If you don't specify a host name, then a name is generated automatically.
|
||||
|
||||
* `image_list` - (Optional) The imageList of the instance, e.g. `/oracle/public/oel_6.4_2GB_v1`.
|
||||
|
||||
* `label` - (Optional) The label to apply to the instance.
|
||||
|
||||
* `networking_info` - (Optional) Information pertaining to an individual network interface to be created and attached to the instance. See [Networking Info](#networking-info) below for more information.
|
||||
|
||||
* `storage` - (Optional) Information pertaining to an individual storage attachment to be created during instance creation. Please see [Storage Attachments](#storage-attachments) below for more information.
|
||||
|
||||
* `reverse_dns` - (Optional) If set to `true` (default), then reverse DNS records are created. If set to `false`, no reverse DNS records are created.
|
||||
|
||||
* `ssh_keys` - (Optional) A list of the names of the SSH Keys that can be used to log into the instance.
|
||||
|
||||
* `tags` - (Optional) A list of strings that should be supplied to the instance as tags.
|
||||
|
||||
## Attributes
|
||||
|
||||
During instance creation, there are several custom attributes that a user may wish to make available to the instance during instance creation.
|
||||
These attributes can be specified via the `instance_attributes` field, and must be presented as a string in JSON format.
|
||||
The easiest way to populate this field is with a HEREDOC:
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_instance" "foo" {
|
||||
name = "test"
|
||||
label = "test"
|
||||
shape = "oc3"
|
||||
imageList = "/oracle/public/oel_6.4_2GB_v1"
|
||||
instance_attributes = <<JSON
|
||||
{
|
||||
"foo": "bar",
|
||||
"baz": 42,
|
||||
"my_obj": {
|
||||
"my_key": false,
|
||||
"another": true
|
||||
}
|
||||
}
|
||||
JSON
|
||||
|
||||
sshKeys = ["${opc_compute_ssh_key.key1.name}"]
|
||||
}
|
||||
```
|
||||
|
||||
This allows the user to have full control over the attributes supplied to an instance during instance creation.
|
||||
There are, as well, some attributes that get populated during instance creation, and the full attributes map can be seen
|
||||
via the exported `attributes` attribute.
|
||||
|
||||
**Warning:** Due to how Terraform imports resources, the `instance_attributes` field will _only_ be populated
|
||||
when creating a new instance _with terraform_. This requires us to ignore any state diffs on changes to the `instance_attributes` field.
|
||||
Thus, any configuration changes in the `instance_attributes` field, will not register a diff during a `plan` or `apply`.
|
||||
If a user wishes to make a change solely to the supplied instance attributes, and recreate the instance resource, `terraform taint` is the best solution.
|
||||
You can read more about the `taint` command [here](https://www.terraform.io/docs/commands/taint.html)
|
||||
|
||||
## Networking Info
|
||||
|
||||
Each `networking_info` config manages a single network interface for the instance.
|
||||
The attributes are either required or optional depending on whether or not the interface is
|
||||
in the Shared Network, or an IP Network. Some attributes can only be used if the interface is in the Shared
|
||||
Network, and same for an interface in an IP Network.
|
||||
|
||||
The following attributes are supported:
|
||||
|
||||
* `index` - (Required) The numerical index of the network interface. Specified as an integer to allow for use of `count`, but directly maps to `ethX`. ie: With `index` set to `0`, the interface `eth0` will be created. Can only be `0-9`.
|
||||
* `dns` - (Optional) Array of DNS servers for the interface.
|
||||
* `ip_address` - (Optional, IP Network Only) IP Address assigned to the interface.
|
||||
* `ip_network` - (Optional, IP Network Only) The IP Network assigned to the interface.
|
||||
* `mac_address` - (Optional, IP Network Only) The MAC address of the interface.
|
||||
* `model` - (Required, Shared Network Only) The model of the NIC card used. Must be set to `e1000`.
|
||||
* `name_servers` - (Optional) Array of name servers for the interface.
|
||||
* `nat` - (Optional for IP Networks, Required for the Shared Network) The IP Reservations associated with the interface (IP Network).
|
||||
Indicates whether a temporary or permanent public IP address should be assigned to the instance (Shared Network).
|
||||
* `search_domains` - (Optional) The search domains that are sent through DHCP as option 119.
|
||||
* `sec_lists` - (Optional, Shared Network Only) The security lists the interface is added to.
|
||||
* `shared_network` - (Required) Whether or not the interface is inside the Shared Network or an IP Network.
|
||||
* `vnic` - (Optional, IP Network Only) The name of the vNIC created for the IP Network.
|
||||
* `vnic_sets` - (Optional, IP Network Only) The array of vNIC Sets the interface was added to.
|
||||
|
||||
## Storage Attachments
|
||||
|
||||
Each Storage Attachment config manages a single storage attachment that is created _during instance creation_.
|
||||
This means that any storage attachments created during instance creation cannot be detached from the instance.
|
||||
Use the `resource_storage_attachment` resource to manage storage attachments for instances if you wish to detach the
|
||||
storage volumes at a later date.
|
||||
|
||||
The following attributes are supported:
|
||||
|
||||
* `index` - (Required) The Index number of the volume attachment. `1` is the boot volume for the instance. Values `1-10` allowed.
|
||||
* `volume` - (Required) The name of the storage volume to attach to the instance.
|
||||
|
||||
In addition to the above attributes, the following attributes are exported for a storage volume
|
||||
|
||||
* `name` - Name of the storage volume attachment.
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
In addition to the attributes listed above, the following attributes are exported:
|
||||
|
||||
* `id` - The `id` of the instance.
|
||||
* `attributes` - The full attributes of the instance, as a JSON string.
|
||||
* `availability_domain` - The availability domain the instance is in.
|
||||
* `domain` - The default domain to use for the hostname and for DNS lookups.
|
||||
* `entry` - Imagelist entry number.
|
||||
* `fingerprint` - SSH server fingerprint presented by the instance.
|
||||
* `image_format` - The format of the image.
|
||||
* `ip_address` - The IP Address of the instance.
|
||||
* `placement_requirements` - The array of placement requirements for the instance.
|
||||
* `platform` - The OS Platform of the instance.
|
||||
* `priority` - The priority at which the instance was ran.
|
||||
* `quota_reservation` - Reference to the QuotaReservation, to be destroyed with the instance.
|
||||
* `relationships` - The array of relationship specifications to be satisfied on instance placement.
|
||||
* `resolvers` - Array of resolvers to be used instead of the default resolvers.
|
||||
* `site` - The site the instance is running on.
|
||||
* `start_time` - The launch time of the instance.
|
||||
* `state` - The instance's state.
|
||||
* `vcable_id` - vCable ID for the instance.
|
||||
* `virtio` - Boolean that determines if the instance is a virtio device.
|
||||
* `vnc_address` - The VNC address and port of the instance.
|
||||
|
||||
## Import
|
||||
|
||||
Instances can be imported using the Instance's combined `Name` and `ID` with a `/` character separating them.
|
||||
If viewing an instance in the Oracle Web Console, the instance's `name` and `id` are the last two fields in the instances fully qualified `Name`
|
||||
|
||||
For example, in the Web Console an instance's fully qualified name is:
|
||||
```
|
||||
/Compute-<identify>/<user>@<account>/<instance_name>/<instance_id>
|
||||
```
|
||||
|
||||
The instance can be imported as such:
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_instance.instance1 instance_name/instance_id
|
||||
```
|
|
@ -1,48 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_ip_address_association"
|
||||
sidebar_current: "docs-opc-resource-ip-address-association"
|
||||
description: |-
|
||||
Creates and manages an IP address association in an OPC identity domain, for an IP Network.
|
||||
---
|
||||
|
||||
# opc\_compute\_ip\_address\_association
|
||||
|
||||
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, for an IP Network.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_ip_address_association" "default" {
|
||||
name = "PrefixSet1"
|
||||
ip_address_reservation = "${opc_compute_ip_address_reservation.default.name}"
|
||||
vnic = "${data.opc_compute_vnic.default.name}"
|
||||
tags = ["tags1", "tags2"]
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) The name of the ip address association.
|
||||
|
||||
* `ip_address_reservation` - (Optional) The name of the NAT IP address reservation.
|
||||
|
||||
* `vnic` - (Optional) The name of the virtual NIC associated with this NAT IP reservation.
|
||||
|
||||
* `description` - (Optional) A description of the ip address association.
|
||||
|
||||
* `tags` - (Optional) List of tags that may be applied to the ip address association.
|
||||
|
||||
In addition to the above, the following variables are exported:
|
||||
|
||||
* `uri` - (Computed) The Uniform Resource Identifier of the ip address association.
|
||||
|
||||
## Import
|
||||
|
||||
IP Address Associations can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_ip_address_association.default example
|
||||
```
|
|
@ -1,45 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_ip_address_prefix_set"
|
||||
sidebar_current: "docs-opc-resource-ip-address-prefix-set"
|
||||
description: |-
|
||||
Creates and manages an IP address prefix set in an OPC identity domain.
|
||||
---
|
||||
|
||||
# opc\_compute\_ip\_address\_prefix\_set
|
||||
|
||||
The ``opc_compute_ip_address_prefix_set`` resource creates and manages an IP address prefix set in an OPC identity domain.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_ip_address_prefix_set" "default" {
|
||||
name = "PrefixSet1"
|
||||
prefixes = ["192.168.0.0/16", "172.120.0.0/24"]
|
||||
tags = ["tags1", "tags2"]
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) The name of the ip address prefix set.
|
||||
|
||||
* `prefixes` - (Optional) List of CIDR IPv4 prefixes assigned in the virtual network.
|
||||
|
||||
* `description` - (Optional) A description of the ip address prefix set.
|
||||
|
||||
* `tags` - (Optional) List of tags that may be applied to the ip address prefix set.
|
||||
|
||||
In addition to the above, the following variables are exported:
|
||||
|
||||
* `uri` - (Computed) The Uniform Resource Identifier of the ip address prefix set.
|
||||
|
||||
## Import
|
||||
|
||||
IP Address Prefix Set can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_ip_address_prefix_set.default example
|
||||
```
|
|
@ -1,46 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_ip_address_reservation"
|
||||
sidebar_current: "docs-opc-resource-ip-address-reservation"
|
||||
description: |-
|
||||
Creates and manages an IP address reservation in an OPC identity domain for an IP Network.
|
||||
---
|
||||
|
||||
# opc\_compute\_ip\_address\_reservation
|
||||
|
||||
The ``opc_compute_ip_address_reservation`` resource creates and manages an IP address reservation in an OPC identity domain, for an IP Network.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_ip_address_reservation" "default" {
|
||||
name = "IPAddressReservation1"
|
||||
ip_address_pool = "public-ippool"
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) The name of the ip address reservation.
|
||||
|
||||
* `ip_address_pool` - (Required) The IP address pool from which you want to reserve an IP address. Must be either `public-ippool` or `cloud-ippool`.
|
||||
|
||||
* `description` - (Optional) A description of the ip address reservation.
|
||||
|
||||
* `tags` - (Optional) List of tags that may be applied to the IP address reservation.
|
||||
|
||||
In addition to the above, the following attributes are exported:
|
||||
|
||||
* `ip_address` - Reserved NAT IPv4 address from the IP address pool.
|
||||
|
||||
* `uri` - The Uniform Resource Identifier of the ip address reservation
|
||||
|
||||
## Import
|
||||
|
||||
IP Address Reservations can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_ip_address_reservation.default example
|
||||
```
|
|
@ -1,46 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_ip_association"
|
||||
sidebar_current: "docs-opc-resource-ip-association"
|
||||
description: |-
|
||||
Creates and manages an IP association in an OPC identity domain for the Shared Network.
|
||||
---
|
||||
|
||||
# opc\_compute\_ip\_association
|
||||
|
||||
The ``opc_compute_ip_association`` resource creates and manages an association between an IP address and an instance in
|
||||
an OPC identity domain, for the Shared Network.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_ip_association" "instance1_reservation1" {
|
||||
vcable = "${opc_compute_instance.test_instance.vcable}"
|
||||
parentpool = "ipreservation:${opc_compute_ip_reservation.reservation1.name}"
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `vcable` - (Required) The vcable of the instance to associate the IP address with.
|
||||
|
||||
* `parentpool` - (Required) The pool from which to take an IP address. To associate a specific reserved IP address, use
|
||||
the prefix `ipreservation:` followed by the name of the IP reservation. To allocate an IP address from a pool, use the
|
||||
prefix `ippool:`, e.g. `ippool:/oracle/public/ippool`.
|
||||
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
The following attributes are exported:
|
||||
|
||||
* `name` The name of the IP Association
|
||||
|
||||
## Import
|
||||
|
||||
IP Associations can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_ip_association.association1 example
|
||||
```
|
|
@ -1,62 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_ip_network"
|
||||
sidebar_current: "docs-opc-resource-ip-network"
|
||||
description: |-
|
||||
Creates and manages an IP Network
|
||||
---
|
||||
|
||||
# opc\_compute\_ip_network
|
||||
|
||||
The ``opc_compute_ip_network`` resource creates and manages an IP Network.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_ip_network" "foo" {
|
||||
name = "my-ip-network"
|
||||
description = "my IP Network"
|
||||
ip_address_prefix = "10.0.1.0/24"
|
||||
ip_network_exchange = "${opc_compute_ip_exchange.foo.name}"
|
||||
public_napt_enabled = false
|
||||
tags = ["tag1", "tag2"]
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) The name of the IP Network.
|
||||
|
||||
* `ip_address_prefix` - (Required) The IPv4 address prefix, in CIDR format.
|
||||
|
||||
* `description` - (Optional) The description of the IP Network.
|
||||
|
||||
* `ip_network_exchange` - (Optional) Specify the IP Network exchange to which the IP Network belongs to.
|
||||
|
||||
* `public_napt_enabled` - (Optional) If true, enable public internet access using NAPT for VNICs without any public IP Reservation. Defaults to `false`.
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
The following attributes are exported:
|
||||
|
||||
* `name` - The name of the IP Network
|
||||
|
||||
* `ip_address_prefix` - The IPv4 address prefix, in CIDR format.
|
||||
|
||||
* `description` - The description of the IP Network.
|
||||
|
||||
* `ip_network_exchange` - The IP Network Exchange for the IP Network
|
||||
|
||||
* `public_napt_enabled` - Whether public internet access using NAPT for VNICs without any public IP Reservation or not.
|
||||
|
||||
* `uri` - Uniform Resource Identifier for the IP Network
|
||||
|
||||
## Import
|
||||
|
||||
IP Networks can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_ip_network.default example
|
||||
```
|
|
@ -1,37 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_ip_network_exchange"
|
||||
sidebar_current: "docs-opc-resource-ip-network-exchange"
|
||||
description: |-
|
||||
Creates and manages an IP network exchange in an OPC identity domain.
|
||||
---
|
||||
|
||||
# opc\_compute\_ip\_network\_exchange
|
||||
|
||||
The ``opc_compute_ip_network_exchange`` resource creates and manages an IP network exchange in an OPC identity domain.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_ip_network_exchange" "default" {
|
||||
name = "NetworkExchange1"
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) The name of the ip network exchange.
|
||||
|
||||
* `description` - (Optional) A description of the ip network exchange.
|
||||
|
||||
* `tags` - (Optional) List of tags that may be applied to the IP network exchange.
|
||||
|
||||
## Import
|
||||
|
||||
IP Network Exchange's can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_ip_network_exchange.exchange1 example
|
||||
```
|
|
@ -1,43 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_ip_reservation"
|
||||
sidebar_current: "docs-opc-resource-ip-reservation"
|
||||
description: |-
|
||||
Creates and manages an IP reservation in an OPC identity domain for the Shared Network.
|
||||
---
|
||||
|
||||
# opc\_compute\_ip\_reservation
|
||||
|
||||
The ``opc_compute_ip_reservation`` resource creates and manages an IP reservation in an OPC identity domain for the Shared Network.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_ip_reservation" "reservation1" {
|
||||
parent_pool = "/oracle/public/ippool"
|
||||
permanent = true
|
||||
tags = [ "test" ]
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `parent_pool` - (Required) The pool from which to allocate the IP address.
|
||||
|
||||
* `permanent` - (Required) Whether the IP address remains reserved even when it is no longer associated with an instance
|
||||
(if true), or may be returned to the pool and replaced with a different IP address when an instance is restarted, or
|
||||
deleted and recreated (if false).
|
||||
|
||||
* `name` - (Optional) Name of the IP Reservation. Will be generated if unspecified.
|
||||
|
||||
* `tags` - (Optional) List of tags that may be applied to the IP reservation.
|
||||
|
||||
## Import
|
||||
|
||||
IP Reservations can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_ip_reservations.reservation1 example
|
||||
```
|
|
@ -1,60 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_route"
|
||||
sidebar_current: "docs-opc-resource-route"
|
||||
description: |-
|
||||
Creates and manages a Route resource for an IP Network
|
||||
---
|
||||
|
||||
# opc\_compute\_route
|
||||
|
||||
The ``opc_compute_route`` resource creates and manages a route for an IP Network.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_route" "foo" {
|
||||
name = "my-route"
|
||||
description = "my IP Network route"
|
||||
admin_distance = 1
|
||||
ip_address_prefix = "10.0.1.0/24"
|
||||
next_hop_vnic_set = "${opc_compute_vnic_set.bar.name}"
|
||||
tags = ["tag1", "tag2"]
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) The name of the route.
|
||||
|
||||
* `description` - (Optional) The description of the route.
|
||||
|
||||
* `admin_distance` - (Optional) The route's administrative distance. Defaults to `0`.
|
||||
|
||||
* `ip_address_prefix` - (Required) The IPv4 address prefix, in CIDR format, of the external network from which to route traffic.
|
||||
|
||||
* `next_hop_vnic_set` - (Required) Name of the virtual NIC set to route matching packets to. Routed flows are load-balanced among all the virtual NICs in the virtual NIC set.
|
||||
|
||||
## Attributes Reference
|
||||
|
||||
The following attributes are exported:
|
||||
|
||||
* `name` The name of the route
|
||||
|
||||
* `description` - The description of the route.
|
||||
|
||||
* `admin_distance` - The route's administrative distance. Defaults to `0`.
|
||||
|
||||
* `ip_address_prefix` - The IPv4 address prefix, in CIDR format, of the external network from which to route traffic.
|
||||
|
||||
* `next_hop_vnic_set` - Name of the virtual NIC set to route matching packets to. Routed flows are load-balanced among all the virtual NICs in the virtual NIC set.
|
||||
|
||||
## Import
|
||||
|
||||
Route's can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_route.route1 example
|
||||
```
|
|
@ -1,57 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_sec_rule"
|
||||
sidebar_current: "docs-opc-resource-sec-rule"
|
||||
description: |-
|
||||
Creates and manages a sec rule in an OPC identity domain.
|
||||
---
|
||||
|
||||
# opc\_compute\_sec\_rule
|
||||
|
||||
The ``opc_compute_sec_rule`` resource creates and manages a sec rule in an OPC identity domain, which joinstogether a source security list (or security IP list), a destination security list (or security IP list), and a security application.
|
||||
|
||||
## Example Usage
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_sec_rule" "test_rule" {
|
||||
name = "test"
|
||||
source_list = "seclist:${opc_compute_security_list.sec-list1.name}"
|
||||
destination_list = "seciplist:${opc_compute_security_ip_list.sec-ip-list1.name}"
|
||||
action = "permit"
|
||||
application = "${opc_compute_security_application.spring-boot.name}"
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) The unique (within the identity domain) name of the security rule.
|
||||
|
||||
* `description` - (Optional) A description for this security rule.
|
||||
|
||||
* `source_list` - (Required) The source security list (prefixed with `seclist:`), or security IP list (prefixed with
|
||||
`seciplist:`).
|
||||
|
||||
* `destination_list` - (Required) The destination security list (prefixed with `seclist:`), or security IP list (prefixed with
|
||||
`seciplist:`).
|
||||
|
||||
* `application` - (Required) The name of the application to which the rule applies.
|
||||
|
||||
* `action` - (Required) Whether to `permit`, `refuse` or `deny` packets to which this rule applies. This will ordinarily
|
||||
be `permit`.
|
||||
|
||||
* `disabled` - (Optional) Whether to disable this security rule. This is useful if you want to temporarily disable a rule
|
||||
without removing it outright from your Terraform resource definition. Defaults to `false`.
|
||||
|
||||
In addition to the above, the following values are exported:
|
||||
|
||||
* `uri` - The Uniform Resource Identifier of the sec rule.
|
||||
|
||||
## Import
|
||||
|
||||
Sec Rule's can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_sec_rule.rule1 example
|
||||
```
|
|
@ -1,57 +0,0 @@
|
|||
---
|
||||
layout: "opc"
|
||||
page_title: "Oracle: opc_compute_security_application"
|
||||
sidebar_current: "docs-opc-resource-security-application"
|
||||
description: |-
|
||||
Creates and manages a security application in an OPC identity domain.
|
||||
---
|
||||
|
||||
# opc\_compute\_security\_application
|
||||
|
||||
The ``opc_compute_security_application`` resource creates and manages a security application in an OPC identity domain.
|
||||
|
||||
## Example Usage (TCP)
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_security_application" "tomcat" {
|
||||
name = "tomcat"
|
||||
protocol = "tcp"
|
||||
dport = "8080"
|
||||
}
|
||||
```
|
||||
|
||||
## Example Usage (ICMP)
|
||||
|
||||
```hcl
|
||||
resource "opc_compute_security_application" "tomcat" {
|
||||
name = "tomcat"
|
||||
protocol = "icmp"
|
||||
icmptype = "echo"
|
||||
icmpcode = "protocol"
|
||||
}
|
||||
```
|
||||
|
||||
## Argument Reference
|
||||
|
||||
The following arguments are supported:
|
||||
|
||||
* `name` - (Required) The unique (within the identity domain) name of the application
|
||||
|
||||
* `protocol` - (Required) The protocol to enable for this application. Must be one of
|
||||
`tcp`, `udp`, `ah`, `esp`, `icmp`, `icmpv6`, `igmp`, `ipip`, `gre`, `mplsip`, `ospf`, `pim`, `rdp`, `sctp` or `all`.
|
||||
|
||||
* `dport` - (Required) The port, or range of ports, to enable for this application, e.g `8080`, `6000-7000`. This must be set if the `protocol` is set to `tcp` or `udp`.
|
||||
|
||||
* `icmptype` - (Optional) The ICMP type to enable for this application, if the `protocol` is `icmp`. Must be one of
|
||||
`echo`, `reply`, `ttl`, `traceroute`, `unreachable`.
|
||||
|
||||
* `icmpcode` - (Optional) The ICMP code to enable for this application, if the `protocol` is `icmp`. Must be one of
|
||||
`admin`, `df`, `host`, `network`, `port` or `protocol`.
|
||||
|
||||
## Import
|
||||
|
||||
Security Application's can be imported using the `resource name`, e.g.
|
||||
|
||||
```shell
|
||||
$ terraform import opc_compute_security_application.application1 example
|
||||
```
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue