Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Terraform v0.14 update (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
robmorgan authored Apr 22, 2021
1 parent c174b3a commit 2847c7b
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 72 deletions.
7 changes: 4 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ env: &env
environment:
GRUNTWORK_INSTALLER_VERSION: v0.0.30
TERRATEST_LOG_PARSER_VERSION: v0.30.4
MODULE_CI_VERSION: v0.29.1
TERRAFORM_VERSION: 0.13.5
MODULE_CI_VERSION: v0.33.2
TERRAFORM_VERSION: 0.14.8
TERRAGRUNT_VERSION: NONE
PACKER_VERSION: NONE
GOLANG_VERSION: 1.13.8
GOLANG_VERSION: 1.16
GO111MODULE: auto
HELM_VERSION: v3.1.2
K8S_VERSION: v1.10.0
KUBECONFIG: /home/circleci/.kube/config
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ vendor

# Mock user-data log file
mock-user-data.log

# Ignore Terraform lock files, as we want to test the Terraform code in these repos with the latest provider
# versions.
.terraform.lock.hcl
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Maintained by Gruntwork.io](https://img.shields.io/badge/maintained%20by-gruntwork.io-%235849a6.svg)](https://gruntwork.io/?ref=repo_google_gke)
[![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/gruntwork-io/terraform-google-gke.svg?label=latest)](https://github.com/gruntwork-io/terraform-google-gke/releases/latest)
![Terraform Version](https://img.shields.io/badge/tf-%3E%3D0.13.0-blue.svg)
![Terraform Version](https://img.shields.io/badge/tf-%3E%3D0.14.0-blue.svg)

# Google Kubernetes Engine (GKE) Module

Expand Down
2 changes: 1 addition & 1 deletion examples/gke-private-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Currently, you cannot use a proxy to reach the cluster master of a regional clus

## How do you run these examples?

1. Install [Terraform](https://learn.hashicorp.com/terraform/getting-started/install.html) v0.12.0 or later.
1. Install [Terraform](https://learn.hashicorp.com/terraform/getting-started/install.html) v0.14.8 or later.
1. Open `variables.tf` and fill in any required variables that don't have a default.
1. Run `terraform get`.
1. Run `terraform plan`.
Expand Down
17 changes: 13 additions & 4 deletions examples/gke-private-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,33 @@
# ---------------------------------------------------------------------------------------------------------------------

terraform {
# This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting
# This module is now only being tested with Terraform 0.14.x. However, to make upgrading easier, we are setting
# 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it
# forwards compatible with 0.13.x code.
# forwards compatible with 0.14.x code.
required_version = ">= 0.12.26"

required_providers {
google = {
source = "hashicorp/google"
version = "~> 3.43.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 3.43.0"
}
}
}

# ---------------------------------------------------------------------------------------------------------------------
# PREPARE PROVIDERS
# ---------------------------------------------------------------------------------------------------------------------

provider "google" {
version = "~> 3.43.0"
project = var.project
region = var.region
}

provider "google-beta" {
version = "~> 3.43.0"
project = var.project
region = var.region
}
Expand Down
2 changes: 1 addition & 1 deletion examples/gke-public-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ your new zones are within the region your cluster is present in.

## How do you run these examples?

1. Install [Terraform](https://learn.hashicorp.com/terraform/getting-started/install.html) v0.12.0 or later.
1. Install [Terraform](https://learn.hashicorp.com/terraform/getting-started/install.html) v0.14.8 or later.
1. Open `variables.tf`, and fill in any required variables that don't have a default.
1. Run `terraform get`.
1. Run `terraform plan`.
Expand Down
17 changes: 13 additions & 4 deletions examples/gke-public-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,33 @@
# ---------------------------------------------------------------------------------------------------------------------

terraform {
# This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting
# This module is now only being tested with Terraform 0.14.x. However, to make upgrading easier, we are setting
# 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it
# forwards compatible with 0.13.x code.
# forwards compatible with 0.14.x code.
required_version = ">= 0.12.26"

required_providers {
google = {
source = "hashicorp/google"
version = "~> 3.43.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 3.43.0"
}
}
}

# ---------------------------------------------------------------------------------------------------------------------
# PREPARE PROVIDERS
# ---------------------------------------------------------------------------------------------------------------------

provider "google" {
version = "~> 3.43.0"
project = var.project
region = var.region
}

provider "google-beta" {
version = "~> 3.43.0"
project = var.project
region = var.region
}
Expand Down
28 changes: 21 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,36 @@
# ---------------------------------------------------------------------------------------------------------------------

terraform {
# This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting
# This module is now only being tested with Terraform 0.14.x. However, to make upgrading easier, we are setting
# 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it
# forwards compatible with 0.13.x code.
# forwards compatible with 0.14.x code.
required_version = ">= 0.12.26"

required_providers {
google = {
source = "hashicorp/google"
version = "~> 3.43.0"
}
google-beta = {
source = "hashicorp/google-beta"
version = "~> 3.43.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 1.7.0"
}
helm = {
source = "hashicorp/helm"
version = "~> 1.1.1"
}
}
}

# ---------------------------------------------------------------------------------------------------------------------
# PREPARE PROVIDERS
# ---------------------------------------------------------------------------------------------------------------------

provider "google" {
version = "~> 3.43.0"
project = var.project
region = var.region

Expand All @@ -33,7 +51,6 @@ provider "google" {
}

provider "google-beta" {
version = "~> 3.43.0"
project = var.project
region = var.region

Expand All @@ -56,7 +73,6 @@ data "google_client_config" "client" {}
data "google_client_openid_userinfo" "terraform_user" {}

provider "kubernetes" {
version = "~> 1.7.0"

load_config_file = false
host = data.template_file.gke_host_endpoint.rendered
Expand All @@ -65,8 +81,6 @@ provider "kubernetes" {
}

provider "helm" {
# Use provider with Helm 3.x support
version = "~> 1.1.1"

kubernetes {
host = data.template_file.gke_host_endpoint.rendered
Expand Down
12 changes: 6 additions & 6 deletions modules/gke-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

terraform {
# This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting
# This module is now only being tested with Terraform 0.14.x. However, to make upgrading easier, we are setting
# 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it
# forwards compatible with 0.13.x code.
# forwards compatible with 0.14.x code.
required_version = ">= 0.12.26"
}

locals {
workload_identity_config = ! var.enable_workload_identity ? [] : var.identity_namespace == null ? [{
workload_identity_config = !var.enable_workload_identity ? [] : var.identity_namespace == null ? [{
identity_namespace = "${var.project}.svc.id.goog" }] : [{ identity_namespace = var.identity_namespace
}]
}
Expand Down Expand Up @@ -81,15 +81,15 @@ resource "google_container_cluster" "cluster" {

addons_config {
http_load_balancing {
disabled = ! var.http_load_balancing
disabled = !var.http_load_balancing
}

horizontal_pod_autoscaling {
disabled = ! var.horizontal_pod_autoscaling
disabled = !var.horizontal_pod_autoscaling
}

network_policy_config {
disabled = ! var.enable_network_policy
disabled = !var.enable_network_policy
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/gke-cluster/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ variable "alternative_default_service_account" {

variable "resource_labels" {
description = "The GCE resource labels (a map of key/value pairs) to be applied to the cluster."
type = map
type = map(any)
default = {}
}

Expand Down
4 changes: 2 additions & 2 deletions modules/gke-service-account/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
# This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting
# This module is now only being tested with Terraform 0.14.x. However, to make upgrading easier, we are setting
# 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it
# forwards compatible with 0.13.x code.
# forwards compatible with 0.14.x code.
required_version = ">= 0.12.26"
}

Expand Down
2 changes: 1 addition & 1 deletion test/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/gruntwork-io/terraform-google-gke/test
go 1.13

require (
github.com/gruntwork-io/terratest v0.30.23
github.com/gruntwork-io/terratest v0.31.3
github.com/stretchr/testify v1.4.0
)
Loading

0 comments on commit 2847c7b

Please sign in to comment.