Skip to content

Commit

Permalink
chore: Add Apphub URI output to cloud run and cloud run v2 (#250)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjy9206 authored Oct 23, 2024
1 parent 18afd56 commit f24abe8
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ module "cloud_run" {

| Name | Description |
|------|-------------|
| apphub\_service\_uri | Service URI in CAIS style to be used by Apphub. |
| domain\_map\_id | Unique Identifier for the created domain map |
| domain\_map\_status | Status of Domain mapping |
| location | Location in which the Cloud Run service was created |
Expand Down
14 changes: 10 additions & 4 deletions metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,12 @@ spec:
varType: list(string)
defaultValue: []
outputs:
- name: apphub_service_uri
description: Service URI in CAIS style to be used by Apphub.
type:
- object
- service_id: string
service_uri: string
- name: domain_map_id
description: Unique Identifier for the created domain map
type:
Expand Down Expand Up @@ -307,6 +313,10 @@ spec:
- []
requirements:
roles:
- level: Project
roles:
- roles/accesscontextmanager.policyAdmin
- roles/orgpolicy.policyAdmin
- level: Project
roles:
- roles/owner
Expand All @@ -315,10 +325,6 @@ spec:
- roles/resourcemanager.folderAdmin
- roles/resourcemanager.projectCreator
- roles/resourcemanager.projectDeleter
- level: Project
roles:
- roles/accesscontextmanager.policyAdmin
- roles/orgpolicy.policyAdmin
services:
- cloudresourcemanager.googleapis.com
- storage-api.googleapis.com
Expand Down
1 change: 1 addition & 0 deletions modules/v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Functional examples are included in the

| Name | Description |
|------|-------------|
| apphub\_service\_uri | Service URI in CAIS style to be used by Apphub. |
| creator | Email address of the authenticated creator. |
| effective\_annotations | All of annotations (key/value pairs) present on the resource in GCP, including the annotations configured through Terraform, other clients and services. |
| last\_modifier | Email address of the last authenticated modifier. |
Expand Down
14 changes: 10 additions & 4 deletions modules/v2/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,12 @@ spec:
varType: list(string)
defaultValue: []
outputs:
- name: apphub_service_uri
description: Service URI in CAIS style to be used by Apphub.
type:
- object
- service_id: string
service_uri: string
- name: creator
description: Email address of the authenticated creator.
type: string
Expand Down Expand Up @@ -394,10 +400,6 @@ spec:
uri: string
requirements:
roles:
- level: Project
roles:
- roles/accesscontextmanager.policyAdmin
- roles/orgpolicy.policyAdmin
- level: Project
roles:
- roles/owner
Expand All @@ -406,6 +408,10 @@ spec:
- roles/resourcemanager.folderAdmin
- roles/resourcemanager.projectCreator
- roles/resourcemanager.projectDeleter
- level: Project
roles:
- roles/accesscontextmanager.policyAdmin
- roles/orgpolicy.policyAdmin
services:
- cloudresourcemanager.googleapis.com
- storage-api.googleapis.com
Expand Down
8 changes: 8 additions & 0 deletions modules/v2/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,11 @@ output "service_account_id" {
description = "Service account id and email"
value = local.service_account_output
}

output "apphub_service_uri" {
value = {
service_uri = "//run.googleapis.com/${google_cloud_run_v2_service.main.id}"
service_id = substr("${var.service_name}-${md5("${var.location}-${var.project_id}")}", 0, 63)
}
description = "Service URI in CAIS style to be used by Apphub."
}
7 changes: 7 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,10 @@ output "verified_domain_name" {
description = "List of Custom Domain Name"
}

output "apphub_service_uri" {
value = {
service_uri = "//run.googleapis.com/${google_cloud_run_service.main.id}"
service_id = substr("${var.service_name}-${md5("${var.location}-${var.project_id}")}", 0, 63)
}
description = "Service URI in CAIS style to be used by Apphub."
}

0 comments on commit f24abe8

Please sign in to comment.