Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add new output variable called database_names #664

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions modules/mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ module "mysql-db" {
|------|-------------|
| additional\_users | List of maps of additional users and passwords |
| apphub\_service\_uri | Service URI in CAIS style to be used by Apphub. |
| database\_names | List of all database names created. |
| 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 |
Expand Down
18 changes: 12 additions & 6 deletions modules/mysql/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,24 +329,25 @@ spec:
}))
defaultValue: []
- name: iam_users
description: A list of IAM users to be created in your CloudSQL instance
description: A list of IAM users to be created in your CloudSQL instance. iam.users.type can be CLOUD_IAM_USER, CLOUD_IAM_SERVICE_ACCOUNT, CLOUD_IAM_GROUP and is required for type CLOUD_IAM_GROUP (IAM groups)
varType: |-
list(object({
id = string,
email = string
email = string,
type = optional(string)
}))
defaultValue: []
connections:
- source:
source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa
version: ~> 4.4
spec:
outputExpr: account_details
outputExpr: '{"id": account_details.id, "email": account_details.email, "type": "CLOUD_IAM_SERVICE_ACCOUNT"}'
- source:
source: github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2
version: ~> 0.13
spec:
outputExpr: service_account_id
outputExpr: '{"id": service_account_id.id, "email": service_account_id.email, "type": "CLOUD_IAM_SERVICE_ACCOUNT"}'
- name: create_timeout
description: The optional timout that is applied to limit long database creates.
varType: string
Expand Down Expand Up @@ -413,6 +414,11 @@ spec:
- object
- service_id: string
service_uri: string
- name: database_names
description: List of all database names created.
type:
- list
- - string
- name: env_vars
description: Exported environment variables
type:
Expand Down Expand Up @@ -922,9 +928,9 @@ spec:
- workflows.googleapis.com
providerVersions:
- source: hashicorp/google
version: ">= 5.25, < 7"
version: ">= 6.1, < 7"
- source: hashicorp/google-beta
version: ">= 5.25, < 7"
version: ">= 6.1, < 7"
- source: hashicorp/null
version: ~> 3.1
- source: hashicorp/random
Expand Down
9 changes: 9 additions & 0 deletions modules/mysql/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ output "instances" {
sensitive = true
}

output "database_names" {
value = concat([
for db in google_sql_database.default : db.name
], [
for db in google_sql_database.additional_databases : db.name
])
description = "List of all database names created."
}

output "env_vars" {
description = "Exported environment variables"
value = {
Expand Down
1 change: 1 addition & 0 deletions modules/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ module "pg" {
|------|-------------|
| additional\_users | List of maps of additional users and passwords |
| apphub\_service\_uri | Service URI in CAIS style to be used by Apphub. |
| database\_names | List of all database names created. |
| 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 |
Expand Down
18 changes: 12 additions & 6 deletions modules/postgresql/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -309,24 +309,25 @@ spec:
}))
defaultValue: []
- name: iam_users
description: A list of IAM users to be created in your CloudSQL instance
description: A list of IAM users to be created in your CloudSQL instance. iam.users.type can be CLOUD_IAM_USER, CLOUD_IAM_SERVICE_ACCOUNT, CLOUD_IAM_GROUP and is required for type CLOUD_IAM_GROUP (IAM groups)
varType: |-
list(object({
id = string,
email = string
email = string,
type = optional(string)
}))
defaultValue: []
connections:
- source:
source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa
version: ~> 4.4
spec:
outputExpr: account_details
outputExpr: '{"id": account_details.id, "email": account_details.email, "type": "CLOUD_IAM_SERVICE_ACCOUNT"}'
- source:
source: github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2
version: ~> 0.13
spec:
outputExpr: service_account_id
outputExpr: '{"id": service_account_id.id, "email": service_account_id.email, "type": "CLOUD_IAM_SERVICE_ACCOUNT"}'
- name: create_timeout
description: The optional timout that is applied to limit long database creates.
varType: string
Expand Down Expand Up @@ -403,6 +404,11 @@ spec:
- object
- service_id: string
service_uri: string
- name: database_names
description: List of all database names created.
type:
- list
- - string
- name: dns_name
description: DNS name of the instance endpoint
type: string
Expand Down Expand Up @@ -912,9 +918,9 @@ spec:
- workflows.googleapis.com
providerVersions:
- source: hashicorp/google
version: ">= 5.25, < 7"
version: ">= 6.1, < 7"
- source: hashicorp/google-beta
version: ">= 5.25, < 7"
version: ">= 6.1, < 7"
- source: hashicorp/null
version: ~> 3.1
- source: hashicorp/random
Expand Down
9 changes: 9 additions & 0 deletions modules/postgresql/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ output "dns_name" {
description = "DNS name of the instance endpoint"
}

output "database_names" {
value = concat([
for db in google_sql_database.default : db.name
], [
for db in google_sql_database.additional_databases : db.name
])
description = "List of all database names created."
}

output "env_vars" {
description = "Exported environment variables"
value = {
Expand Down