This is a template for a Cloud Run app.
You can initialize a GitHub repository to manage Cloud Run services with Terraform:
- Deploy a Cloud run service with Terraform
- Set up a GitHub Actions workflow for the Terraform
-
Create a repo from this template.
gh repo create <your new repo name> --template=nakabonne/cloud-run-app-template
-
Create a GCS bucket for Terraform backend if needed (optional).
gsutil mb -p "<gcp project>" -l "<region>" gs://"<bucket>"
-
Write your own config files.
terraform.tfvars
:project = "<gcp project>" region = "<region>" service_name = "<Cloud Run service name>"
terraform.tfbackend
:bucket = "<bucket for Terraform state>"
-
Run
terraform init -backend-config=terraform.tfbackend
-
Run
terraform apply
-
Set up GitHub Actions secrets
PROVIDER_NAME
andSA_EMAIL
.gh secret set PROVIDER_NAME --body=$(terraform output github_actions_provider_name | tr -d '"') gh secret set SA_EMAIL --body=$(terraform output github_actions_sa_email | tr -d '"')
-
Push to your repo.
For more details, please read terraform.
TBD