This recipe is an Infrastructure as Code (IaC) recipe for deploying cloud projects in Google Cloud Platform (GCP). It demonstrates how to set up an Infrastructure-as-Code project with GitHub Actions, and includes a couple workflows:
In this case, using Terraform requires some preconfiguration:
- Cloud Storage bucket (to serve as the Terraform backend)
- an authorized service account in IAM with access to the bucket
Hint: See the Project Preconfiguration IaC Recipe for how to perform the preconfiguration using Terraform.
The GitHub Actions workflows require the following environment variables:
Secret Name | Description |
---|---|
GCP_PROJECT_ID | The GCP Project ID of the target project for deployment |
GCP_SA_KEY | The GCP IAM credentials used to authenticate and authorize GitHub Actions (use base64 encoded JSON) |
GCS_BACKEND_BUCKET_NAME | The name of the bucket used to store the tfsate (passed into the "bucket" parameter of a gcs backend) |