mirror of
https://github.com/ghndrx/terraform-gke-cluster.git
synced 2026-02-10 06:55:01 +00:00
Terraform Cluster
This repository contains Terraform code for creating a Google Kubernetes Engine (GKE) cluster.
Prerequisites
- Terraform 0.14 or later
- A Google Cloud Platform (GCP) project with the necessary permissions to create a GKE cluster
- A service account with the necessary permissions to create a GKE cluster
Usage
- Clone this repository
- Create a
terraform.tfvarsfile and set the following variables:my-project-id: The ID of your GCP projectmy-cluster: The name of your GKE clustergoogle_region: The region where your GKE cluster will be createdmachine_type: The machine type for your GKE nodesusername: The username for the master auth of your GKE clusterpassword: The password for the master auth of your GKE cluster
- Run
terraform initto initialize the Terraform working directory - Run
terraform applyto create the GKE cluster
Notes
- This code creates a GKE cluster with a single node. You can adjust the node_count variable in
main.tfto create a cluster with more nodes. - This code also creates a firewall rule that allows incoming traffic on port 80. You can adjust the firewall rule in
main.tfto suit your needs.
Cleanup
To delete the resources created by this code, run terraform destroy.