This module creates the required Cloud Build jobs to implement a deployment pipeline for Cloud Run that implements a progression of code from developer branches to production with automated canary testing and percentage-based traffic management.
It is entirely based on the example provided by Google here.
- Copy the the
cloudbuild
directory to the root of your repository. - Change the substitutions in each of the Cloud Build YAML files in the
cloudbuild
directory in your repository to set the region and the name of your Cloud Run service. - Push the changes to your repository.
- Call this Terraform module and provide the required variables (and any optional variables) then apply the changes.
- The Github repository connection MUST be in the same region as the repository link (which therefore implicitly requires the triggers are in the same region as the repository)
module "cloudrun-cicd" {
source = "github.com/withriley/cloudrun-cicd"
create_github_connection = false
github_remote_uri = "https://github.com/petergriffin/epic_app.git"
github_connection_name = "repo_conn_name"
project_id = "production"
location = "us-central1"
}
Name | Type |
---|---|
google_cloudbuild_trigger.branch | resource |
google_cloudbuild_trigger.main | resource |
google_cloudbuild_trigger.tag | resource |
google_cloudbuildv2_connection.default | resource |
google_cloudbuildv2_repository.default | resource |
google_secret_manager_secret_iam_policy.default | resource |
google_iam_policy.default | data source |
google_project.project | data source |
google_secret_manager_secret.default | data source |
google_secret_manager_secret_version.default | data source |
No modules.
Name | Description | Type | Default | Required |
---|---|---|---|---|
create_github_connection | Boolean to determine whether or not to create a new Github connection. If false, you must provide the github_connection_id variable. | bool |
false |
no |
github_connection_name | The name of the Github connection to use (only the name is required not the full ID). Required only when create_github_link is false. | string |
null |
no |
github_org_name | The name of your Github organization/user. Required only when create_github_link is true. | string |
null |
no |
github_remote_uri | The HTTPS URI of the Github Repo to link to Cloud Build (ie. the repo we want to build from). Must include the protocol and .git extension. | string |
n/a | yes |
location | The location to deploy the resources to. | string |
n/a | yes |
main_branch_name | The name of the main branch of the Github repo. Defaults to 'main'. | string |
"main" |
no |
project_id | The Project ID where all resources are to be created by this module. | string |
n/a | yes |
secret_id | The name of the secret that contains the Github token. Assumed to be within the same project. | string |
null |
no |
No outputs.