new file: ansible/inv-gcp.yml
new file: ansible/inventory/gce.ini new file: ansible/inventory/gce.py new file: ansible/master-node-create.yaml new file: ansible/secrets.py new file: ansible/test-inv new file: ansible/test.yaml new file: ansible/work-kube-config.yaml new file: ansible/worker-config.yaml new file: ansible/yum-config-manager.yaml new file: gcp-lb/main.tf new file: gcp-lb/outputs.tf new file: gcp-lb/provider.tf new file: gcp-lb/variables.tf new file: k8s-master/firewall.tf new file: k8s-master/main.tf new file: k8s-master/network.tf new file: k8s-master/outputs.tf new file: k8s-master/provider.tf new file: k8s-master/scripts/get-metadata-gce.sh new file: k8s-master/scripts/id_ecdsa new file: k8s-master/scripts/id_ecdsa.pub new file: k8s-master/scripts/startup.sh new file: k8s-master/variables.tf new file: k8s-workers/firewall.tf new file: k8s-workers/main.tf new file: k8s-workers/outputs.tf new file: k8s-workers/provider.tf new file: k8s-workers/scripts/get-metadata-gce.sh new file: k8s-workers/scripts/id_ecdsa new file: k8s-workers/scripts/id_ecdsa.pub new file: k8s-workers/scripts/startup.sh new file: k8s-workers/variables.tf new file: main.tf new file: provider.tf new file: variables.tf new file: versions.tf Initial commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
# LAUNCH A NETWORK LOAD BALANCER
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
terraform {
|
||||
# The modules used in this example have been updated with 0.12 syntax, which means the example is no longer
|
||||
# compatible with any versions below 0.12.
|
||||
required_version = ">= 0.12"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# CONFIGURE OUR GCP CONNECTION
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
#provider "google-beta" {
|
||||
# version = "~> 2.7.0"
|
||||
# region = var.region
|
||||
# project = var.project
|
||||
#}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# CREATE THE INTERNAL TCP LOAD BALANCER
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
module "lb" {
|
||||
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
|
||||
# to a specific version of the modules, such as the following example:
|
||||
# source = "github.com/gruntwork-io/terraform-google-load-balancer.git//modules/network-load-balancer?ref=v0.2.0"
|
||||
source = "github.com/gruntwork-io/terraform-google-load-balancer.git//modules/network-load-balancer?ref=v0.2.1"
|
||||
#source = "../../modules/network-load-balancer"
|
||||
|
||||
name = var.name
|
||||
region = var.region
|
||||
project = var.project
|
||||
|
||||
enable_health_check = true
|
||||
health_check_port = "6443"
|
||||
health_check_path = "/api"
|
||||
|
||||
firewall_target_tags = [var.name]
|
||||
|
||||
# instances = [google_compute_instance.k8s-master.self_link]
|
||||
instances = "${var.gce-vms}"
|
||||
|
||||
custom_labels = var.custom_labels
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# LOAD BALANCER OUTPUTS
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
output "load_balancer_ip_address" {
|
||||
description = "Internal IP address of the load balancer"
|
||||
value = module.lb.load_balancer_ip_address
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
provider "google" {
|
||||
credentials = file("centos-k8s-d9557c7f6db3.json")
|
||||
project = "${var.project}"
|
||||
region = "${var.region}"
|
||||
}
|
||||
|
||||
provider "google-beta" {
|
||||
credentials = file("centos-k8s-d9557c7f6db3.json")
|
||||
project = "${var.project}"
|
||||
region = "${var.region}"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
# REQUIRED PARAMETERS
|
||||
# These variables are expected to be passed in by the operator
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
variable "project" {
|
||||
description = "The project ID to create the resources in."
|
||||
type = string
|
||||
default = "centos-k8s"
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
description = "The region to create the resources in."
|
||||
type = string
|
||||
default = "us-central1" # Iowa
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
description = "The GCP zone to create the sample compute instances in. Must within the region specified in 'var.region'"
|
||||
type = string
|
||||
default = "us-central1-a"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
# OPTIONAL PARAMETERS
|
||||
# These variables have defaults, but may be overridden by the operator.
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
variable "name" {
|
||||
description = "Name for the load balancer forwarding rule and prefix for supporting resources."
|
||||
type = string
|
||||
default = "k8s-lb"
|
||||
}
|
||||
|
||||
variable "custom_labels" {
|
||||
description = "A map of custom labels to apply to the resources. The key is the label name and the value is the label value."
|
||||
type = map(string)
|
||||
default = {}
|
||||
}
|
||||
|
||||
variable "gce-vms" {
|
||||
description = "Self link to VM for LB"
|
||||
type = list
|
||||
}
|
||||
Reference in New Issue
Block a user