Rahulsharma0810 / terraform-example

An example terraform + terragrunt repository. Features Google Kubernetes Engine, Google Cloud SQL, Google Cloud Proxy, NGINX.

Home Page:http://harjot.me/blog/deploying-docker-containers-to-gke-using-terraform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

terraform-example

This repository contains an example terraform + terragrunt configuration to deploy infrastructure declaratively as code.

View the accompanying blog post: http://harjot.me/blog/deploying-docker-containers-to-gke-using-terraform

The following prerequisites are required:

  • Google Cloud Project per environment (development + production)
  • Kubectl
  • Terraform
  • Terragrunt

The following will be deployed by the repo:

Structure

All terraform files in terraform. Usually, this would sit alongside application code.

terraform/modules contain Terraform-only reusable module definitions.

terraform/live/[env] contain subfolders for each service/infrastructure, each containing a terragrunt.hcl which reference the aforementioned modules.

Usage

cd into terraform/live/[development] or [production] depending on the environment you'd like to work with. You can run terragrunt plan-all or terragrunt apply-all.

Production Tips

These will be implemented in the future.

  • Use a Cloud Proxy Sidecar to allow your applications to interact with Cloud SQL.
  • Use an Ingress Controller instead of exposing each service as a LoadBalancer. This way you have one central point of entry. The Traefik controller is great.

About

An example terraform + terragrunt repository. Features Google Kubernetes Engine, Google Cloud SQL, Google Cloud Proxy, NGINX.

http://harjot.me/blog/deploying-docker-containers-to-gke-using-terraform

License:MIT License


Languages

Language:HCL 100.0%