Skip to content

Commit 477cf4e

Browse files
author
bgeesaman
authored
Merge pull request #28 from wripley/master
Upgraded demo to use TF 0.12
2 parents e639d0b + 6d89023 commit 477cf4e

File tree

7 files changed

+38
-17
lines changed

7 files changed

+38
-17
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ metadata:
3535
spec:
3636
containers:
3737
- name: ${containerName}
38-
image: gcr.io/pso-helmsman-cicd/jenkins-k8s-node:${env.CONTAINER_VERSION}
38+
image: gcr.io/pso-helmsman-cicd/jenkins-k8s-node:${env.JENKINS_CONTAINER_VERSION}
3939
command: ['cat']
4040
tty: true
4141
volumeMounts:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ gcloud init
102102
```
103103

104104
### Tools
105-
1. [Terraform >= 0.11.7](https://www.terraform.io/downloads.html)
105+
1. [Terraform >= 0.12](https://www.terraform.io/downloads.html)
106106
2. [Google Cloud SDK version >= 204.0.0](https://cloud.google.com/sdk/docs/downloads-versioned-archives)
107107
3. [kubectl matching the latest GKE version](https://kubernetes.io/docs/tasks/tools/install-kubectl/)
108108

terraform/main.tf

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
1817
// Provides access to available Google Container Engine versions in a zone for a given project.
1918
// https://www.terraform.io/docs/providers/google/d/google_container_engine_versions.html
2019
data "google_container_engine_versions" "on-prem" {
21-
zone = "${var.zone}"
22-
project = "${var.project}"
20+
zone = var.zone
21+
project = var.project
2322
}
2423

2524
// https://www.terraform.io/docs/providers/google/d/google_container_cluster.html
@@ -28,9 +27,9 @@ data "google_container_engine_versions" "on-prem" {
2827
// Create the GKE Cluster
2928
resource "google_container_cluster" "primary" {
3029
name = "tracing-demo-space"
31-
zone = "${var.zone}"
30+
zone = var.zone
3231
initial_node_count = 1
33-
min_master_version = "${data.google_container_engine_versions.on-prem.latest_master_version}"
32+
min_master_version = data.google_container_engine_versions.on-prem.latest_master_version
3433

3534
// Scopes were a pre-IAM method of giving instances API access
3635
// They are still around we need to give our cluster nodes
@@ -46,6 +45,8 @@ resource "google_container_cluster" "primary" {
4645
]
4746
}
4847

48+
// Here we use gcloud to gather authentication information about our new cluster and write that
49+
// information to kubectls config file
4950
// Here we use gcloud to gather authentication information about our new cluster and write that
5051
// information to kubectls config file
5152
provisioner "local-exec" {
@@ -62,13 +63,14 @@ resource "google_pubsub_topic" "tracing-demo-topic" {
6263
// You need a subscription to pull messages from a topic
6364
resource "google_pubsub_subscription" "tracing-demo-subscription" {
6465
name = "tracing-demo-cli"
65-
topic = "${google_pubsub_topic.tracing-demo-topic.name}"
66+
topic = google_pubsub_topic.tracing-demo-topic.name
6667
}
6768

6869
output "cluster_name" {
69-
value = "${google_container_cluster.primary.name}"
70+
value = google_container_cluster.primary.name
7071
}
7172

7273
output "primary_zone" {
73-
value = "${google_container_cluster.primary.zone}"
74+
value = google_container_cluster.primary.zone
7475
}
76+

terraform/provider.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
1817
// Identifies allowable version range for Terraform Google Provider
1918
provider "google" {
20-
project = "${var.project}"
21-
version = "~> 1.13"
19+
project = var.project
20+
version = "~> 2.10.0"
2221
}
22+

terraform/variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
1817
variable "zone" {
1918
description = "The zone in which to create the Kubernetes cluster. Must match the region"
20-
type = "string"
19+
type = string
2120
}
2221

2322
variable "project" {
2423
description = "the project for this network"
25-
type = "string"
24+
type = string
2625
}
26+

terraform/versions.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
Copyright 2018 Google LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
terraform {
18+
required_version = ">= 0.12"
19+
}

test/make.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function docker() {
4949
function check_terraform() {
5050
echo "Running terraform validate"
5151
#shellcheck disable=SC2156
52-
find . -name "*.tf" -exec bash -c 'terraform validate --check-variables=false $(dirname "{}")' \;
52+
find . -name "*.tf" -exec bash -c 'terraform validate $(dirname "{}")' \;
5353
}
5454

5555
# This function runs 'go fmt' and 'go vet' on eery file

0 commit comments

Comments
 (0)