diff --git a/modules/mysql/README.md b/modules/mysql/README.md index a102abfa..9a298674 100644 --- a/modules/mysql/README.md +++ b/modules/mysql/README.md @@ -111,6 +111,7 @@ module "mysql-db" { | Name | Description | |------|-------------| | additional\_users | List of maps of additional users and passwords | +| apphub\_service\_uri | Service URI in CAIS style to be used by Apphub. | | env\_vars | Exported environment variables | | generated\_user\_password | The auto generated default user password if not input password was provided | | iam\_users | The list of the IAM users with access to the CloudSQL instance | diff --git a/modules/mysql/metadata.yaml b/modules/mysql/metadata.yaml index 53e147b6..a4ae2a2f 100644 --- a/modules/mysql/metadata.yaml +++ b/modules/mysql/metadata.yaml @@ -81,6 +81,9 @@ spec: description: The database version to use varType: string required: true + - name: maintenance_version + description: The current software version on the instance. This attribute can not be set during creation. Refer to available_maintenance_versions attribute to see what maintenance_version are available for upgrade. When this attribute gets updated, it will cause an instance restart. Setting a maintenance_version value that is older than the current one on the instance will be ignored + varType: string - name: availability_type description: The availability type for the master instance. Can be either `REGIONAL` or `null`. varType: string @@ -308,9 +311,10 @@ spec: varType: |- object({ enable_password_policy = bool - min_length = number - complexity = string - disallow_username_substring = bool + min_length = optional(number) + complexity = optional(string) + disallow_username_substring = optional(bool) + reuse_interval = optional(number) }) - name: read_replicas description: List of read replicas to create. Encryption key is required for replica in different region. For replica in same region as master set encryption_key_name = null @@ -412,6 +416,13 @@ spec: type: - tuple - [] + - name: apphub_service_uri + description: Service URI in CAIS style to be used by Apphub. + type: + - object + - location: string + service_id: string + service_uri: string - name: env_vars description: Exported environment variables type: diff --git a/modules/mysql/outputs.tf b/modules/mysql/outputs.tf index 85f19065..21e01dbd 100644 --- a/modules/mysql/outputs.tf +++ b/modules/mysql/outputs.tf @@ -154,3 +154,12 @@ output "env_vars" { "CLOUD_SQL_DATABASE_NAME" : local.database_name } } + +output "apphub_service_uri" { + value = { + service_uri = "//cloudsql.googleapis.com/projects${element(split("/projects", google_sql_database_instance.default.self_link), 1)}" + service_id = substr("${var.name}-${md5("${var.region}-${var.project_id}")}", 0, 63) + location = var.region + } + description = "Service URI in CAIS style to be used by Apphub." +} diff --git a/modules/postgresql/README.md b/modules/postgresql/README.md index b2c1f38a..7783d2a0 100644 --- a/modules/postgresql/README.md +++ b/modules/postgresql/README.md @@ -181,6 +181,7 @@ module "pg" { | Name | Description | |------|-------------| | additional\_users | List of maps of additional users and passwords | +| apphub\_service\_uri | Service URI in CAIS style to be used by Apphub. | | dns\_name | DNS name of the instance endpoint | | env\_vars | Exported environment variables | | generated\_user\_password | The auto generated default user password if not input password was provided | diff --git a/modules/postgresql/metadata.yaml b/modules/postgresql/metadata.yaml index 370722f3..ab3e27cc 100644 --- a/modules/postgresql/metadata.yaml +++ b/modules/postgresql/metadata.yaml @@ -78,9 +78,12 @@ spec: description: The edition of the Cloud SQL instance, can be ENTERPRISE or ENTERPRISE_PLUS. varType: string - name: database_version - description: The database version to use + description: The database version to use. Can be 9_6, 14, 15, 16, 17. varType: string required: true + - name: maintenance_version + description: The current software version on the instance. This attribute can not be set during creation. Refer to available_maintenance_versions attribute to see what maintenance_version are available for upgrade. When this attribute gets updated, it will cause an instance restart. Setting a maintenance_version value that is older than the current one on the instance will be ignored + varType: string - name: availability_type description: The availability type for the Cloud SQL instance.This is only used to set up high availability for the PostgreSQL instance. Can be either `ZONAL` or `REGIONAL`. varType: string @@ -403,6 +406,13 @@ spec: type: - tuple - [] + - name: apphub_service_uri + description: Service URI in CAIS style to be used by Apphub. + type: + - object + - location: string + service_id: string + service_uri: string - name: dns_name description: DNS name of the instance endpoint type: string diff --git a/modules/postgresql/outputs.tf b/modules/postgresql/outputs.tf index 4874c5af..19f54f72 100644 --- a/modules/postgresql/outputs.tf +++ b/modules/postgresql/outputs.tf @@ -152,3 +152,12 @@ output "env_vars" { "CLOUD_SQL_DATABASE_NAME" : local.database_name } } + +output "apphub_service_uri" { + value = { + service_uri = "//cloudsql.googleapis.com/projects${element(split("/projects", google_sql_database_instance.default.self_link), 1)}" + service_id = substr("${var.name}-${md5("${var.region}-${var.project_id}")}", 0, 63) + location = var.region + } + description = "Service URI in CAIS style to be used by Apphub." +}