DevSecOps Pipeline - GCP
Author(s): Iman Crooks, Damien Burks
Know Before You Go
This project is a little expense, and you will rack up a nice bill in GCP if you leave all your resources created. Therefore, I recommend that you TEAR IT ALL DOWN when you're done.
Prerequisities
- Before you begin this, you will want to have some knowledge of GCP services and how they work, as well as prior knowledge of Terraform. You can take a look at Building Cloud DevSecOps Pipelines (In Theory) for more information.
- You will also want to ensure that you have an GCP project created. You can go through the account creation process here: GCP Project Creation Process
- Make sure you have the following installed on your local machine:
Overview
So you've decided to go down the path of building your own Cloud Native DevSecOps pipeline within GCP? If so, you've come to the right place! We are going to show you how to setup your own GCP pipeline using Terraform Cloud. Unlike the DevSecOps Home Lab, we're just focused on developing the pipeline and deploying our application onto a Cloud Run resource.
Luckily for you all, you won't need to do anything. we've taken the liberty of developing all of the code for you. These are the two GitHub repositories that you need to look at before we get started:
- DevSecOps Pipeline Infrastructure: https://github.com/devsecblueprint/dsb-gcp-devsecops-infra
- FastAPI Application with Pipeline Definition: https://github.com/devsecblueprint/gcp-python-fastapi
Architecture Diagram
Architecture Breakdown
At a VERY high level, this architecture briefly covers the services that we will be leveraging for the DevSecOps Pipelines. Here are the descriptions with intent of each service:
- Artifact Registry: Stores container images and application artifacts for deployments.
- Cloud IAM: Provides secure identity and access management service accounts with roles for pipeline operations.
- Cloud Build: Automates build, test, and deployment processes within CI/CD workflows. This is defined by within the FastAPI Application Project.
- Cloud Storage: Stores build artifacts and logs generated during pipeline execution.
- Secret Manager: Securely manages sensitive data like API keys and credentials for pipelines.
Flow Diagram
Now that we've covered the architecture diagram, let's put this together so you can understand the flow and who everything is supposed to work.