@ksatirli
on GitHub and Twitter
Developer Advocate at HashiCorp
Slide 3
Slide 3 text
@onlydole
on GitHub and Twitter
Developer Advocate at HashiCorp
Slide 4
Slide 4 text
Agenda Introducing Terraform
and the Google Provider
Managing GKE with Terraform
provisioning Clusters, Node Pools, and more
Kubernetes Provider for Terraform
deploying applications to Kubernetes Clusters
Slide 5
Slide 5 text
Introducing Terraform
Slide 6
Slide 6 text
Terraform 125+
Official Providers
GCP, AWS, Kubernetes, etc.
175+
Community Providers
Auth0, Sentry, Unifi, etc.
Slide 7
Slide 7 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:8080"
process "server" {
command = ["proxy-app", "server"]
}
}
variable "port" {
description = "Port for web_proxy"
default = 8080
}
Slide 8
Slide 8 text
HashiCorp
Configuration
Language
CODE EDITOR
service "http" "web_proxy" {
listen_addr = "127.0.0.1:${var.port}"
process "server" {
command = ["proxy-app", "server"]
}
}
variable "port" {
description = "Port for web_proxy"
default = 8080
}
Command: terraform init
TERMINAL
> terraform init
Initializing modules...
Downloading terraform-google-modules/network/google 2.4.0 for gke_network...
- gke_network in .terraform/modules/gke_network/terraform-google-network-2.4.0
Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "http" (hashicorp/http) 1.2.0...
- Downloading plugin for provider "kubernetes" (hashicorp/kubernetes) 1.11.3...
- Downloading plugin for provider "google" (hashicorp/google) 3.16.0...
- Downloading plugin for provider "google-beta" (hashicorp/google-beta) 3.29.0...
- Downloading plugin for provider "null" (hashicorp/null) 2.1.2...
Terraform has been successfully initialized!
Slide 19
Slide 19 text
Command: terraform plan
TERMINAL
> terraform plan -out="gke.tfplan"
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# module.network.module.subnets.google_compute_subnetwork.subnet will be created
+ resource "google_compute_subnetwork" "subnet" {
+ creation_timestamp = (known after apply)
+ enable_flow_logs = (known after apply)
+ fingerprint = (known after apply)
+ gateway_address = (known after apply)
...
Slide 20
Slide 20 text
Command: terraform plan
TERMINAL
...
+ name = "hug-ist-demo"
+ project = "hc-da-test"
+ routing_mode = "GLOBAL"
+ self_link = (known after apply)
}
Plan: 2 to add, 0 to change, 0 to destroy.
------------------------------------------------------------------------
This plan was saved to: gke.tfplan
To perform exactly these actions, run the following command to apply:
terraform apply "gke.tfplan"
Command: terraform apply
TERMINAL
> terraform apply "gke.tfplan"
module.network.module.vpc.google_compute_network.network: Creating...
module.network.module.vpc.google_compute_network.network: Creation complete
module.network.module.subnets.google_compute_subnetwork.subnet: Creating...
module.network.module.subnets.google_compute_subnetwork.subnet: Creation complete
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.
State path: terraform.tfstate
Command: terraform get
TERMINAL
> terraform get
Downloading kubernetes-engine/google 10.0.0 for gke_cluster...
- gke_cluster in .terraform/modules/gke_cluster/kubernetes-engine-10.0.0