This device is not compatible.

Manage Infrastructure using Terraform on Google Cloud Platform

PROJECT


Manage Infrastructure using Terraform on Google Cloud Platform

In this project, we’ll create infrastructures such as buckets, backends, and clusters on gcloud using Terraform. We’ll also use Terraform to create an Artifact Registry for hosting Docker images that will be deployed on Google Cloud Run.

Manage Infrastructure using Terraform on Google Cloud Platform

You will learn to:

Create projects and associated service accounts using gcloud CLI.

Generate keys and policy bindings for projects and service accounts.

Manage simple infrastructure on Google Cloud using Terraform.

Containerize web applications using Docker.

Create Artifact Repositories and generate policy bindings using Terraform.

Deploy web applications on Google Cloud Run using Terraform.

Skills

Cloud Deployment

Docker Containers

DevOps

Prerequisites

GCP account with billing enabled

Basic understanding of Terraform

Basic understanding of gcloud CLI

Basic understanding of clusters and storage buckets

Technologies

Terraform logo

Terraform

Cloud Run logo

Cloud Run

Kubernetes

gCloud CLI logo

gCloud CLI

Artifact Registry logo

Artifact Registry

Project Description

This project shows how to streamline containerized application deployment on the Google Cloud Platform (GCP) through a combination of CLI and Terraform scripts. To complete this project, a paid personal GCP is mandatory, which would incur minimal cost (a few dollars) to set up the cluster and resources and run the service. Unless the services and resources are heavily accessed, the cost will remain minimal.

In the first phase, we’ll set up the necessary infrastructure on GCP using the gcloud CLI. This involves creating a service account with the appropriate permissions, setting up a new project, generating authentication keys, and establishing role bindings. These steps ensure that our deployment pipeline has the necessary access and security measures in place.

The second phase of the project will focus on building infrastructure as code (IaC) using Terraform. We’ll create a storage bucket, set up the backend for Terraform state management, provision a Kubernetes cluster with nodes, and configure networking and security settings.

In the final phase, we’ll use Terraform to create an Artifact Registry to host Docker images. We’ll then deploy these Docker images on Google Cloud Run, a fully managed container platform. This end-to-end automation will ensure that our applications are packaged, stored, and deployed with consistency and repeatability, enhancing the efficiency and reliability of our deployment process on GCP.

Project Tasks

1

Getting Started

Task 0: Get Started

Task 1: Containerize the Application

Task 2: Set Up the gcloud Service Account

Task 3: Set Up Authentication with the gcloud CLI

2

Build Infrastructure as Code (IaC)

Task 4: Configure Variables for Terraform

Task 5: Configure Output for Terraform

Task 6: Define the Provider for Terraform

Task 7: Initialize and Set Up the Infrastructure

Task 8: Set Up a Basic Storage Bucket on GCP

Task 9: Store the Terraform State in the Backend

Task 10: Set up a Cluster on Google Kubernetes Engine (GKE)

Task 11: Deploy Worker Nodes for the GKE Cluster

Task 12: Set Up a Connection with Worker Nodes

3

Deploying Application to Cloud Run

Task 13: Enable and Create an Artifact Registry on gcloud

Task 14: Push the Image to the Artifact Repository

Task 15: Enable the Cloud Run API

Task 16: Host Container on GCloud Run using Terraform

Task 17: Locate the Address of the Deployed Service

Task 18: Destroy the Resources

Congratulations!