From 84498bfaa180b407248491cd1e593d7e9d58a193 Mon Sep 17 00:00:00 2001 From: Jieyu Tian Date: Thu, 17 Oct 2024 02:07:04 +0000 Subject: [PATCH] Add Apphub URI output to Cloud SQL modules --- modules/mssql/metadata.yaml | 15 +++++++++++++++ modules/mssql/outputs.tf | 8 ++++++++ modules/mysql/metadata.yaml | 21 ++++++++++++++++++--- modules/mysql/outputs.tf | 8 ++++++++ modules/postgresql/metadata.yaml | 21 ++++++++++++++++++--- modules/postgresql/outputs.tf | 8 ++++++++ 6 files changed, 75 insertions(+), 6 deletions(-) diff --git a/modules/mssql/metadata.yaml b/modules/mssql/metadata.yaml index 516e7119..bc64fae5 100644 --- a/modules/mssql/metadata.yaml +++ b/modules/mssql/metadata.yaml @@ -304,6 +304,12 @@ spec: type: - tuple - [] + - name: apphub_service_uri + description: Service URI in CAIS style to be used by Apphub. + type: + - object + service_id: string + service_uri: string - name: generated_user_password description: The auto generated default user password if not input password was provided type: string @@ -564,3 +570,12 @@ spec: - serviceusage.googleapis.com - sqladmin.googleapis.com - workflows.googleapis.com + providerVersions: + - source: hashicorp/google + version: ">= 5.12, < 7" + - source: hashicorp/google-beta + version: ">= 5.12, < 7" + - source: hashicorp/null + version: ~> 3.2 + - source: hashicorp/random + version: ~> 3.4 diff --git a/modules/mssql/outputs.tf b/modules/mssql/outputs.tf index ca491a20..18518baa 100644 --- a/modules/mssql/outputs.tf +++ b/modules/mssql/outputs.tf @@ -85,3 +85,11 @@ output "primary" { description = "The `google_sql_database_instance` resource representing the primary instance" sensitive = true } + +output "apphub_service_uri" { + value = { + service_uri = google_sql_database_instance.default.self_link + service_id = google_sql_database_instance.default.name + } + description = "Service URI in CAIS style to be used by Apphub." +} diff --git a/modules/mysql/metadata.yaml b/modules/mysql/metadata.yaml index 45a71e52..30cf72df 100644 --- a/modules/mysql/metadata.yaml +++ b/modules/mysql/metadata.yaml @@ -221,7 +221,7 @@ spec: connections: - source: source: github.com/terraform-google-modules/terraform-google-network//modules/vpc - version: "~> 9.1.0" + version: ~> 9.1.0 spec: outputExpr: network_id inputPath: private_network @@ -339,12 +339,12 @@ spec: connections: - source: source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa - version: "~> 4.3.0" + version: ~> 4.3.0 spec: outputExpr: id - source: source: github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2 - version: "~> 0.13.0" + version: ~> 0.13.0 spec: outputExpr: service_account_id - name: create_timeout @@ -407,6 +407,12 @@ spec: type: - tuple - [] + - name: apphub_service_uri + description: Service URI in CAIS style to be used by Apphub. + type: + - object + - service_id: string + service_uri: string - name: env_vars description: Exported environment variables type: @@ -914,3 +920,12 @@ spec: - serviceusage.googleapis.com - sqladmin.googleapis.com - workflows.googleapis.com + providerVersions: + - source: hashicorp/google + version: ">= 5.25, < 7" + - source: hashicorp/google-beta + version: ">= 5.25, < 7" + - source: hashicorp/null + version: ~> 3.1 + - source: hashicorp/random + version: ~> 3.1 diff --git a/modules/mysql/outputs.tf b/modules/mysql/outputs.tf index 85f19065..39afb6ce 100644 --- a/modules/mysql/outputs.tf +++ b/modules/mysql/outputs.tf @@ -154,3 +154,11 @@ output "env_vars" { "CLOUD_SQL_DATABASE_NAME" : local.database_name } } + +output "apphub_service_uri" { + value = { + service_uri = google_sql_database_instance.default.self_link + service_id = google_sql_database_instance.default.name + } + description = "Service URI in CAIS style to be used by Apphub." +} diff --git a/modules/postgresql/metadata.yaml b/modules/postgresql/metadata.yaml index 44db0443..cfc74ebf 100644 --- a/modules/postgresql/metadata.yaml +++ b/modules/postgresql/metadata.yaml @@ -223,7 +223,7 @@ spec: connections: - source: source: github.com/terraform-google-modules/terraform-google-network//modules/vpc - version: "~> 9.1.0" + version: ~> 9.1.0 spec: outputExpr: network_id inputPath: private_network @@ -319,12 +319,12 @@ spec: connections: - source: source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa - version: "~> 4.3.0" + version: ~> 4.3.0 spec: outputExpr: id - source: source: github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2 - version: "~> 0.13.0" + version: ~> 0.13.0 spec: outputExpr: service_account_id - name: create_timeout @@ -397,6 +397,12 @@ spec: type: - tuple - [] + - name: apphub_service_uri + description: Service URI in CAIS style to be used by Apphub. + type: + - object + - service_id: string + service_uri: string - name: dns_name description: DNS name of the instance endpoint type: string @@ -904,3 +910,12 @@ spec: - serviceusage.googleapis.com - sqladmin.googleapis.com - workflows.googleapis.com + providerVersions: + - source: hashicorp/google + version: ">= 5.25, < 7" + - source: hashicorp/google-beta + version: ">= 5.25, < 7" + - source: hashicorp/null + version: ~> 3.1 + - source: hashicorp/random + version: ~> 3.1 diff --git a/modules/postgresql/outputs.tf b/modules/postgresql/outputs.tf index 4874c5af..d95364a8 100644 --- a/modules/postgresql/outputs.tf +++ b/modules/postgresql/outputs.tf @@ -152,3 +152,11 @@ output "env_vars" { "CLOUD_SQL_DATABASE_NAME" : local.database_name } } + +output "apphub_service_uri" { + value = { + service_uri = google_sql_database_instance.default.self_link + service_id = google_sql_database_instance.default.name + } + description = "Service URI in CAIS style to be used by Apphub." +}