/terraform-gcp

Infra to deploy a simple Golang application on GKE that is backed by a Postgres database.

Primary LanguageGo

terraform-gcp

Infra to deploy a simple Golang application on GKE that is backed by a Postgres database.

Instructions

This project contains three directories for the GTD Golang app on GCP.

app

It's the application itself. Read the readme.md.

terraform

To deploy the necessary infra. It consists of a HA Postgresql plus a GKE cluster.

k8s

The .yaml files to deploy the application on GKE.

Requirements

  • Docker;
  • Terraform;
  • gcloud CLI;
  • GCP;
  • kubectl;

Usage

Before you deploy your terraform you've to make sure you have all the necessary permissions of these components on GCP:

Examples:

Initial setup GCP

gcloud auth login
gcloud projects list
gcloud config set project <my-project>
gcloud auth application-default login
gcloud iam service-accounts create sa-terraform — display-name
gcloud projects add-iam-policy-binding PROJECT_ID — member="serviceAccount:sa-terraform@PROJECT_ID.iam.gserviceaccount.com" — role="roles/cloudsql.admin"

References

https://cloud.google.com/iam/docs/service-accounts https://cloud.google.com/sql/docs/postgres/admin-api https://cloud.google.com/service-infrastructure/docs/service-networking/getting-started https://cloud.google.com/compute/docs/reference/rest/v1 https://cloud.google.com/sdk/docs

Author

👤 Tadeu Bernacchi

Show your support

Give a ⭐️ if this project helped you!