Skip to content

Commit

Permalink
iaas: add descriptions and update deprecated fields
Browse files Browse the repository at this point in the history
closes #44

Signed-off-by: Ciro S. Costa <cscosta@pivotal.io>
  • Loading branch information
Ciro S. Costa committed May 3, 2019
1 parent 7735302 commit 3d1da46
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 28 deletions.
10 changes: 5 additions & 5 deletions terraform/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ resource "random_string" "password" {
}

resource "google_container_cluster" "main" {
name = "${var.name}"
zone = "${var.zone}"
name = "${var.name}"
location = "${var.zone}"

network = "${module.vpc.name}"
subnetwork = "${module.vpc.subnet-name}"
Expand Down Expand Up @@ -64,9 +64,9 @@ resource "google_container_node_pool" "main" {
provider = "google-beta"
count = "${length(var.node-pools)}"

zone = "${var.zone}"
cluster = "${google_container_cluster.main.name}"
name = "${lookup(var.node-pools[count.index], "name")}"
location = "${var.zone}"
cluster = "${google_container_cluster.main.name}"
name = "${lookup(var.node-pools[count.index], "name")}"

node_count = "${lookup(var.node-pools[count.index], "node_count")}"

Expand Down
8 changes: 4 additions & 4 deletions terraform/cluster/variables.tf
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
variable "name" {
default = ""
description = "TODO"
description = "The name of the GKE cluster to be created."
}

variable "zone" {
default = ""
description = "TODO"
description = "The zone where the cluster should live."
}

variable "region" {
default = ""
description = "TODO"
description = "The region in which the cluster should be located at."
}

variable "node-pools" {
description = "TODO"
description = "A list of node pool configurations to create and assign to the cluster."
type = "list"
}
15 changes: 11 additions & 4 deletions terraform/database/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# A piece of randomization that gets consumed by the
# `google_sql_database_instance` resources.
#
# This is needed in order to facilitate creating and recreating instances
# without waiting for the whole period that GCP requires to name reusal.
#
#
#
resource "random_id" "instance-name" {
byte_length = 4
}
Expand All @@ -7,7 +15,6 @@ resource "google_sql_database_instance" "main" {
region = "${var.region}"
database_version = "POSTGRES_9_6"


settings {
availability_type = "ZONAL"
disk_autoresize = true
Expand All @@ -17,9 +24,9 @@ resource "google_sql_database_instance" "main" {

database_flags = [
{
name = "log_min_duration_statement"
value = "-1"
}
name = "log_min_duration_statement"
value = "-1"
},
]

ip_configuration {
Expand Down
3 changes: 1 addition & 2 deletions terraform/database/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ output "password" {
}

output "ip" {
sensitive = true
value = "${google_sql_database_instance.main.ip_address.0.ip_address}"
value = "${google_sql_database_instance.main.ip_address.0.ip_address}"
}

output "ca-cert" {
Expand Down
10 changes: 5 additions & 5 deletions terraform/database/variables.tf
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
variable "name" {
default = ""
description = "TODO"
description = "The name of the CloudSQL instance to create (ps.: a random ID is appended to this name)"
}

variable "memory_mb" {
default = ""
description = "TODO"
description = "Number of MBs to assign to the CloudSQL instance."
}

variable "cpus" {
default = ""
description = "TODO"
description = "Number of CPUs to assign to the CloudSQL instance."
}

variable "zone" {
default = ""
description = "TODO"
description = "The zone where this instance is supposed to be created at (e.g., us-central1-a)k"
}

variable "region" {
default = ""
description = "TODO"
description = "The region where the instance is supposed to be created at (e.g., us-central1)"
}
3 changes: 3 additions & 0 deletions terraform/gcp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ provider "google" {
region = "${var.region}"
}

# `google-beta` provides us access to GCP's beta APIs.
# This is particularly needed for GKE-related operations.
#
provider "google-beta" {
credentials = "gcp.json"
project = "${var.project}"
Expand Down
23 changes: 21 additions & 2 deletions terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# Reserved IP address for the `web` instances.
#
# This is needed so that we can have a static IP that `hush-house.pivotal.io`
# can point.
#
resource "google_compute_address" "hush-house" {
name = "hush-house"
}

# Reserves an address for `metrics-hush-house.concourse-ci.org` and ties it
# to the given domain.
#
module "metrics-address" {
source = "./address"

dns-zone = "${var.dns-zone}"
subdomain = "metrics-hush-house"
}

# Instantiates the GKE Kubernetes cluster.
#
module "cluster" {
source = "./cluster"

Expand All @@ -18,7 +28,10 @@ module "cluster" {

node-pools = [
{
name = "generic-1"
# The pool to be used by non-worker.
#
name = "generic-1"

min = 1
node_count = 2
max = 5
Expand All @@ -32,7 +45,10 @@ module "cluster" {
version = "1.12.5-gke.5"
},
{
name = "workers-1"
# The pool to be exclusively used by `hush-house` Concourse workers
#
name = "workers-1"

min = 1
node_count = 4
max = 10
Expand All @@ -48,6 +64,9 @@ module "cluster" {
]
}

# Creates the CloudSQL Postgres database to be used by the `hush-house`
# Concourse deployment.
#
module "database" {
source = "./database"

Expand Down
3 changes: 1 addition & 2 deletions terraform/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
output "hush-house-database-ip" {
sensitive = true
value = "${module.database.ip}"
value = "${module.database.ip}"
}

output "hush-house-database-ca-cert" {
Expand Down
8 changes: 4 additions & 4 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
variable "region" {
description = ""
description = "The cloud provider region where the resources created at."
default = "us-central1"
}

variable "zone" {
description = ""
description = "The cloud provider zone where the resources are created at."
default = "us-central1-a"
}

variable "project" {
description = ""
description = "The Google GCP project to host the resources."
default = "cf-concourse-production"
}

variable "dns-zone" {
description = ""
description = "The default DNS zone to use when creating subdomains."
default = "concourse-ci-org"
}

0 comments on commit 3d1da46

Please sign in to comment.