项目作者: oracle-terraform-modules

项目描述 :
(OCI) Oracle Cloud Infrastructure module to provision Block Storage volumes and Volume Groups
高级语言: HCL
项目地址: git://github.com/oracle-terraform-modules/terraform-oci-tdf-block-storage.git
创建时间: 2019-11-25T14:42:59Z
项目社区:https://github.com/oracle-terraform-modules/terraform-oci-tdf-block-storage

开源协议:Universal Permissive License v1.0

下载


Oracle Cloud Infrastructure (OCI) Block Storage Module for Terraform

Introduction

This module provides a way to provision an Oracle Cloud Infrastructure Block Storage Volume and Volume Groups.
This serves as a foundational component in an OCI environment, providing the ability to provision Block Storage Volumes.

  1. Create a block volumes
  2. Create a backup policies
  3. Create a block volume groups and add volumes to it.
  4. Create the volume from another source
  5. Tagging (freeform or defined)

Prerequisites

See the Oracle Cloud Infrastructure Provider docs for information about setting up and using the Oracle Cloud Infrastructure Provider.
https://github.com/terraform-providers/terraform-provider-oci

This module does not create any dependencies or prerequisites.

Getting Started

Several fully-functional examples are provided in the examples directory.

The following scenarios are covered in the examples:

  • simple_block_volume: Provisioning a single volume and a volume group
  • attach_block_volume: Provision a volume and attach it to a pre-existing instance.

Accessing the Solution

This core service module is typically used at deployment, with no further access required.

Module Inputs

Provider

The following IAM attributes are available in the the terraform.tfvars file:

  1. ### PRIMARY TENANCY DETAILS
  2. # Get this from the bottom of the OCI screen (after logging in, after Tenancy ID: heading)
  3. primary_tenancy_id="<tenancy OCID"
  4. # Get this from OCI > Identity > Users (for your user account)
  5. primary_user_id="<user OCID>"
  6. # the fingerprint can be gathered from your user account (OCI > Identity > Users > click your username > API Keys fingerprint (select it, copy it and paste it below))
  7. primary_fingerprint="<PEM key fingerprint>"
  8. # this is the full path on your local system to the private key used for the API key pair
  9. primary_private_key_path="<path to the private key that matches the fingerprint above>"
  10. # region (us-phoenix-1, ca-toronto-1, etc)
  11. primary_region="<your region>"
  12. ### DR TENANCY DETAILS
  13. # Get this from the bottom of the OCI screen (after logging in, after Tenancy ID: heading)
  14. dr_tenancy_id="<tenancy OCID"
  15. # Get this from OCI > Identity > Users (for your user account)
  16. dr_user_id="<user OCID>"
  17. # the fingerprint can be gathered from your user account (OCI > Identity > Users > click your username > API Keys fingerprint (select it, copy it and paste it below))
  18. dr_fingerprint="<PEM key fingerprint>"
  19. # this is the full path on your local system to the private key used for the API key pair
  20. dr_private_key_path="<path to the private key that matches the fingerprint above>"
  21. # region (us-phoenix-1, ca-toronto-1, etc)
  22. dr_region="<your region>"

Block Volume

Attribute Data Type Required Default Value Valid Values Description
compartment_id string yes none compartment OCID This is the compartment OCID
size_in_gbs integer yes 60 integer Size of the block volume in GB
name string yes my-oci-block-volume string The block volume name
ad string yes AD1 AD1, AD2 or AD3 The block volume Availability domain name
backup_policy_name string no none Bronze, Silver or Gold The block volume backup policy name
vol_group_name string no none string The block volume group name to which this volume needs to be added. Example “vg1” or “vg2”. Note the VG should be from same AD as the volume
defined_tags map no {“KEY.Subkey” = “VALUE”} map Use this if you want a block volume defined tag (optional)
freeform_tags map no {“KEY” = “VALUE”} map Use this if you want a block volume free form tag (optional)
source_id list(string) no null OCID of the source volume The block volume source id to use (optional)
source_type string no null volume or volumebackup The block volume source type (optional)
kms_key_id string no null kms key id The kms key id (optional)
ext_vol_ids list(string) no null OCID of other existing volumes if required The existing block volumes to add (optional)

Important Note
The Volume group AD and Volume AD should be same.

Example

The following example creates 3 Block Volumes and 2 Volume Groups.

  1. module "example1" {
  2. source = "../.."
  3. default_compartment_id = var.compartment_id
  4. default_ad = 0
  5. default_size_in_gbs = 50
  6. default_backup_policy_name = "Bronze"
  7. default_defined_tags = { "Team.Owner" = "example@acme.com" }
  8. default_freeform_tags = { "Environment" = "Production" }
  9. vols = {
  10. bv1 = {
  11. compartment_id = null
  12. ad = null
  13. size_in_gbs = 62
  14. backup_policy_name = null
  15. defined_tags = null
  16. freeform_tags = null
  17. source_id = null
  18. source_type = null
  19. vol_grp_name = "vg1"
  20. kms_key_id = null
  21. },
  22. bv2 = {
  23. compartment_id = var.compartment_id
  24. ad = 0
  25. size_in_gbs = 66
  26. backup_policy_name = "Gold"
  27. defined_tags = null
  28. freeform_tags = null
  29. source_id = "ocid1.volume.oc1.phx.xxx"
  30. source_type = "volume"
  31. vol_grp_name = "vg1"
  32. kms_key_id = null
  33. },
  34. bv3 = {
  35. compartment_id = var.compartment_id
  36. ad = 0
  37. size_in_gbs = 65
  38. backup_policy_name = "Silver"
  39. defined_tags = { "Team.Owner" = "owner@acme.com" }
  40. freeform_tags = { "Environment" = "Testing" }
  41. source_id = null
  42. source_type = null
  43. vol_grp_name = "vg2"
  44. kms_key_id = null
  45. }
  46. }
  47. vol_grps = {
  48. vg1 = {
  49. compartment_id = null
  50. ad = 0
  51. ext_vol_ids = ["ocid1.volume.oc1.phx.xxx"]
  52. defined_tags = null
  53. freeform_tags = null
  54. },
  55. vg2 = {
  56. compartment_id = null
  57. ad = 0
  58. ext_vol_ids = ["ocid1.volume.oc1.phx.xxx"]
  59. defined_tags = null
  60. freeform_tags = null
  61. }
  62. }
  63. }

URLs

For Oracle Cloud Infrastructure File Storage Service documentation, see https://docs.cloud.oracle.com/en-us/iaas/Content/Block/Concepts/overview.htm

Versions

This module has been developed and tested by running terraform on macOS Mojave Version 10.14.5

  1. user-mac$ terraform --version
  2. Terraform v0.12.3
  3. + provider.oci v3.31.0

Contributing

This project is open source. Oracle appreciates any contributions that are made by the open source community.

License

Copyright (c) 2020 Oracle and/or its affiliates.

Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.

See LICENSE for more details.