Skip to content

clouddrove/terraform-gcp-gke

Terraform gcp gke

Terraform module to create gke resource on google.

Terraform Licence tfsec static-checks


We eat, drink, sleep and most importantly love DevOps. We are working towards strategies for standardizing architecture while ensuring security for the infrastructure. We are strong believer of the philosophy Bigger problems are always solved by breaking them into smaller manageable problems. Resonating with microservices architecture, it is considered best-practice to run database, cluster, storage in smaller connected yet manageable pieces within the infrastructure.

This module is basically combination of Terraform open source and includes automatation tests and examples. It also helps to create and improve your infrastructure with minimalistic code instead of maintaining the whole infrastructure code yourself.

We have fifty plus terraform modules. A few of them are comepleted and are available for open source usage while a few others are in progress.

Prerequisites

This module has a few dependencies:

Examples

IMPORTANT: Since the master branch used in source varies based on new modifications, we suggest that you use the release versions here.

Here are some examples of how you can use this module in your inventory structure:

Default gke

module "gke" {
source = "clouddrove/gke/google"
version     = "1.0.0"

   name                               = "test-gke"
module_enabled                     = true
google_container_cluster_enabled   = true
location                           = "europe-west3"
remove_default_node_pool           = true
initial_node_count                 = 1
google_container_node_pool_enabled = true
node_count                         = 1
cluster_name                       = "test-gke"
project_id                         = var.gcp_project_id
region                             = var.gcp_region
service_account                    = ""

}

Inputs

Name Description Type Default Required
auto_repair ######################## management ########################### bool true no
auto_upgrade n/a bool true no
cluster The cluster to create the node pool for. string "" no
cluster_create_timeouts ######################## timeouts ########################### string "30m" no
cluster_delete_timeouts n/a string "30m" no
cluster_name n/a string "" no
cluster_update_timeouts n/a string "30m" no
disk_size_gb n/a number 50 no
disk_type n/a string "" no
environment Environment (e.g. prod, dev, staging). string "" no
gke_version The minimum version of the master. string "" no
google_container_cluster_enabled Flag to control the cluster_enabled creation. bool true no
google_container_node_pool_enabled Flag to control the cluster_enabled creation. bool true no
image_type ######################## node_config ########################### string "" no
initial_node_count The number of nodes to create in this cluster's default node pool. number 1 no
kubectl_config_path Path to the kubectl config file. Defaults to $HOME/.kube/config string "" no
label_order Label order, e.g. sequence of application name and environment name,environment,'attribute' [webserver,qa,devops,public,] . list(any) [] no
location The location (region or zone) in which the cluster master will be created, as well as the default node location. string "" no
location_policy n/a string "BALANCED" no
machine_type n/a string "" no
max_node_count n/a number 7 no
min_node_count ######################## Autoscaling ########################### number 2 no
module_enabled Flag to control the service_account_enabled creation. bool true no
name Name of the resource. Provided by the client when the resource is created. string "" no
network A reference (self link) to the VPC network to host the cluster in string "" no
node_count The number of nodes to create in this cluster's default node pool. number 1 no
preemptible n/a bool false no
project The project ID to host the cluster in string "" no
project_id Google Cloud project ID string "" no
region Google Cloud region string "" no
remove_default_node_pool deletes the default node pool upon cluster creation. bool true no
service_account The Google Cloud Platform Service Account to be used by the node VMs created by GKE Autopilot or NAP. string "" no
subnetwork A reference (self link) to the subnetwork to host the cluster in string "" no

Outputs

Name Description
cluster_ca_certificate n/a
endpoint n/a
id n/a
name n/a

Testing

In this module testing is performed with terratest and it creates a small piece of infrastructure, matches the output like ARN, ID and Tags name etc and destroy infrastructure in your AWS account. This testing is written in GO, so you need a GO environment in your system.

You need to run the following command in the testing folder:

  go test -run Test

Feedback

If you come accross a bug or have any feedback, please log it in our issue tracker, or feel free to drop us an email at hello@clouddrove.com.

If you have found it worth your time, go ahead and give us a ★ on our GitHub!

About us

At CloudDrove, we offer expert guidance, implementation support and services to help organisations accelerate their journey to the cloud. Our services include docker and container orchestration, cloud migration and adoption, infrastructure automation, application modernisation and remediation, and performance engineering.

We are The Cloud Experts!


We ❤️ Open Source and you can check out our other modules to get help with your new Cloud ideas.