add image_list_entry resource

This commit is contained in:
Jake Champlin 2017-04-04 16:28:11 -04:00
parent 456d43e200
commit d05af76607
No known key found for this signature in database
GPG Key ID: DC31F41958EF4AC2
19 changed files with 378 additions and 538 deletions

View File

@ -53,6 +53,7 @@ func Provider() terraform.ResourceProvider {
"opc_compute_ip_network": resourceOPCIPNetwork(),
"opc_compute_acl": resourceOPCACL(),
"opc_compute_image_list": resourceOPCImageList(),
"opc_compute_image_list_entry": resourceOPCImageListEntry(),
"opc_compute_instance": resourceInstance(),
"opc_compute_ip_address_reservation": resourceOPCIPAddressReservation(),
"opc_compute_ip_association": resourceOPCIPAssociation(),

View File

@ -0,0 +1,160 @@
package opc
import (
"fmt"
"strconv"
"strings"
"github.com/hashicorp/go-oracle-terraform/compute"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/structure"
"github.com/hashicorp/terraform/helper/validation"
)
func resourceOPCImageListEntry() *schema.Resource {
return &schema.Resource{
Create: resourceOPCImageListEntryCreate,
Read: resourceOPCImageListEntryRead,
Delete: resourceOPCImageListEntryDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"machine_images": {
Type: schema.TypeList,
Required: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"version": {
Type: schema.TypeInt,
ForceNew: true,
Required: true,
},
"attributes": {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
ValidateFunc: validation.ValidateJsonString,
DiffSuppressFunc: structure.SuppressJsonDiff,
},
"uri": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
func resourceOPCImageListEntryCreate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*compute.Client).ImageListEntries()
name := d.Get("name").(string)
machineImages := expandOPCImageListEntryMachineImages(d)
version := d.Get("version").(int)
createInput := &compute.CreateImageListEntryInput{
Name: name,
MachineImages: machineImages,
Version: version,
}
if v, ok := d.GetOk("attributes"); ok {
attributesString := v.(string)
attributes, err := structure.ExpandJsonFromString(attributesString)
if err != nil {
return err
}
createInput.Attributes = attributes
}
_, err := client.CreateImageListEntry(createInput)
if err != nil {
return err
}
id := generateOPCImageListEntryID(name, version)
d.SetId(id)
return resourceOPCImageListEntryRead(d, meta)
}
func resourceOPCImageListEntryRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*compute.Client).ImageListEntries()
name, version, err := parseOPCImageListEntryID(d.Id())
if err != nil {
return err
}
getInput := compute.GetImageListEntryInput{
Name: *name,
Version: *version,
}
getResult, err := client.GetImageListEntry(&getInput)
if err != nil {
return err
}
attrs, err := structure.FlattenJsonToString(getResult.Attributes)
if err != nil {
return err
}
d.Set("name", name)
d.Set("machine_images", getResult.MachineImages)
d.Set("version", getResult.Version)
d.Set("attributes", attrs)
d.Set("uri", getResult.Uri)
return nil
}
func resourceOPCImageListEntryDelete(d *schema.ResourceData, meta interface{}) error {
client := meta.(*compute.Client).ImageListEntries()
name, version, err := parseOPCImageListEntryID(d.Id())
if err != nil {
return err
}
deleteInput := &compute.DeleteImageListEntryInput{
Name: *name,
Version: *version,
}
err = client.DeleteImageListEntry(deleteInput)
if err != nil {
return err
}
return nil
}
func parseOPCImageListEntryID(id string) (*string, *int, error) {
s := strings.Split(id, "|")
name, versionString := s[0], s[1]
version, err := strconv.Atoi(versionString)
if err != nil {
return nil, nil, err
}
return &name, &version, nil
}
func expandOPCImageListEntryMachineImages(d *schema.ResourceData) []string {
machineImages := []string{}
for _, i := range d.Get("machine_images").([]interface{}) {
machineImages = append(machineImages, i.(string))
}
return machineImages
}
func generateOPCImageListEntryID(name string, version int) string {
return fmt.Sprintf("%s|%d", name, version)
}

View File

@ -0,0 +1,161 @@
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
}
`

View File

@ -2,6 +2,7 @@ package opc
import (
"fmt"
"github.com/hashicorp/go-oracle-terraform/compute"
"github.com/hashicorp/terraform/helper/schema"
)

View File

@ -0,0 +1,52 @@
---
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
```
resource "opc_compute_image_list_entry" "test" {
name = "imagelist1"
machine_images = ["image1", "image2"]
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.
```
terraform import opc_compute_image_list_entry.entry1 example
```

View File

@ -1,36 +0,0 @@
---
layout: "oracleopc"
page_title: "Oracle: opc_compute_vnic"
sidebar_current: "docs-oracleopc-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
```
data "opc_compute_vnic" "current" {}
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.

View File

@ -1,55 +0,0 @@
---
layout: "oracleopc"
page_title: "Provider: Oracle Public Cloud"
sidebar_current: "docs-oracleopc-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
```
# Configure the Oracle Public Cloud
provider "oracle" {
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 num seconds to wait for successful response when operating on resources within OPC (defaults to 3000)
* `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.

View File

@ -1,68 +0,0 @@
---
layout: "oracleopc"
page_title: "Oracle: opc_compute_instance"
sidebar_current: "docs-oracleopc-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
```
resource "opc_compute_instance" "test_instance" {
name = "test"
label = "test"
shape = "oc3"
imageList = "/oracle/public/oel_6.4_2GB_v1"
sshKeys = ["${opc_compute_ssh_key.key1.name}"]
attributes = "{\"foo\":\"bar\"}"
storage = [{
index = 1
volume = "${opc_compute_storage_volume.test_volume.name}"
},
{
index = 2
volume = "${opc_compute_storage_volume.test_volume2.name}"
}]
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The name of the instance. This need not be unique, as each instance is assigned a separate
computed `opcId`.
* `shape` - (Required) The shape of the instance, e.g. `oc4`.
* `imageList` - (Optional) The imageList of the instance, e.g. `/oracle/public/oel_6.4_2GB_v1`
* `label` - (Optional) The label to apply to the instance.
* `ip` - (Computed) The internal IP address assigned to the instance.
* `opcId` - (Computed) The interned ID assigned to the instance.
* `sshKeys` - (Optional) The names of the SSH Keys that can be used to log into the instance.
* `attributes` - (Optional) An arbitrary JSON-formatted collection of attributes which is made available to the instance.
* `vcable` - (Computed) The ID of the instance's VCable, which is used to associate it with reserved IP addresses and
add it to Security Lists.
* `storage` - (Optional) A set of zero or more storage volumes to attach to the instance. Each volume has two arguments:
`index`, which is the volume's index in the instance's list of mounted volumes, and `name`, which is the name of the
storage volume to mount.
* `bootOrder` - (Optional) The index number of the bootable storage volume that should be used to boot the instance. e.g. `[ 1 ]`. If you specify both `bootOrder` and `imageList`, the imagelist attribute is ignored.

View File

@ -1,31 +0,0 @@
---
layout: "oracleopc"
page_title: "Oracle: opc_compute_ip_association"
sidebar_current: "docs-oracleopc-resource-ip-association"
description: |-
Creates and manages an IP association in an OPC identity domain.
---
# 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.
## Example Usage
```
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`.

View File

@ -1,33 +0,0 @@
---
layout: "oracleopc"
page_title: "Oracle: opc_compute_ip_reservation"
sidebar_current: "docs-oracleopc-resource-ip-reservation"
description: |-
Creates and manages an IP reservation in an OPC identity domain.
---
# opc\_compute\_ip\_reservation
The ``opc_compute_ip_reservation`` resource creates and manages an IP reservation in an OPC identity domain.
## Example Usage
```
resource "opc_compute_ip_reservation" "reservation1" {
parentpool = "/oracle/public/ippool"
permanent = true
tags = []
}
```
## Argument Reference
The following arguments are supported:
* `parentpool` - (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).
* `tags` - (Optional) List of tags that may be applied to the IP reservation.

View File

@ -1,39 +0,0 @@
---
layout: "oracleopc"
page_title: "Oracle: opc_compute_security_application"
sidebar_current: "docs-oracleopc-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
```
resource "opc_compute_security_application" "tomcat" {
name = "tomcat"
protocol = "tcp"
dport = "8080"
}
```
## 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 either one of
`tcp`, `udp`, `icmp`, `igmp`, `ipip`, `rdp`, `esp`, `ah`, `gre`, `icmpv6`, `ospf`, `pim`, `sctp`, `mplsip` or `all`, or
the corresponding integer in the range 0-254 from the list of [assigned protocol numbers](http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml)
* `dport` - (Required) The port, or range of ports, to enable for this application, e.g `8080`, `6000-7000`.
* `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
`network`, `host`, `protocol`, `port`, `df`, `admin`.

View File

@ -1,29 +0,0 @@
---
layout: "oracleopc"
page_title: "Oracle: opc_compute_security_association"
sidebar_current: "docs-oracleopc-resource-security-association"
description: |-
Creates and manages a security association in an OPC identity domain.
---
# opc\_compute\_security\_association
The ``opc_compute_security_association`` resource creates and manages an association between an instance and a security
list in an OPC identity domain.
## Example Usage
```
resource "opc_compute_security_association" "test_instance_sec_list_1" {
vcable = "${opc_compute_instance.test_instance.vcable}"
seclist = "${opc_compute_security_list.sec_list1.name}"
}
```
## Argument Reference
The following arguments are supported:
* `vcable` - (Required) The `vcable` of the instance to associate to the security list.
* `seclist` - (Required) The name of the security list to associate the instance to.

View File

@ -1,28 +0,0 @@
---
layout: "oracleopc"
page_title: "Oracle: opc_compute_security_ip_list"
sidebar_current: "docs-oracleopc-resource-security-ip-list"
description: |-
Creates and manages a security IP list in an OPC identity domain.
---
# opc\_compute\_security\_ip\_list
The ``opc_compute_security_ip_list`` resource creates and manages a security IP list in an OPC identity domain.
## Example Usage
```
resource "opc_compute_security_ip_list" "sec_ip_list1" {
name = "sec-ip-list1"
ip_entries = ["217.138.34.4"]
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The unique (within the identity domain) name of the security IP list.
* `ip_entries` - (Required) The IP addresses to include in the list.

View File

@ -1,33 +0,0 @@
---
layout: "oracleopc"
page_title: "Oracle: opc_compute_security_list"
sidebar_current: "docs-oracleopc-resource-security-list"
description: |-
Creates and manages a security list in an OPC identity domain.
---
# opc\_compute\_security\_list
The ``opc_compute_security_list`` resource creates and manages a security list in an OPC identity domain.
## Example Usage
```
resource "opc_compute_security_list" "sec_list1" {
name = "sec-list-1"
policy = "permit"
outbound_cidr_policy = "deny"
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The unique (within the identity domain) name of the security list.
* `policy` - (Required) The policy to apply to instances associated with this list. Must be one of `permit`,
`reject` (packets are dropped but a reply is sent) and `deny` (packets are dropped and no reply is sent).
* `output_cidr_policy` - (Required) The policy for outbound traffic from the security list.Must be one of `permit`,
`reject` (packets are dropped but a reply is sent) and `deny` (packets are dropped and no reply is sent).

View File

@ -1,46 +0,0 @@
---
layout: "oracleopc"
page_title: "Oracle: opc_compute_security_rule"
sidebar_current: "docs-oracleopc-resource-security-rule"
description: |-
Creates and manages a security rule in an OPC identity domain.
---
# opc\_compute\_ip\_reservation
The ``opc_compute_security_rule`` resource creates and manages a security rule in an OPC identity domain, which joins
together a source security list (or security IP list), a destination security list (or security IP list), and a security
application.
## Example Usage
```
resource "opc_compute_security_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}"
disabled = false
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The unique (within the identity domain) name of the 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` - (Required) 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.

View File

@ -1,32 +0,0 @@
---
layout: "oracleopc"
page_title: "Oracle: opc_compute_ssh_key"
sidebar_current: "docs-oracleopc-resource-ssh-key"
description: |-
Creates and manages an SSH key in an OPC identity domain.
---
# opc\_compute\_ssh_key
The ``opc_compute_ssh_key`` resource creates and manages an SSH key in an OPC identity domain.
## Example Usage
```
resource "opc_compute_ssh_key" "%s" {
name = "test-key"
key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqw6JwbjIk..."
enabled = true
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The unique (within this identity domain) name of the SSH key.
* `key` - (Required) The SSH key itself
* `enabled` - (Required) Whether or not the key is enabled. This is useful if you want to temporarily disable an SSH key,
without removing it entirely from your Terraform resource definition.

View File

@ -1,49 +0,0 @@
---
layout: "oracleopc"
page_title: "Oracle: opc_compute_storage_volume"
sidebar_current: "docs-oracleopc-resource-storage-volume"
description: |-
Creates and manages a storage volume in an OPC identity domain.
---
# opc\_compute\_storage\_volume
The ``opc_compute_storage_volume`` resource creates and manages a storage volume in an OPC identity domain.
~> **Caution:** The ``opc_compute_storage_volume`` resource can completely delete your
storage volume just as easily as it can create it. To avoid costly accidents,
consider setting
[``prevent_destroy``](/docs/configuration/resources.html#prevent_destroy)
on your storage volume resources as an extra safety measure.
## Example Usage
```
resource "opc_compute_storage_volume" "test_volume" {
size = "3g"
description = "My storage volume"
name = "test_volume_a"
tags = ["xyzzy", "quux"]
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The unique (within this identity domain) name of the storage volume.
* `size` - (Required) The size of the storage instance.
* `description` - (Optional) A description of the storage volume.
* `tags` - (Optional) A list of tags to apply to the storage volume.
* `bootableImage` - (Optional) The name of the bootable image the storage volume is loaded with.
* `bootableImageVersion` - (Optional) The version of the bootable image specified in `bootableImage` to use.
* `snapshot` - (Optional) The snapshot to initialise the storage volume with. This has two nested properties: `name`,
for the name of the snapshot to use, and `account` for the name of the snapshot account to use.
* `snapshotId` - (Optional) The id of the snapshot to initialise the storage volume with.

View File

@ -31,6 +31,9 @@
<li<%= sidebar_current("docs-opc-resource-image-list") %>>
<a href="/docs/providers/opc/r/opc_compute_image_list.html">opc_compute_image_list</a>
</li>
<li<%= sidebar_current("docs-opc-resource-image-list-entry") %>>
<a href="/docs/providers/opc/r/opc_compute_image_list_entry.html">opc_compute_image_list_entry</a>
</li>
<li<%= sidebar_current("docs-opc-resource-instance") %>>
<a href="/docs/providers/opc/r/opc_compute_instance.html">opc_compute_instance</a>
</li>

View File

@ -1,59 +0,0 @@
<% wrap_layout :inner do %>
<% content_for :sidebar do %>
<div class="docs-sidebar hidden-print affix-top" role="complementary">
<ul class="nav docs-sidenav">
<li<%= sidebar_current("docs-home") %>>
<a href="/docs/providers/index.html">&laquo; Documentation Home</a>
</li>
<li<%= sidebar_current("docs-oracleopc-index") %>>
<a href="/docs/providers/oracleopc/index.html">Oracle Public Cloud Provider</a>
</li>
<li<%= sidebar_current(/^docs-oracleopc-datasource/) %>>
<a href="#">Data Sources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-oracleopc-datasource-vnic") %>>
<a href="/docs/providers/oracleopc/d/opc_compute_vnic.html">opc_compute_vnic</a>
</li>
</ul>
</li>
<li<%= sidebar_current(/^docs-oracleopc-resource/) %>>
<a href="#">Resources</a>
<ul class="nav nav-visible">
<li<%= sidebar_current("docs-oracleopc-resource-instance") %>>
<a href="/docs/providers/oracleopc/r/opc_compute_instance.html">opc_compute_instance</a>
</li>
<li<%= sidebar_current("docs-oracleopc-resource-ip-association") %>>
<a href="/docs/providers/oracleopc/r/opc_compute_ip_association.html">opc_compute_ip_association</a>
</li>
<li<%= sidebar_current("docs-oracleopc-resource-ip-reservation") %>>
<a href="/docs/providers/oracleopc/r/opc_compute_ip_reservation.html">opc_compute_ip_reservation</a>
</li>
<li<%= sidebar_current("docs-oracleopc-resource-security-application") %>>
<a href="/docs/providers/oracleopc/r/opc_compute_security_application.html">opc_compute_security_application</a>
</li>
<li<%= sidebar_current("docs-oracleopc-resource-security-association") %>>
<a href="/docs/providers/oracleopc/r/opc_compute_security_association.html">opc_compute_security_association</a>
</li>
<li<%= sidebar_current("docs-oracleopc-resource-security-ip-list") %>>
<a href="/docs/providers/oracleopc/r/opc_compute_security_ip_list.html">opc_compute_security_ip_list</a>
</li>
<li<%= sidebar_current("docs-oracleopc-resource-security-list") %>>
<a href="/docs/providers/oracleopc/r/opc_compute_security_list.html">opc_compute_security_list</a>
</li>
<li<%= sidebar_current("docs-oracleopc-resource-ssh-key") %>>
<a href="/docs/providers/oracleopc/r/opc_compute_ssh_key.html">opc_compute_ssh_key</a>
</li>
<li<%= sidebar_current("docs-oracleopc-resource-storage-volume") %>>
<a href="/docs/providers/oracleopc/r/opc_compute_storage_volume.html">opc_compute_storage_volume</a>
</li>
</ul>
</li>
</ul>
</div>
<% end %>
<%= yield %>
<% end %>