Skip to content

Automated Infrastructure Deployment on GCP

The public cloud infrastructure is deployed automatically using Terraform. The Terraform source code is located in the Terraform-GCP-IaC project and is used to provision the required GCP resources, including the Kubernetes cluster, VPC, and subnets.

GCP Infrastructure CI/CD Pipeline Breakdown

The stages of the CI/CD pipeline for the GCP infrastructure are illustrated below: CI/CD pipeline for the GCP infrastructure

When a commit is pushed to the main branch of the Terraform-GCP-IaC project, the corresponding CI/CD pipeline runs. The pipeline includes the following stages: 1. create-environment: Creates the GCP environment required to deploy the infrastructure. This stage consists of two jobs: - terraform-init: Initializes Terraform, downloads the required providers, and prepares the environment. - terraform-apply: Applies the Terraform configuration and creates the required GCP resources. 2. verify: Verifies that the infrastructure has been deployed successfully. This stage waits until the Kubernetes cluster nodes report Ready and a test pod can be deployed successfully. 3. deploy-mongodb: Deploys MongoDB to the Kubernetes cluster. This stage retrieves the MongoDB Helm chart from the deployment repository and applies it with the required deployment configuration values. 4. deploy-conduit: Deploys Conduit to the Kubernetes cluster. This stage consists of two jobs: - deploy-backend: Deploys the Conduit backend to the Kubernetes cluster. - deploy-frontend: Deploys the Conduit frontend to the Kubernetes cluster. 5. update-cloudflare-dns: Updates Cloudflare DNS records for the project's domain. This stage uses the Cloudflare API to update the required A and CNAME records so the domain resolves to the IP address provided by GCP. 6. destroy-environment: This stage requires manual activation and destroys the GCP environment provisioned by Terraform. It consists of two jobs: - delete-resources-gcp: Deletes resources created by Terraform in GCP. - terraform-destroy: Destroys the infrastructure provisioned by Terraform, removing all GCP resources.