From d9210ca386b300ad766f787b68db3abd5cc97fb1 Mon Sep 17 00:00:00 2001 From: Steve McGhee Date: Thu, 21 May 2020 21:03:12 +0000 Subject: [PATCH] comments --- terraform/00_everything.tf | 23 ++++++++++++++++++++++- terraform/README.md | 7 +++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 terraform/README.md diff --git a/terraform/00_everything.tf b/terraform/00_everything.tf index 8579f2a..4783e9e 100644 --- a/terraform/00_everything.tf +++ b/terraform/00_everything.tf @@ -1,8 +1,24 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# save terraform state locally for now terraform { backend "local" { path = "terraform.tfstate" } } + provider "google" { # pin provider to 2.x project = var.project @@ -14,6 +30,7 @@ provider "random" { version = "~> 2.0" } +# enable all the Google Cloud Platform APIs we need for this project resource "google_project_service" "iam" { project = var.project @@ -207,7 +224,7 @@ resource "null_resource" "deploy_services" { } # There is no reliable way to do deployment verification with kubernetes -# For the purposes of Sandbox, we can mitigate by waiting a few sec to ensure kubectl apply completes +# we can mitigate by waiting a few sec to ensure kubectl apply completes resource "null_resource" "delay" { provisioner "local-exec" { command = "sleep 5" @@ -217,3 +234,7 @@ resource "null_resource" "delay" { } } +# TODO: +# use gke_deploy instead of kubectl apply +# add service monitoring +# add a dashboard \ No newline at end of file diff --git a/terraform/README.md b/terraform/README.md new file mode 100644 index 0000000..2e4e1c0 --- /dev/null +++ b/terraform/README.md @@ -0,0 +1,7 @@ +To install the microservices-demo on GKE using terraform do the following: + +1. create a project with an active billing account, or use an existing one. +1. `export PROJECT='my-great-project' # substitute with your project name` +1. `terraform init` +1. `terraform plan -var project=$PROJECT` +1. `terraform apply -auto-approve -var project=$PROJECT` \ No newline at end of file