Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Towards first release
Browse files Browse the repository at this point in the history
  • Loading branch information
lfeldman committed Feb 25, 2021
1 parent 567e785 commit 2cf55bf
Show file tree
Hide file tree
Showing 13 changed files with 96 additions and 32 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ If you don't have the required permissions and quota, contact your tenancy admin

## Deploy Using Oracle Resource Manager

1. Click [![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://console.us-phoenix-1.oraclecloud.com/resourcemanager/stacks/create?region=home&zipUrl=https://github.com/oracle-quickstart/oci-arch-hub-spoke/raw/master/resource-manager/hub-spoke.zip)
1. Click [![Deploy to Oracle Cloud](https://oci-resourcemanager-plugin.plugins.oci.oraclecloud.com/latest/deploy-to-oracle-cloud.svg)](https://cloud.oracle.com/resourcemanager/stacks/create?region=home&zipUrl=https://github.com/oracle-quickstart/oci-arch-hub-spoke/raw/master/resource-manager/oci-arch-hub-spoke-stack-latest.zip)

If you aren't already signed in, when prompted, enter the tenancy and user credentials.

Expand Down
16 changes: 9 additions & 7 deletions hub.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ resource "oci_core_vcn" "hub" {
dns_label = var.hub_vcn_dns_label
compartment_id = var.compartment_ocid
display_name = var.hub_vcn_display_name
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}

#IGW
Expand All @@ -14,6 +15,7 @@ resource "oci_core_internet_gateway" "hub_internet_gateway" {
vcn_id = oci_core_vcn.hub.id
enabled = "true"
display_name = "IGW_HUB"
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}

#Default route table hub
Expand All @@ -34,6 +36,7 @@ resource "oci_core_default_route_table" "hub_default_route_table" {
destination = var.spoke02_vcn_cidr_block
destination_type = "CIDR_BLOCK"
}
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}

# Peering connections to the spokes
Expand All @@ -42,20 +45,23 @@ resource "oci_core_local_peering_gateway" "hub_spoke01_local_peering_gateway" {
vcn_id = oci_core_vcn.hub.id
display_name = "hub_spoke01"
peer_id = oci_core_local_peering_gateway.spoke01_hub_local_peering_gateway.id
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}

resource "oci_core_local_peering_gateway" "hub_spoke02_local_peering_gateway" {
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.hub.id
display_name = "hub_spoke02"
peer_id = oci_core_local_peering_gateway.spoke02_hub_local_peering_gateway.id
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}
#Hub pub subnet
resource "oci_core_subnet" "hub_subnet_pub01" {
cidr_block = var.hub_subnet_pub01_cidr_block
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.hub.id
display_name = var.hub_subnet_pub01_display_name
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}

# Bastion VM
Expand All @@ -79,13 +85,9 @@ resource "oci_core_instance" "bastion_instance" {
}

metadata = {
ssh_authorized_keys = var.ssh_public_key
ssh_authorized_keys = tls_private_key.public_private_key_pair.public_key_openssh
}
# timeouts {
# create = "60m"
# }

defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}

output "bastion_public_ip" {
value = oci_core_instance.bastion_instance.*.public_ip
}
11 changes: 11 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
output "bastion_public_ip" {
value = oci_core_instance.bastion_instance.*.public_ip
}

output "vcn_id_spoke01" {
value = oci_core_vcn.spoke01.id
}

output "vcn_id_spoke02" {
value = oci_core_vcn.spoke02.id
}
6 changes: 3 additions & 3 deletions provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

provider "oci" {
tenancy_ocid = var.tenancy_ocid
# user_ocid = var.user_ocid
# fingerprint = var.fingerprint
# private_key_path = var.private_key_path
user_ocid = var.user_ocid
fingerprint = var.fingerprint
private_key_path = var.private_key_path
region = var.region
}
Binary file removed resource-manager/hub-spoke-20201019.zip
Binary file not shown.
Binary file removed resource-manager/hub-spoke.zip
Binary file not shown.
Binary file not shown.
35 changes: 23 additions & 12 deletions schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
- title: Required Configuration
visible: true
variables:
- availablity_domain_name
- compartment_ocid
- ssh_public_key
- igw_display_name
- hub_vcn_display_name
- hub_vcn_cidr_block
Expand All @@ -36,6 +36,7 @@
- spoke02_vcn_cidr_block
- spoke02_subnet_priv01_display_name
- spoke02_subnet_priv01_cidr_block
- release


- title: Optional Configuration
Expand All @@ -58,11 +59,15 @@
title: Region
description: Region where you want to deploy the resources defined by this stack

ssh_public_key:
type: oci:core:ssh:publickey
availablity_domain_name:
type: oci:identity:availabilitydomain:name
required: true
title: SSH public Key
description: Public key
visibile: true
title: "Availability Domain to be chosen"
description: "Choose Availability Domain where infrastructure will be deployed."
dependsOn:
regionName: ${region}
compartmentId: ${compartment_ocid}

igw_display_name:
type: string
Expand Down Expand Up @@ -161,13 +166,19 @@
description: Display name assigned to the private subnet in the Spoke 2 VCN

InstanceShape:
type: oci:core:instanceshape:name
required: false
title: Instance Shape
description: A shape is a template that determines the number of CPUs, amount of memory, and other resources allocated to Bastion instance.
default: "VM.Standard.E2.1.Micro"
dependsOn:
compartmentId: ${compartment_ocid}
type: oci:core:instanceshape:name
required: false
title: Instance Shape
description: A shape is a template that determines the number of CPUs, amount of memory, and other resources allocated to Bastion instance.
default: "VM.Standard.E2.1.Micro"
dependsOn:
compartmentId: ${compartment_ocid}

release:
type: string
required: false
visible: false
title: "Reference Architecture Release (OCI Architecture Center)"

instance_os:
type: enum
Expand Down
7 changes: 4 additions & 3 deletions spoke01.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ resource "oci_core_vcn" "spoke01" {
dns_label = var.spoke01_vcn_dns_label
compartment_id = var.compartment_ocid
display_name = var.spoke01_vcn_display_name
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}
#LPG Spoke-HUB
resource "oci_core_local_peering_gateway" "spoke01_hub_local_peering_gateway" {
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.spoke01.id
display_name = "spoke01_hub_lpg"
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}

#Default route table spoke01
Expand All @@ -22,17 +24,16 @@ resource "oci_core_default_route_table" "spoke01_default_route_table" {
destination = "0.0.0.0/0"
destination_type = "CIDR_BLOCK"
}
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}
resource "oci_core_subnet" "spoke01_subnet_priv01" {
cidr_block = var.spoke01_subnet_priv01_cidr_block
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.spoke01.id
display_name = var.spoke01_subnet_priv01_display_name
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}

output "vcn_id_spoke01" {
value = oci_core_vcn.spoke01.id
}

# resource "oci_core_instance" "spoke01_test_instance" {
# availability_domain = data.oci_identity_availability_domains.ADs.availability_domains[0]["name"]
Expand Down
8 changes: 5 additions & 3 deletions spoke02.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ resource "oci_core_vcn" "spoke02" {
dns_label = var.spoke02_vcn_dns_label
compartment_id = var.compartment_ocid
display_name = var.spoke02_vcn_display_name
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}

#LPG Spoke-HUB
resource "oci_core_local_peering_gateway" "spoke02_hub_local_peering_gateway" {
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.spoke02.id
display_name = "spoke02_hub_lpg"
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}

#Default route table spoke02
Expand All @@ -22,17 +25,16 @@ resource "oci_core_default_route_table" "spoke02_default_route_table" {
destination = "0.0.0.0/0"
destination_type = "CIDR_BLOCK"
}
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}
resource "oci_core_subnet" "spoke02_subnet_priv01" {
cidr_block = var.spoke02_subnet_priv01_cidr_block
compartment_id = var.compartment_ocid
vcn_id = oci_core_vcn.spoke02.id
display_name = var.spoke02_subnet_priv01_display_name
defined_tags = {"${oci_identity_tag_namespace.ArchitectureCenterTagNamespace.name}.${oci_identity_tag.ArchitectureCenterTag.name}" = var.release }
}

output "vcn_id_spoke02" {
value = oci_core_vcn.spoke02.id
}

# resource "oci_core_instance" "spoke02_test_instance" {
# availability_domain = data.oci_identity_availability_domains.ADs.availability_domains[0]["name"]
Expand Down
25 changes: 25 additions & 0 deletions tags.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
resource "oci_identity_tag_namespace" "ArchitectureCenterTagNamespace" {
compartment_id = var.compartment_ocid
description = "ArchitectureCenterTagNamespace"
name = "ArchitectureCenter\\hub-spoke-network"

provisioner "local-exec" {
command = "sleep 10"
}
}

resource "oci_identity_tag" "ArchitectureCenterTag" {
description = "ArchitectureCenterTag"
name = "release"
tag_namespace_id = oci_identity_tag_namespace.ArchitectureCenterTagNamespace.id

validator {
validator_type = "ENUM"
values = ["release", "1.0"]
}

provisioner "local-exec" {
command = "sleep 20"
}

}
6 changes: 6 additions & 0 deletions tls.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## Copyright (c) 2020, Oracle and/or its affiliates.
## All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl

resource "tls_private_key" "public_private_key_pair" {
algorithm = "RSA"
}
12 changes: 9 additions & 3 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@
## All rights reserved. The Universal Permissive License (UPL), Version 1.0 as shown at http://oss.oracle.com/licenses/upl

variable "region" {}
# variable "fingerprint" {}
# variable "user_ocid" {}
variable "fingerprint" {}
variable "user_ocid" {}
variable "tenancy_ocid" {}
variable "compartment_ocid" {}
variable "ssh_public_key" {}
variable "private_key_path" {}
variable "availablity_domain_name" {}

variable "release" {
description = "Reference Architecture Release (OCI Architecture Center)"
default = "1.0"
}

variable "igw_display_name" {
default = "internet-gateway"
Expand Down

0 comments on commit 2cf55bf

Please sign in to comment.