Skip to content

Commit 2edc763

Browse files
committed
examples
Signed-off-by: junior <junior@users.noreply.github.com>
1 parent c4c27d4 commit 2edc763

File tree

7 files changed

+122
-3
lines changed

7 files changed

+122
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ $${\color{red}OKE \space Cluster \space deployment \space yet.}$$
1010

1111
[![Stack Release](https://img.shields.io/github/v/release/oracle-quickstart/terraform-oci-networking.svg)](https://github.com/oracle-quickstart/terraform-oci-networking/releases)
1212
[![Stack Build](https://img.shields.io/github/workflow/status/oracle-quickstart/terraform-oci-networking/Generate%20stacks%20and%20publish%20release?label=stack&logo=oracle&logoColor=red)][magic_oke_stack]
13-
![AquaSec TFSec](https://img.shields.io/github/workflow/status/oracle-quickstart/terraform-oci-networking/tfsec?label=tfsec&logo=aqua)
13+
[![AquaSec TFSec](https://img.shields.io/github/workflow/status/oracle-quickstart/terraform-oci-networking/tfsec?label=tfsec&logo=aqua)](#)
1414
![Terraform](https://img.shields.io/badge/terraform->%3D%201.1-%235835CC.svg?logo=terraform)
15-
![Stack License](https://img.shields.io/github/license/oracle-quickstart/terraform-oci-networking)
15+
[![Stack License](https://img.shields.io/github/license/oracle-quickstart/terraform-oci-networking)](https://github.com/oracle-quickstart/terraform-oci-networking/tree/main/LICENSE)
1616
![Stack Downloads](https://img.shields.io/github/downloads/oracle-quickstart/terraform-oci-networking/total?logo=terraform)
1717
[![GitHub issues](https://img.shields.io/github/issues/oracle-quickstart/terraform-oci-networking.svg)](https://github.com/oracle-quickstart/terraform-oci-networking/issues)
1818

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0
1+
0.1.1
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
#
4+
5+
terraform {
6+
required_version = ">= 1.1"
7+
required_providers {
8+
oci = {
9+
source = "oracle/oci"
10+
version = "~> 4, < 5"
11+
# https://registry.terraform.io/providers/oracle/oci/
12+
configuration_aliases = [oci.home_region, oci.current_region]
13+
}
14+
local = {
15+
source = "hashicorp/local"
16+
version = "~> 2"
17+
# https://registry.terraform.io/providers/hashicorp/local/
18+
}
19+
random = {
20+
source = "hashicorp/random"
21+
version = "~> 3"
22+
# https://registry.terraform.io/providers/hashicorp/random/
23+
}
24+
}
25+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module "subnets" {
2+
for_each = { for map in local.subnets : map.subnet_name => map }
3+
source = "github.com/oracle-quickstart/terraform-oci-networking//modules/subnet?ref=0.1.0"
4+
5+
# Oracle Cloud Infrastructure Tenancy and Compartment OCID
6+
compartment_ocid = var.compartment_ocid
7+
vcn_id = module.vcn.vcn_id
8+
9+
# Deployment Tags + Freeform Tags + Defined Tags
10+
subnet_tags = local.oci_tag_values
11+
12+
# Subnet arguments
13+
create_subnet = true
14+
subnet_name = each.value.subnet_name
15+
cidr_block = each.value.cidr_block
16+
display_name = each.value.display_name # If null, is autogenerated
17+
dns_label = each.value.dns_label # If null, is autogenerated
18+
prohibit_public_ip_on_vnic = each.value.prohibit_public_ip_on_vnic
19+
prohibit_internet_ingress = each.value.prohibit_internet_ingress
20+
route_table_id = each.value.route_table_id # If null, the VCN's default route table is used
21+
dhcp_options_id = each.value.dhcp_options_id # If null, the VCN's default set of DHCP options is used
22+
security_list_ids = each.value.security_list_ids # If null, the VCN's default security list is used
23+
ipv6cidr_block = each.value.ipv6cidr_block # If null, no IPv6 CIDR block is assigned
24+
}
25+
26+
locals {
27+
subnets = [
28+
{
29+
subnet_name = "test_subnet"
30+
cidr_block = cidrsubnet("10.0.0.0/16", 8, 35) # e.g.: "10.0.35.0/24" = 254 usable IPs (10.20.35.0 - 10.20.35.255)
31+
display_name = "Test subnet (Dev)"
32+
dns_label = "testdev"
33+
prohibit_public_ip_on_vnic = false
34+
prohibit_internet_ingress = false
35+
route_table_id = "" # module.route_tables["public"].route_table_id
36+
dhcp_options_id = module.vcn.default_dhcp_options_id
37+
security_list_ids = [] # [module.security_lists["test_security_list"].security_list_id]
38+
ipv6cidr_block = null
39+
},
40+
]
41+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# OCI Provider
2+
variable "tenancy_ocid" {}
3+
variable "compartment_ocid" {}
4+
variable "region" {}
5+
variable "user_ocid" {
6+
default = ""
7+
}
8+
variable "fingerprint" {
9+
default = ""
10+
}
11+
variable "private_key_path" {
12+
default = ""
13+
}
14+
15+
variable "tag_values" {
16+
type = map(any)
17+
default = { "freeformTags" = {
18+
"Environment" = "Development", # e.g.: Demo, Sandbox, Development, QA, Stage, ...
19+
"DeploymentType" = "generic" }, # e.g.: App Type 1, App Type 2, Red, Purple, ...
20+
"definedTags" = {} }
21+
description = "Use Tagging to add metadata to resources. All resources created by this stack will be tagged with the selected tag values."
22+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module "vcn" {
2+
source = "github.com/oracle-quickstart/terraform-oci-networking//modules/vcn?ref=0.1.0"
3+
4+
# Oracle Cloud Infrastructure Tenancy and Compartment OCID
5+
compartment_ocid = var.compartment_ocid
6+
7+
# Deployment Tags + Freeform Tags + Defined Tags
8+
vcn_tags = local.oci_tag_values
9+
10+
# Virtual Cloud Network (VCN) arguments
11+
create_new_vcn = true
12+
existent_vcn_ocid = ""
13+
cidr_blocks = ["10.0.0.0/16"]
14+
display_name = "Dev VCN"
15+
dns_label = ""
16+
is_ipv6enabled = false
17+
ipv6private_cidr_blocks = []
18+
}

examples/basic-vcn/variables.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# OCI Provider
2+
variable "tenancy_ocid" {}
3+
variable "compartment_ocid" {}
4+
variable "region" {}
5+
variable "user_ocid" {
6+
default = ""
7+
}
8+
variable "fingerprint" {
9+
default = ""
10+
}
11+
variable "private_key_path" {
12+
default = ""
13+
}

0 commit comments

Comments
 (0)