...

/

Exploring Terraform Variables

Exploring Terraform Variables

View some of the basic variables in Terraform corresponding to GKE.

Viewing variables in Terraform

Generally speaking, entries in Terraform definitions are split into four groups. We have:

  • Provider
  • Resource
  • Output
  • Variable

That’s not to say that there aren’t other types (there are) but those four are the most important and the most commonly used ones. For now, we’ll focus on variables and leave the rest for later.

Let’s take a quick look at the file that defines the variables that we’ll use.

Output description

Press + to interact
variable "region" {
type = string
default = "us-east1"
}
variable "project_id" {
type = string
default = "devops-catalog-gke"
}
variable "cluster_name" {
type = string
default = "devops-catalog"
}
variable "k8s_version" {
type = string
}
variable "min_node_count" {
type = number
default = 1
}
variable "max_node_count" {
type = number
default = 3
}
variable "machine_type" {
type = string
default = "e2-standard-2"
}
variable "preemptible" {
type = bool
default = true
}
variable "state_bucket" {
type = string
}

If we focus on the names of the variables, we’ll notice that they’re self-explanatory:

  • In line 1
...