Skip to content

Commit

Permalink
added private ssh key as variable (#378)
Browse files Browse the repository at this point in the history
* added private ssh key as variable

Signed-off-by: Ali Mukadam <[email protected]>

* typo in terraform.tfvars.example

Signed-off-by: Ali Mukadam <[email protected]>

* updated changelog

Signed-off-by: Ali Mukadam <[email protected]>

* duplicate entry for api_key in terraform.tfvars.example

Signed-off-by: Ali Mukadam <[email protected]>
  • Loading branch information
hyder authored Sep 16, 2021
1 parent 3a407d5 commit 2802531
Show file tree
Hide file tree
Showing 26 changed files with 67 additions and 290 deletions.
23 changes: 12 additions & 11 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ The format is based on {uri-changelog}[Keep a Changelog].

=== Unreleased
# Breaking changes
* Set minimum version to Terraform 1.0.0
* Removed base module and use vcn, bastion and operator modules directly
* Renamed and standardized all control variables
* Removed deprecated template provider dependencies
* Made bastion and operator modules conditional
* Added LPGs for hub and spoke deployment model
* Set minimum version to Terraform 1.0.0
* Removed identity parameters in between modules
* Removed identity parameters in between modules to improve reusability
* Renamed okenetwork submodule to network
* Created a new submodule (extensions) and moved all scripts and extra things there
* Moved dynamic group and policy for kms into oke module
Expand All @@ -24,20 +23,22 @@ The format is based on {uri-changelog}[Keep a Changelog].

# Changes
* Changed default Kubernetes version to v1.20.8 and removed v1.16.8, v1.17.9 from docs.
* Added support for reserved public IP address for NAT gateway
* Bug fix: Use correct calico file to install calico for networking policy only (#307)
* Added support for GPU and ARM shapes (#302)
* VCN module upgraded to VCN 3.0.0. This allows supporting multiple cidr blocks (#360 )
* kubeconfig on operator always uses PRIVATE_ENDPOINT (#358 )
* Documented providers in quickstart (#355 )
* Renamed tags to freeform_tags in line with other modules
* Added validation on some variables
* VCN module upgraded to VCN 3.0.0. This allows supporting multiple cidr blocks (#360)
* kubeconfig on operator always uses PRIVATE_ENDPOINT (#358)
* Documented providers in quickstart (#355)
* Renamed tags to freeform_tags in line with other modules (#364)
* Added validation on some variables (#370)

# New Features

* Added OCI Bastion Service as option to access operator or control plane
* Added support for reserved public IP address for NAT gateway (#311)
* Added LPGs for hub and spoke deployment model (#295)
* Allow access to operator via OCI Bastion service (#352)
* Added support for using NSGs for cluster endpoint (#343 )
* Added option to disable worker node access to Internet. Users can only pull images from OCIR (#331 )
* Added option to disable worker node access to Internet. Users can only pull images from OCIR (#331)
* Added ability to specify api and private ssh keys using heredoc format with a variable (#375)

# Bug fixes
* Added home region to update dynamic group script for cases when actual region is different from tenancy home region (#347)
Expand Down
18 changes: 16 additions & 2 deletions docs/terraformoptions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
|none

|api_private_key
|The contents of the private key file to use with OCI API. This takes precedence over private_key_path if both are specified in the provider. *Maybe required depending on your authentication method.*
|
|The contents of the private key file to use with OCI API. This takes precedence over private_key_path if both are specified in the provider. *Maybe required depending on your authentication method.* Use the heredoc format if you are specifying the key with this variable.
|<<EOT
-----BEGIN RSA PRIVATE KEY-----
content+of+api+key
-----END RSA PRIVATE KEY-----
EOT
|none

|api_private_key_password
Expand Down Expand Up @@ -104,6 +108,16 @@ Ensure you review the {uri-terraform-dependencies}[dependencies].
|Values
|Default

|ssh_private_key
|The contents of the private ssh key file. Use the heredoc format if you are specifying the private key.
|
<<EOT
-----BEGIN RSA PRIVATE KEY-----
content+of+api+key
-----END RSA PRIVATE KEY-----
EOT
|

|ssh_private_key_path
|path to ssh private key. The same key will be used to access worker nodes using SSH. *Required* if bastion is enabled.

Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ module "extensions" {
region = var.region

# ssh keys
ssh_private_key = var.ssh_private_key
ssh_private_key_path = var.ssh_private_key_path
ssh_public_key = var.ssh_public_key
ssh_public_key_path = var.ssh_public_key_path
Expand Down
4 changes: 2 additions & 2 deletions modules/extensions/activeworker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ resource "null_resource" "check_worker_active" {

connection {
host = var.operator_private_ip
private_key = file(var.ssh_private_key_path)
private_key = local.ssh_private_key
timeout = "40m"
type = "ssh"
user = "opc"

bastion_host = var.bastion_public_ip
bastion_user = "opc"
bastion_private_key = file(var.ssh_private_key_path)
bastion_private_key = local.ssh_private_key
}

depends_on = [null_resource.write_kubeconfig_on_operator]
Expand Down
4 changes: 2 additions & 2 deletions modules/extensions/calico.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
resource "null_resource" "install_calico" {
connection {
host = var.operator_private_ip
private_key = file(var.ssh_private_key_path)
private_key = local.ssh_private_key
timeout = "40m"
type = "ssh"
user = "opc"

bastion_host = var.bastion_public_ip
bastion_user = "opc"
bastion_private_key = file(var.ssh_private_key_path)
bastion_private_key = local.ssh_private_key
}

depends_on = [null_resource.install_kubectl_operator, null_resource.write_kubeconfig_on_operator]
Expand Down
4 changes: 2 additions & 2 deletions modules/extensions/drain.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
resource "null_resource" "drain_nodes" {
connection {
host = var.operator_private_ip
private_key = file(var.ssh_private_key_path)
private_key = local.ssh_private_key
timeout = "40m"
type = "ssh"
user = "opc"

bastion_host = var.bastion_public_ip
bastion_user = "opc"
bastion_private_key = file(var.ssh_private_key_path)
bastion_private_key = local.ssh_private_key
}

provisioner "file" {
Expand Down
4 changes: 2 additions & 2 deletions modules/extensions/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ resource "null_resource" "update_dynamic_group" {

connection {
host = var.operator_private_ip
private_key = file(var.ssh_private_key_path)
private_key = local.ssh_private_key
timeout = "40m"
type = "ssh"
user = "opc"

bastion_host = var.bastion_public_ip
bastion_user = "opc"
bastion_private_key = file(var.ssh_private_key_path)
bastion_private_key = local.ssh_private_key
}

depends_on = [time_sleep.wait_30_seconds]
Expand Down
8 changes: 4 additions & 4 deletions modules/extensions/k8stools.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
resource "null_resource" "install_kubectl_operator" {
connection {
host = var.operator_private_ip
private_key = file(var.ssh_private_key_path)
private_key = local.ssh_private_key
timeout = "40m"
type = "ssh"
user = "opc"

bastion_host = var.bastion_public_ip
bastion_user = "opc"
bastion_private_key = file(var.ssh_private_key_path)
bastion_private_key = local.ssh_private_key
}

provisioner "file" {
Expand All @@ -34,14 +34,14 @@ resource "null_resource" "install_kubectl_operator" {
resource "null_resource" "install_helm_operator" {
connection {
host = var.operator_private_ip
private_key = file(var.ssh_private_key_path)
private_key = local.ssh_private_key
timeout = "40m"
type = "ssh"
user = "opc"

bastion_host = var.bastion_public_ip
bastion_user = "opc"
bastion_private_key = file(var.ssh_private_key_path)
bastion_private_key = local.ssh_private_key
}

depends_on = [null_resource.install_kubectl_operator, null_resource.write_kubeconfig_on_operator]
Expand Down
4 changes: 2 additions & 2 deletions modules/extensions/kubeconfig.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ resource "local_file" "kube_config_file" {
resource "null_resource" "write_kubeconfig_on_operator" {
connection {
host = var.operator_private_ip
private_key = file(var.ssh_private_key_path)
private_key = local.ssh_private_key
timeout = "40m"
type = "ssh"
user = "opc"

bastion_host = var.bastion_public_ip
bastion_user = "opc"
bastion_private_key = file(var.ssh_private_key_path)
bastion_private_key = local.ssh_private_key
}

depends_on = [null_resource.install_kubectl_operator]
Expand Down
2 changes: 1 addition & 1 deletion modules/extensions/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl

locals {

ssh_private_key = var.ssh_private_key != "" ? var.ssh_private_key : var.ssh_private_key_path != "none" ? file(var.ssh_private_key_path) : null
node_pools_size_list = [
for node_pool in data.oci_containerengine_node_pools.all_node_pools.node_pools :
node_pool.node_config_details[0].size
Expand Down
4 changes: 2 additions & 2 deletions modules/extensions/metricserver.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
resource "null_resource" "enable_metric_server" {
connection {
host = var.operator_private_ip
private_key = file(var.ssh_private_key_path)
private_key = local.ssh_private_key
timeout = "40m"
type = "ssh"
user = "opc"

bastion_host = var.bastion_public_ip
bastion_user = "opc"
bastion_private_key = file(var.ssh_private_key_path)
bastion_private_key = local.ssh_private_key
}

depends_on = [null_resource.install_kubectl_operator, null_resource.write_kubeconfig_on_operator]
Expand Down
4 changes: 2 additions & 2 deletions modules/extensions/secrets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ resource "null_resource" "secret" {
}
connection {
host = var.operator_private_ip
private_key = file(var.ssh_private_key_path)
private_key = local.ssh_private_key
timeout = "40m"
type = "ssh"
user = "opc"

bastion_host = var.bastion_public_ip
bastion_user = "opc"
bastion_private_key = file(var.ssh_private_key_path)
bastion_private_key = local.ssh_private_key
}

depends_on = [null_resource.write_kubeconfig_on_operator]
Expand Down
4 changes: 2 additions & 2 deletions modules/extensions/serviceaccount.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
resource "null_resource" "create_service_account" {
connection {
host = var.operator_private_ip
private_key = file(var.ssh_private_key_path)
private_key = local.ssh_private_key
timeout = "40m"
type = "ssh"
user = "opc"

bastion_host = var.bastion_public_ip
bastion_user = "opc"
bastion_private_key = file(var.ssh_private_key_path)
bastion_private_key = local.ssh_private_key
}

depends_on = [null_resource.install_kubectl_operator, null_resource.write_kubeconfig_on_operator]
Expand Down
2 changes: 2 additions & 0 deletions modules/extensions/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ variable "label_prefix" {}
variable "region" {}

# ssh keys
variable "ssh_private_key" {}

variable "ssh_private_key_path" {}

variable "ssh_public_key" {}
Expand Down
9 changes: 0 additions & 9 deletions modules/oke/scripts/generate_kubeconfig.template.sh

This file was deleted.

22 changes: 0 additions & 22 deletions modules/oke/scripts/install_metricserver.template.sh

This file was deleted.

58 changes: 0 additions & 58 deletions modules/oke/scripts/secret.py

This file was deleted.

14 changes: 0 additions & 14 deletions modules/policies/datasources.tf

This file was deleted.

Loading

0 comments on commit 2802531

Please sign in to comment.