Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@ See [troubleshooting](./docs/Troubleshooting.md) page.
### Terraform

- Google Provider - https://www.terraform.io/docs/providers/google/index.html
- Google GKE - https://www.terraform.io/docs/providers/google/r/container_cluster.html
- Google GKE - https://www.terraform.io/docs/providers/google/r/container_cluster
22 changes: 11 additions & 11 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ locals {

postgres_outputs = length(module.postgresql) != 0 ? { for k,v in module.postgresql :
k => {
"server_name" : module.postgresql[k].instance_name,
"fqdn" : module.postgresql[k].private_ip_address,
"admin" : local.postgres_servers[k].administrator_login,
"password" : local.postgres_servers[k].administrator_password,
"server_port" : "5432", # TODO - Create a var when supported
"ssl_enforcement_enabled" : local.postgres_servers[k].ssl_enforcement_enabled,
"connection_name" : module.postgresql[k].instance_connection_name,
"server_public_ip" : length(local.postgres_public_access_cidrs) > 0 ? module.postgresql[k].public_ip_address : null,
"server_cert" : module.postgresql[k].instance_server_ca_cert.0.cert,
"service_account" : module.sql_proxy_sa.0.service_account.email,
"internal" : false,
server_name : module.postgresql[k].instance_name,
fqdn : module.postgresql[k].private_ip_address,
admin : local.postgres_servers[k].administrator_login,
password : local.postgres_servers[k].administrator_password,
server_port : "5432", # TODO - Create a var when supported
ssl_enforcement_enabled : local.postgres_servers[k].ssl_enforcement_enabled,
connection_name : module.postgresql[k].instance_connection_name,
server_public_ip : length(local.postgres_public_access_cidrs) > 0 ? module.postgresql[k].public_ip_address : null,
server_cert : module.postgresql[k].instance_server_ca_cert.0.cert,
service_account : module.sql_proxy_sa.0.service_account.email,
internal : false,
}
} : {}

Expand Down
14 changes: 7 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ resource "google_filestore_instance" "rwx" {
name = "${var.prefix}-rwx-filestore"
count = var.storage_type == "ha" ? 1 : 0
tier = upper(var.filestore_tier)
zone = local.zone
location = local.location
labels = var.tags

file_shares {
Expand All @@ -80,7 +80,7 @@ data "google_container_engine_versions" "gke-version" {

module "gke" {
source = "terraform-google-modules/kubernetes-engine/google//modules/private-cluster"
version = "15.0.2"
version = "23.1.0"
project_id = var.project
name = "${var.prefix}-gke"
region = local.region
Expand Down Expand Up @@ -112,7 +112,7 @@ module "gke" {

monitoring_service = var.create_gke_monitoring_service ? var.gke_monitoring_service : "none"

cluster_autoscaling = var.enable_cluster_autoscaling ? { "enabled": true, "max_cpu_cores": var.cluster_autoscaling_max_cpu_cores, "max_memory_gb": var.cluster_autoscaling_max_memory_gb, "min_cpu_cores": 1, "min_memory_gb": 1 } : { "enabled": false, "max_cpu_cores": 0, "max_memory_gb": 0, "min_cpu_cores": 0, "min_memory_gb": 0}
cluster_autoscaling = var.enable_cluster_autoscaling ? { enabled: true, max_cpu_cores: var.cluster_autoscaling_max_cpu_cores, max_memory_gb: var.cluster_autoscaling_max_memory_gb, min_cpu_cores: 1, min_memory_gb: 1, gpu_resources = [] } : { enabled: false, max_cpu_cores: 0, max_memory_gb: 0, min_cpu_cores: 0, min_memory_gb: 0, gpu_resources = []}

master_authorized_networks = concat([
for cidr in (local.cluster_endpoint_public_access_cidrs): {
Expand Down Expand Up @@ -194,10 +194,10 @@ module "kubeconfig" {
depends_on = [ module.gke ]
}

# Module Registry - https://registry.terraform.io/modules/GoogleCloudPlatform/sql-db/google/5.1.0/submodules/postgresql
# Module Registry - https://registry.terraform.io/modules/GoogleCloudPlatform/sql-db/google/12.0.0/submodules/postgresql
module "postgresql" {
source = "GoogleCloudPlatform/sql-db/google//modules/postgresql"
version = "6.0.0"
version = "12.0.0"
project_id = var.project

for_each = local.postgres_servers != null ? length(local.postgres_servers) != 0 ? local.postgres_servers : {} : {}
Expand Down Expand Up @@ -236,7 +236,7 @@ module "postgresql" {
ip_configuration = {
private_network = module.vpc.network_self_link
require_ssl = each.value.ssl_enforcement_enabled

allocated_ip_range = null
ipv4_enabled = length(local.postgres_public_access_cidrs) > 0 ? true : false
authorized_networks = [
for cidr in local.postgres_public_access_cidrs: {
Expand All @@ -248,7 +248,7 @@ module "postgresql" {

module "sql_proxy_sa" {
source = "terraform-google-modules/service-accounts/google"
version = "4.0.0"
version = "4.1.1"
count = var.postgres_servers != null ? length(var.postgres_servers) != 0 ? 1 : 0 : 0
project_id = var.project
prefix = var.prefix
Expand Down
2 changes: 1 addition & 1 deletion modules/google_vm/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "address" {
source = "terraform-google-modules/address/google"
version = "3.0.0"
version = "3.1.1"
project_id = var.project
region = var.region
address_type = "EXTERNAL"
Expand Down
2 changes: 1 addition & 1 deletion modules/network/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ variable "tags" {
variable "vpc_name" {
type = string
default = ""
description = "Name of pre-exising VPC. Leave blank to have one created"
description = "Name of pre-existing VPC. Leave blank to have one created"
}
variable "subnet_names" {
type = map(string)
Expand Down
4 changes: 2 additions & 2 deletions network.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ data "google_compute_address" "nat_address" {
module "nat_address" {
count = length(var.nat_address_name) == 0 ? 1 : 0
source = "terraform-google-modules/address/google"
version = "3.0.0"
version = "3.1.1"
project_id = var.project
region = local.region
address_type = "EXTERNAL"
Expand All @@ -20,7 +20,7 @@ module "nat_address" {
module "cloud_nat" {
count = length(var.nat_address_name) == 0 ? 1 : 0
source = "terraform-google-modules/cloud-nat/google"
version = "2.0.0"
version = "2.2.1"
project_id = var.project
name = "${var.prefix}-cloud-nat"
region = local.region
Expand Down
10 changes: 5 additions & 5 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ variable "location" {
The GCP Region (i.e. us-east1) or GCP Zone (i.e. us-east1-b) to provision all resources in this script.
Choosing a Region will make this a multi-zonal cluster.
If you aren't sure which to choose, go with a ZONE instead of a region.
If not set, it defaults to the google environment variables, as documented in https://www.terraform.io/docs/providers/google/guides/provider_reference.html"
If not set, it defaults to the google environment variables, as documented in https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference"
EOF
}

Expand Down Expand Up @@ -154,7 +154,7 @@ variable "storage_type" {
}

variable "minimum_initial_nodes" {
description = "Number of initital nodes to aim for to overcome the Ingress quota limit of 100"
description = "Number of initial nodes to aim for to overcome the Ingress quota limit of 100"
default = 6
}
# Default Node pool config
Expand Down Expand Up @@ -316,15 +316,15 @@ variable "postgres_servers" {
can(regex("^[a-z]+[a-z0-9-]*[a-zA-Z0-9]$", k)),
])
]) : false : true
error_message = "ERROR: The database server name must start with a letter, cannot end with a hyphen, must be between 1-88 characters in length, and can only contain hyphends, letters, and numbers."
error_message = "ERROR: The database server name must start with a letter, cannot end with a hyphen, must be between 1-88 characters in length, and can only contain hyphens, letters, and numbers."
}

# Checking user provided login

# Checking user provided password
}

## filstore
## filestore
variable filestore_size_in_gb {
default = null
}
Expand Down Expand Up @@ -362,7 +362,7 @@ variable "gke_monitoring_service" {
variable "vpc_name" {
type = string
default = ""
description = "Name of exising VPC. Leave blank to have one created"
description = "Name of existing VPC. Leave blank to have one created"
}

variable "nat_address_name" {
Expand Down
8 changes: 4 additions & 4 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "3.78.0"
version = "4.37.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "3.78.0"
version = "4.37.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "2.13.0" # Constrained by Google
}
local = {
source = "hashicorp/local"
version = "2.1.0"
version = "2.2.3"
}
template = {
source = "hashicorp/template"
Expand All @@ -32,7 +32,7 @@ terraform {
}
external = {
source = "hashicorp/external"
version = "2.1.0"
version = "2.2.2" # Constrained by Google
}
time = {
source = "hashicorp/time"
Expand Down