Skip to content
This repository has been archived by the owner on Oct 31, 2019. It is now read-only.

This allows the user to specify an existing VCN instead of it being created #171

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
22 changes: 11 additions & 11 deletions bashsource.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource null_resource "build_source" {
provisioner "local-exec" {
command = "echo \"export KUBECONFIG=${path.module}/generated/kubeconfig\" > source.sh "
command = "echo \"export KUBECONFIG=${path.root}/generated/kubeconfig\" > ${var.label_prefix}source.sh"
}
}

Expand All @@ -17,7 +17,7 @@ resource null_resource "etcd-ad1" {
}

provisioner "local-exec" {
command = "echo 'alias ${var.label_prefix}etcdad1-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-etcd-ad1.instance_public_ips, count.index)}\"' >> source.sh"
command = "echo 'alias ${var.label_prefix}etcdad1-${count.index}=\"ssh -i ${path.root}/generated/instances_id_rsa opc@${element(module.instances-etcd-ad1.instance_public_ips, count.index)}\"' >> source.sh"
}
}

Expand All @@ -34,7 +34,7 @@ resource null_resource "etcd-ad2" {
}

provisioner "local-exec" {
command = "echo 'alias ${var.label_prefix}etcdad2-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-etcd-ad2.instance_public_ips, count.index)}\"' >> source.sh"
command = "echo 'alias ${var.label_prefix}etcdad2-${count.index}=\"ssh -i ${path.root}/generated/instances_id_rsa opc@${element(module.instances-etcd-ad2.instance_public_ips, count.index)}\"' >> source.sh"
}
}

Expand All @@ -51,7 +51,7 @@ resource null_resource "etcd-ad3" {
}

provisioner "local-exec" {
command = "echo 'alias ${var.label_prefix}etcad3-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-etcd-ad3.instance_public_ips, count.index)}\"' >> source.sh"
command = "echo 'alias ${var.label_prefix}etcad3-${count.index}=\"ssh -i ${path.root}/generated/instances_id_rsa opc@${element(module.instances-etcd-ad3.instance_public_ips, count.index)}\"' >> source.sh"
}
}

Expand All @@ -71,7 +71,7 @@ resource null_resource "k8smaster-ad1" {
}

provisioner "local-exec" {
command = "echo 'alias ${var.label_prefix}masterad1-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-k8smaster-ad1.public_ips, count.index)}\"' >> source.sh"
command = "echo 'alias ${var.label_prefix}masterad1-${count.index}=\"ssh -i ${path.root}/generated/instances_id_rsa opc@${element(module.instances-k8smaster-ad1.public_ips, count.index)}\"' >> source.sh"
}
}

Expand All @@ -87,7 +87,7 @@ resource null_resource "k8smaster-ad2" {
}

provisioner "local-exec" {
command = "echo 'alias ${var.label_prefix}masterad2-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-k8smaster-ad2.public_ips, count.index)}\"' >> source.sh"
command = "echo 'alias ${var.label_prefix}masterad2-${count.index}=\"ssh -i ${path.root}/generated/instances_id_rsa opc@${element(module.instances-k8smaster-ad2.public_ips, count.index)}\"' >> source.sh"
}
}

Expand All @@ -104,23 +104,23 @@ resource null_resource "k8smaster-ad3" {
}

provisioner "local-exec" {
command = "echo 'alias ${var.label_prefix}masterad3-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-k8smaster-ad3.public_ips, count.index)}\"' >> source.sh"
command = "echo 'alias ${var.label_prefix}masterad3-${count.index}=\"ssh -i ${path.root}/generated/instances_id_rsa opc@${element(module.instances-k8smaster-ad3.public_ips, count.index)}\"' >> source.sh"
}
}

resource null_resource "k8sworker-ad1" {
count = "${var.k8sWorkerAd1Count}"
depends_on = [
"module.instances-k8sworker-ad1",
]
]

triggers {
worker_id = "${element(module.instances-k8sworker-ad1.ids, count.index)}"
build_source_id = "${null_resource.build_source.id}"
}

provisioner "local-exec" {
command = "echo 'alias ${var.label_prefix}workerad1-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-k8sworker-ad1.public_ips, count.index)}\"' >> source.sh"
command = "echo 'alias ${var.label_prefix}workerad1-${count.index}=\"ssh -i ${path.root}/generated/instances_id_rsa opc@${element(module.instances-k8sworker-ad1.public_ips, count.index)}\"' >> source.sh"
}
}

Expand All @@ -136,7 +136,7 @@ resource null_resource "k8sworker-ad2" {
}

provisioner "local-exec" {
command = "echo 'alias ${var.label_prefix}workerad2-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-k8sworker-ad2.public_ips, count.index)}\"' >> source.sh"
command = "echo 'alias ${var.label_prefix}workerad2-${count.index}=\"ssh -i ${path.root}/generated/instances_id_rsa opc@${element(module.instances-k8sworker-ad2.public_ips, count.index)}\"' >> source.sh"
}
}

Expand All @@ -153,7 +153,7 @@ resource null_resource "k8sworker-ad3" {
}

provisioner "local-exec" {
command = "echo 'alias ${var.label_prefix}workerad3-${count.index}=\"ssh -i ${path.module}/generated/instances_id_rsa opc@${element(module.instances-k8sworker-ad3.public_ips, count.index)}\"' >> source.sh"
command = "echo 'alias ${var.label_prefix}workerad3-${count.index}=\"ssh -i ${path.root}/generated/instances_id_rsa opc@${element(module.instances-k8sworker-ad3.public_ips, count.index)}\"' >> source.sh"
}
}

15 changes: 14 additions & 1 deletion docs/input-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ region | us-phoenix-1 | String value of

## Optional Input Variables:

### VCN Configuration

By deafult a VCN, an Internet Gateway and a public route table out this gatewat will be created and used. If you wish to use an existing VCN then set the following variables. When using an existing VCN you need to make sure that the subnet ranges and DNS labels specified in the variables 'network_cidrs' and 'network_subnet_dns' do not overlap with existing values.

name | default |
------------------------------------|-------------------------|------------
vcn_id | "" (Optional) | The VCN OCID to use to configure all subnets with
vcn_dhcp_options_id | "" (Optional) | The DCHP options of the VCN to use when creating subnets
public_routetable_id | "" (Optional) | The routetable OCID that has access to the public internet via a Internet Gateway

### Compute Instance Configuration
name | default | description
------------------------------------|-------------------------|------------
Expand Down Expand Up @@ -101,6 +111,7 @@ control_plane_subnet_access | public | Whether instances in the con
k8s_master_lb_access | public | Whether the Kubernetes Master Load Balancer is launched in a public or private subnets
etcd_lb_access | private | Whether the etcd Load Balancer is launched in a public or private subnets


#### _Public_ Network Access (default)

![](./images/public_cp_subnet_access.jpg)
Expand All @@ -111,7 +122,9 @@ The following input variables are used to configure the inbound security rules o

name | default | description
------------------------------------|-------------------------|------------
network_cidrs | See map in variables.tf | A CIDR notation IP range of the VCN and its subnets.
vcn_cidr | 10.0.0.0/16 | The A CIDR notation IP range of the VCN
network_cidrs | See map in variables.tf | A CIDR notation IP range of the subnets within the VCN.
network_subnet_dns | See map in variables.tf | A DNS label for each of the subnets in the VCN (Max 15 characters)
etcd_cluster_ingress | 10.0.0.0/16 (VCN only) | A CIDR notation IP range that is allowed to access the etcd cluster. Must be a subset of the VCN CIDR.
etcd_ssh_ingress | 10.0.0.0/16 (VCN only) | A CIDR notation IP range that is allowed to SSH to etcd nodes. Must be a subset of the VCN CIDR.
master_ssh_ingress | 10.0.0.0/16 (VCN only) | A CIDR notation IP range that is allowed to access the master(s). Must be a subset of the VCN CIDR.
Expand Down
Loading