Skip to content

Commit

Permalink
fix!: update TPG 3.49, modules, and GKE for CI (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody authored Dec 13, 2022
1 parent c41b361 commit bd15808
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Make will use bash instead of sh
SHELL := /usr/bin/env bash

DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.14
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.10
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Then perform the following commands on the root folder:
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| allow\_force\_destroy | Allows full cleanup of resources by disabling any deletion safe guards | `bool` | `false` | no |
| certmanager\_email | Email used to retrieve SSL certificates from Let's Encrypt | `any` | n/a | yes |
| certmanager\_email | Email used to retrieve SSL certificates from Let's Encrypt | `string` | n/a | yes |
| domain | Domain for hosting gitlab functionality (ie mydomain.com would access gitlab at gitlab.mydomain.com) | `string` | `""` | no |
| gitlab\_address\_name | Name of the address to use for GitLab ingress | `string` | `""` | no |
| gitlab\_db\_name | Instance name for the GitLab Postgres database. | `string` | `"gitlab-db"` | no |
Expand All @@ -50,9 +50,9 @@ Then perform the following commands on the root folder:
| gitlab\_runner\_install | Choose whether to install the gitlab runner in the cluster | `bool` | `true` | no |
| gitlab\_services\_subnet\_cidr | Cidr range to use for gitlab GKE services subnet | `string` | `"10.2.0.0/16"` | no |
| gke\_machine\_type | Machine type used for the node-pool | `string` | `"n1-standard-4"` | no |
| gke\_version | Version of GKE to use for the GitLab cluster | `string` | `"1.20"` | no |
| gke\_version | Version of GKE to use for the GitLab cluster | `string` | `"1.21"` | no |
| helm\_chart\_version | Helm chart version to install during deployment | `string` | `"4.2.4"` | no |
| project\_id | GCP Project to deploy resources | `any` | n/a | yes |
| project\_id | GCP Project to deploy resources | `string` | n/a | yes |
| region | GCP region to deploy resources to | `string` | `"us-central1"` | no |

## Outputs
Expand Down
2 changes: 1 addition & 1 deletion build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ tags:
- 'integration'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.14'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.10'
options:
machineType: 'N1_HIGHCPU_8'
2 changes: 1 addition & 1 deletion build/lint.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ tags:
- 'lint'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.14'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.10'
2 changes: 1 addition & 1 deletion examples/simple_example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This example illustrates how to use the `gke-gitlab` module.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| project\_id | The project ID to deploy to | `any` | n/a | yes |
| project\_id | The project ID to deploy to | `string` | n/a | yes |

## Outputs

Expand Down
1 change: 1 addition & 0 deletions examples/simple_example/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@

variable "project_id" {
description = "The project ID to deploy to"
type = string
}
11 changes: 7 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ resource "random_id" "suffix" {

module "gke_auth" {
source = "terraform-google-modules/kubernetes-engine/google//modules/auth"
version = "~> 21.0"
version = "~> 24.0"

project_id = module.project_services.project_id
cluster_name = module.gke.name
Expand All @@ -60,7 +60,7 @@ provider "kubernetes" {
// Services
module "project_services" {
source = "terraform-google-modules/project-factory/google//modules/project_services"
version = "~> 13.0"
version = "~> 14.0"

project_id = var.project_id
disable_services_on_destroy = false
Expand Down Expand Up @@ -177,6 +177,9 @@ resource "google_sql_user" "gitlab" {
name = "gitlab"
instance = google_sql_database_instance.gitlab_db.name

# Postgres users cannot be deleted if they have been granted SQL roles
deletion_policy = "ABANDON"

password = var.gitlab_db_password != "" ? var.gitlab_db_password : random_string.autogenerated_gitlab_db_password.result
}

Expand Down Expand Up @@ -244,7 +247,7 @@ resource "google_storage_bucket" "gitlab-runner-cache" {
// GKE Cluster
module "gke" {
source = "terraform-google-modules/kubernetes-engine/google"
version = "~> 21.0"
version = "~> 24.0"

# Create an implicit dependency on service activation
project_id = module.project_services.project_id
Expand Down Expand Up @@ -362,7 +365,7 @@ data "google_compute_address" "gitlab" {
}

locals {
gitlab_address = var.gitlab_address_name == "" ? google_compute_address.gitlab.0.address : data.google_compute_address.gitlab.0.address
gitlab_address = var.gitlab_address_name == "" ? google_compute_address.gitlab[0].address : data.google_compute_address.gitlab[0].address
domain = var.domain != "" ? var.domain : "${local.gitlab_address}.nip.io"
}

Expand Down
17 changes: 16 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,74 +16,89 @@

variable "project_id" {
description = "GCP Project to deploy resources"
type = string
}

variable "domain" {
description = "Domain for hosting gitlab functionality (ie mydomain.com would access gitlab at gitlab.mydomain.com)"
type = string
default = ""
}

variable "certmanager_email" {
description = "Email used to retrieve SSL certificates from Let's Encrypt"
type = string
}

variable "gke_version" {
description = "Version of GKE to use for the GitLab cluster"
default = "1.20"
type = string
default = "1.21"
}

variable "gke_machine_type" {
description = "Machine type used for the node-pool"
type = string
default = "n1-standard-4"
}

variable "gitlab_db_name" {
description = "Instance name for the GitLab Postgres database."
type = string
default = "gitlab-db"
}

variable "gitlab_db_random_prefix" {
description = "Sets random suffix at the end of the Cloud SQL instance name."
type = bool
default = false
}

variable "gitlab_deletion_protection" {
description = "Must be false to allow Terraform to destroy the Cloud SQL instance."
type = bool
default = true
}

variable "gitlab_db_password" {
description = "Password for the GitLab Postgres user"
type = string
default = ""
}

variable "gitlab_address_name" {
description = "Name of the address to use for GitLab ingress"
type = string
default = ""
}

variable "gitlab_runner_install" {
description = "Choose whether to install the gitlab runner in the cluster"
type = bool
default = true
}

variable "region" {
default = "us-central1"
type = string
description = "GCP region to deploy resources to"
}

variable "gitlab_nodes_subnet_cidr" {
default = "10.0.0.0/16"
type = string
description = "Cidr range to use for gitlab GKE nodes subnet"
}

variable "gitlab_pods_subnet_cidr" {
default = "10.3.0.0/16"
type = string
description = "Cidr range to use for gitlab GKE pods subnet"
}

variable "gitlab_services_subnet_cidr" {
default = "10.2.0.0/16"
type = string
description = "Cidr range to use for gitlab GKE services subnet"
}

Expand Down
8 changes: 6 additions & 2 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 3.44, < 5.0"
version = ">= 3.49, < 5.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = ">= 3.44, < 5.0"
version = ">= 3.49, < 5.0"
}
helm = {
source = "hashicorp/helm"
Expand All @@ -45,6 +45,10 @@ terraform {
source = "hashicorp/template"
version = "~> 2.1.2"
}
time = {
source = "hashicorp/time"
version = "~> 0.9"
}
}

provider_meta "google" {
Expand Down

0 comments on commit bd15808

Please sign in to comment.