Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion reference-architectures/cloud_deploy_flow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@ 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
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:
Expand All @@ -120,12 +121,16 @@ To run this demo, follow these steps:
cd platform-engineering/reference-architectures/cloud_deploy_flow
```

*Note:* you can't use a repo 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 repo you just cloned above.

- **Option 1**: Set environment variables manually in your shell:

```bash
Expand Down
16 changes: 11 additions & 5 deletions reference-architectures/cloud_deploy_flow/functions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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

Expand Down
3 changes: 2 additions & 1 deletion reference-architectures/cloud_deploy_flow/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down