How to use repo
- Create
terraform.tfvars
file with a few variables
project = "gcp-project"
region = "europe-west1"
environment_name = "demo"
- Create cluster
All commands will be applied via Terraform 1.7.0 and via OpenTofu, the same version.
Here are OpenTofu commands.
tofu init
tofu apply
- Get the credentials for the new cluster (configure kubeconfig)
You can see all useful commands and links in the output:
tofu output
There is a manual command:
gcloud container clusters get-credentials $(tofu output -raw kubernetes_cluster_name) --region $(tofu output -raw region) --project $(tofu output -raw project)
- Destroy all resources
tofu destroy
Requirements
Providers
Modules
No modules.
Resources
Inputs
Name |
Description |
Type |
Default |
Required |
environment_name |
n/a |
string |
"demo" |
no |
gke_num_nodes |
number of gke nodes |
number |
1 |
no |
project |
Google Project to create resources in |
string |
"demo" |
no |
region |
The region to host the cluster in |
string |
"us-central1" |
no |
vpc_host_project |
Host Project where virtual network exists |
string |
"demo" |
no |
zone |
The region to host the cluster in |
string |
"us-central1-b" |
no |
Outputs