diff --git a/reference-architectures/cloud_deploy_flow/README.md b/reference-architectures/cloud_deploy_flow/README.md index 2592f34..4804353 100644 --- a/reference-architectures/cloud_deploy_flow/README.md +++ b/reference-architectures/cloud_deploy_flow/README.md @@ -106,26 +106,33 @@ demo: event-driven functions. - `eventarc.googleapis.com`: Enables Eventarc for routing events from sources to targets. +- `artifactregistry.googleapis.com`: Allows for image hosting for CI/CD. ## Getting Started To run this demo, follow these steps: -1. **Fork and Clone the Repository**: Start by forking this repository to your - GitHub account (So you can connect GCP to this repository), then clone it to - your local environment. After cloning, change your directory to the +1. **Fork and Clone the Repository**: Start by forking _this_ repository to + your GitHub account (So you can connect GCP to this repository), then clone + it to your local environment. After cloning, change your directory to the deployment demo: ```bash cd platform-engineering/reference-architectures/cloud_deploy_flow ``` + Note: you can't use a repository inside an Organization, just use your + personal account for this demo. + 2. **Set Up Environment Variables or Variables File**: You can set the necessary variables either by exporting them as environment variables or by creating a `terraform.tfvars` file. Refer to `variables.tf` for more details on each variable. Ensure the values match your Google Cloud project and GitHub configuration. + For the repo-name and repo-owner here, use the repository you just cloned + above. + - **Option 1**: Set environment variables manually in your shell: ```bash diff --git a/reference-architectures/cloud_deploy_flow/functions.tf b/reference-architectures/cloud_deploy_flow/functions.tf index 8dd4d3f..d417f42 100644 --- a/reference-architectures/cloud_deploy_flow/functions.tf +++ b/reference-architectures/cloud_deploy_flow/functions.tf @@ -30,21 +30,26 @@ resource "google_storage_bucket_object" "functions" { } # Cloud Functions configuration map + locals { cloud_functions = { - "create-release" = { + "createRelease" = { + name = "create-release" entry_point = "deployTrigger" pubsub_topic = google_pubsub_topic.topics["cloud-builds"].id } - "cloud-deploy-interactions" = { + "cloudDeployInteractions" = { + name = "cloud-deploy-interactions" entry_point = "cloudDeployInteractions" pubsub_topic = google_pubsub_topic.topics["deploy-commands"].id } - "cloud-deploy-operations" = { + "cloudDeployOperations" = { + name = "cloud-deploy-operations" entry_point = "cloudDeployOperations" pubsub_topic = google_pubsub_topic.topics["clouddeploy-operations"].id } - "cloud-deploy-approvals" = { + "cloudDeployApprovals" = { + name = "cloud-deploy-approvals" entry_point = "cloudDeployApprovals" pubsub_topic = google_pubsub_topic.topics["clouddeploy-approvals"].id } @@ -53,9 +58,10 @@ locals { # Create Cloud Functions using for_each resource "google_cloudfunctions2_function" "functions" { + #for_each = local.cloud_functions for_each = local.cloud_functions - name = each.key + name = each.value.name project = data.google_project.project.project_id location = var.region diff --git a/reference-architectures/cloud_deploy_flow/variables.tf b/reference-architectures/cloud_deploy_flow/variables.tf index c08dd98..d1fb949 100644 --- a/reference-architectures/cloud_deploy_flow/variables.tf +++ b/reference-architectures/cloud_deploy_flow/variables.tf @@ -35,7 +35,8 @@ locals { "cloudresourcemanager.googleapis.com", "run.googleapis.com", "cloudfunctions.googleapis.com", - "eventarc.googleapis.com" + "eventarc.googleapis.com", + "artifactregistry.googleapis.com" ] # List of roles for Cloud Build SA sa_roles_list = [