Skip to content

Commit

Permalink
Merge branch 'karthicgit-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
hyder committed Jun 24, 2020
2 parents 318edb0 + 7c4361f commit 9bce3d5
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 67 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ All notable changes to this project are documented in this file.

The format is based on {uri-changelog}[Keep a Changelog].

== v1.0.2 (May 21,2020)

=== Changes
* Removed unnecessary variables (#2)
* Updated docs on how to use this module from HashiCorp registry

== v1.0.1 (May 27,2020)

=== Changes
* Renamed freeform_tags to tags

== v1.0.0 (May 21,2020)

=== Changes
Expand Down
199 changes: 195 additions & 4 deletions docs/quickstart.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,36 @@ cp terraform.tfvars.example terraform.tfvars
[source,hcl]
----
provider "oci" {
tenancy_ocid = var.tenancy_id
user_ocid = var.user_id
fingerprint = var.api_fingerprint
private_key_path = var.api_private_key_path
region = var.region
tenancy_ocid = var.tenancy_id
user_ocid = var.user_id
}
# provider identity parameters
variable "api_fingerprint" {
description = "fingerprint of oci api private key"
type = string
}
variable "api_private_key_path" {
description = "path to oci api private key used"
type = string
}
variable "tenancy_id" {
description = "tenancy id where to create the sources"
type = string
}
variable "user_id" {
description = "id of user that terraform will use to create the resources"
type = string
}
----

. Set mandatory provider parameters:
. Set mandatory provider parameters in terraform.tfvars:

* `api_fingerprint`
* `api_private_key_path`
Expand All @@ -71,7 +92,177 @@ provider "oci" {



. Override other parameters:
. Override other parameters in terraform.tfvars:

* `compartment_id`
* `label_prefix`
* `vcn_dns_label`
* `vcn_name`

. Optional parameters to override:

* `internet_gateway_enabled`
* `nat_gateway_enabled`
* `service_gateway_enabled`
* `tags`

. Run Terraform:

+
[source,bash]
----
terraform init
terraform plan
terraform apply
----

=== Provisioning using the HashiCorp registry module

You can also use the method below to reuse this in your own module.

. Create a variable.tf file in your root project and add the following:

+
----
# provider identity parameters
variable "api_fingerprint" {
description = "fingerprint of oci api private key"
type = string
}
variable "api_private_key_path" {
description = "path to oci api private key used"
type = string
}
variable "region" {
description = "the oci region where resources will be created"
type = string
}
variable "tenancy_id" {
description = "tenancy id where to create the sources"
type = string
}
variable "user_id" {
description = "id of user that terraform will use to create the resources"
type = string
}
# general oci parameters
variable "compartment_id" {
description = "compartment id where to create all resources"
type = string
}
variable "label_prefix" {
description = "a string that will be prepended to all resources"
type = string
}
# vcn parameters
variable "internet_gateway_enabled" {
description = "whether to create the internet gateway"
default = false
type = bool
}
variable "nat_gateway_enabled" {
description = "whether to create a nat gateway in the vcn"
default = false
type = bool
}
variable "service_gateway_enabled" {
description = "whether to create a service gateway"
default = false
type = bool
}
variable "tags" {
description = "simple key-value pairs to tag the resources created"
type = map(any)
default = {
"environment" = "dev"
}
}
variable "vcn_cidr" {
description = "cidr block of VCN"
default = "10.0.0.0/16"
type = string
}
variable "vcn_dns_label" {
description = "A DNS label for the VCN, used in conjunction with the VNIC's hostname and subnet's DNS label to form a fully qualified domain name (FQDN) for each VNIC within this subnet"
type = string
}
variable "vcn_name" {
description = "user-friendly name of to use for the vcn to be appended to the label_prefix"
type = string
}
----

. Create a provider.tf file in your root directory and add the following:

+
[source,hcl]
----
provider "oci" {
fingerprint = var.api_fingerprint
private_key_path = var.api_private_key_path
region = var.region
tenancy_ocid = var.tenancy_id
user_ocid = var.user_id
}
----

. Create a main.tf file and add the following:

+
[source,hcl]
----
module "vcn" {
source = "oracle-terraform-modules/vcn/oci"
version = "1.0.2"
# provider parameters
region = var.region
# general oci parameters
compartment_id = var.compartment_id
label_prefix = var.label_prefix
# vcn parameters
internet_gateway_enabled = var.internet_gateway_enabled
nat_gateway_enabled = var.nat_gateway_enabled
service_gateway_enabled = var.service_gateway_enabled
tags = var.tags
vcn_cidr = var.vcn_cidr
vcn_dns_label = var.vcn_dns_label
vcn_name = var.vcn_name
}
----

. Copy terraform.tfvars.example to terraform.tfvars and set the mandatory provider parameters:

+
[source,bash]
----
cp terraform.tfvars.example terraform.tfvars
----

* `api_fingerprint`
* `api_private_key_path`
* `region`
* `tenancy_id`
* `user_id`

. Override other parameters in terraform.tfvars:

* `compartment_id`
* `label_prefix`
Expand Down
38 changes: 10 additions & 28 deletions docs/terraformoptions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

Configuration Terraform Options:

. link:#provider-and-identity[Provider and Identity]
. link:#provider[Provider]
. link:#general-oci[General OCI]
. link:#oci-networking[VCN]

Ensure you review the {uri-terraform-dependencies}[dependencies].

== Provider and Identity
== Provider

[stripes=odd,cols="1d,4d,3a,3a", options=header,width="100%"]
|===
Expand All @@ -29,30 +29,10 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
|Values
|Default

|`api_fingerprint`
|ssl fingerprint of api public key. *Required when configuring provider*.
|
|None

|`api_private_key_path`
|path to api private key. *Required when configuring provider*.
|
|None

|`region`
|Region where to provision the OKE cluster. {uri-oci-region}[List of regions]. *Required when configuring provider*.
|
|None

|`tenancy_id`
|Tenancy id of the user. *Required when configuring provider*.
|
|None

|`user_id`
|User's id. *Required when configuring provider*.
|
|None

|===

Expand All @@ -68,12 +48,12 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
|`compartment_id`
|Compartment id where the VCN Cluster will be provisioned. *Required*.
|
|None
|

|`label_prefix`
|a string to be prepended to the name of resources. *Required*.
|
|None
|


|===
Expand All @@ -93,11 +73,13 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
[source]
----
tags = {
department = "finance"
environment = "dev"
lob = "finance"
}
----
|None
|tags = {
environment = "dev"
}

|`internet_gateway_enabled`
|Whether to create an internet gateway.
Expand All @@ -122,11 +104,11 @@ tags = {
|`vcn_dns_label`
|The internal DNS domain for resources created and prepended to "oraclevcn.com" which is the VCN-internal domain name. *Required*
|
|None
|

|`vcn_name`
|The name of the VCN that will be appended to the label_prefix. *Required*
|
|None
|

|===
10 changes: 1 addition & 9 deletions terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@

# provider identity parameters

api_fingerprint = ""

api_private_key_path = ""

region = "us-phoenix-1"

tenancy_id = ""

user_id = ""

# general oci parameters

compartment_id = ""
Expand All @@ -33,6 +25,6 @@ vcn_dns_label = "vcn"
vcn_name = "vcn"

tags = {
department = "finance"
environment = "dev"
lob = "finance"
}
Loading

0 comments on commit 9bce3d5

Please sign in to comment.