From 418b2a942074936a4d93f7c373be0fcd3152e3fa Mon Sep 17 00:00:00 2001 From: Jieyu Tian Date: Fri, 4 Oct 2024 21:01:26 +0000 Subject: [PATCH 1/2] Generate output types for postgresql metadata.yaml. --- modules/postgresql/metadata.yaml | 855 +++++++++++++++++++++++-------- 1 file changed, 645 insertions(+), 210 deletions(-) diff --git a/modules/postgresql/metadata.yaml b/modules/postgresql/metadata.yaml index eec7abd3..53e08337 100644 --- a/modules/postgresql/metadata.yaml +++ b/modules/postgresql/metadata.yaml @@ -62,109 +62,65 @@ spec: location: examples/private_service_access interfaces: variables: - - name: activation_policy - description: The activation policy for the Cloud SQL instance.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. + - name: project_id + description: The project ID to manage the Cloud SQL resources varType: string - defaultValue: ALWAYS - - name: additional_databases - description: A list of databases to be created in your cluster - varType: |- - list(object({ - name = string - charset = string - collation = string - })) - defaultValue: [] - - name: additional_users - description: A list of users to be created in your cluster. A random password would be set for the user if the `random_password` variable is set. - varType: |- - list(object({ - name = string - password = string - random_password = bool - })) - defaultValue: [] - - 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`. + required: true + - name: name + description: The name of the Cloud SQL instance varType: string - defaultValue: ZONAL - - name: backup_configuration - description: The backup_configuration settings subblock for the database setings - varType: |- - object({ - enabled = optional(bool, false) - start_time = optional(string) - location = optional(string) - point_in_time_recovery_enabled = optional(bool, false) - transaction_log_retention_days = optional(string) - retained_backups = optional(number) - retention_unit = optional(string) - }) - defaultValue: {} - - name: connector_enforcement - description: Enforce that clients use the connector library - varType: bool - defaultValue: false - - name: create_timeout - description: The optional timout that is applied to limit long database creates. + required: true + - name: master_instance_name + description: Name of the master instance if this is a failover replica. Required for creating failover replica instance. Not needed for master instance. When removed, next terraform apply will promote this failover failover replica instance as master instance varType: string - defaultValue: 30m - - name: data_cache_enabled - description: Whether data cache is enabled for the instance. Defaults to false. Feature is only available for ENTERPRISE_PLUS tier and supported database_versions + - name: instance_type + description: The type of the instance. The supported values are SQL_INSTANCE_TYPE_UNSPECIFIED, CLOUD_SQL_INSTANCE, ON_PREMISES_INSTANCE and READ_REPLICA_INSTANCE. Set to READ_REPLICA_INSTANCE if master_instance_name value is provided + varType: string + defaultValue: CLOUD_SQL_INSTANCE + - name: random_instance_name + description: Sets random suffix at the end of the Cloud SQL resource name varType: bool defaultValue: false - - name: database_deletion_policy - description: "The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: \"ABANDON\"." - varType: string - - name: database_flags - description: The database flags for the Cloud SQL instance. See [more details](https://cloud.google.com/sql/docs/postgres/flags) - varType: |- - list(object({ - name = string - value = string - })) - defaultValue: [] - - name: database_integration_roles - description: The roles required by default database instance service account for integration with GCP services - varType: list(string) - defaultValue: [] - name: database_version description: The database version to use varType: string required: true - - name: db_charset - description: The charset for the default database + - name: region + description: The region of the Cloud SQL resources varType: string - defaultValue: "" - - name: db_collation - description: "The collation for the default database. Example: 'en_US.UTF8'" + defaultValue: us-central1 + - name: tier + description: The tier for the Cloud SQL instance. varType: string - defaultValue: "" - - name: db_name - description: The name of the default database to create + defaultValue: db-f1-micro + - name: edition + description: The edition of the Cloud SQL instance, can be ENTERPRISE or ENTERPRISE_PLUS. varType: string - defaultValue: default - - name: delete_timeout - description: The optional timout that is applied to limit long database deletes. + - name: zone + description: "The zone for the Cloud SQL instance, it should be something like: `us-central1-a`, `us-east1-c`." varType: string - defaultValue: 30m - - name: deletion_protection - description: Used to block Terraform from deleting a SQL Instance. - varType: bool - defaultValue: true + - name: secondary_zone + description: "The preferred zone for the replica instance, it should be something like: `us-central1-a`, `us-east1-c`." + varType: string + - name: follow_gae_application + description: A Google App Engine application whose zone to remain in. Must be in the same region as this instance. + varType: string + - name: activation_policy + description: The activation policy for the Cloud SQL instance.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. + varType: string + defaultValue: ALWAYS + - 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 + defaultValue: ZONAL - name: deletion_protection_enabled description: Enables protection of an Cloud SQL instance from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform). varType: bool defaultValue: false - - name: deny_maintenance_period - description: The Deny Maintenance Period fields to prevent automatic maintenance from occurring during a 90-day time period. List accepts only one value. See [more details](https://cloud.google.com/sql/docs/postgres/maintenance) - varType: |- - list(object({ - end_date = string - start_date = string - time = string - })) - defaultValue: [] + - name: read_replica_deletion_protection_enabled + description: Enables protection of replica instance from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform). + varType: bool + defaultValue: false - name: disk_autoresize description: Configuration to increase storage size. varType: bool @@ -181,50 +137,56 @@ spec: description: The disk type for the Cloud SQL instance. varType: string defaultValue: PD_SSD - - name: edition - description: The edition of the Cloud SQL instance, can be ENTERPRISE or ENTERPRISE_PLUS. - varType: string - - name: enable_default_db - description: Enable or disable the creation of the default database - varType: bool - defaultValue: true - - name: enable_default_user - description: Enable or disable the creation of the default user - varType: bool - defaultValue: true - - name: enable_google_ml_integration - description: Enable database ML integration - varType: bool - defaultValue: false - - name: enable_random_password_special - description: Enable special characters in generated random passwords. - varType: bool - defaultValue: false - - name: encryption_key_name - description: The full path to the encryption key used for the CMEK disk encryption + - name: pricing_plan + description: The pricing plan for the Cloud SQL instance. varType: string - - name: follow_gae_application - description: A Google App Engine application whose zone to remain in. Must be in the same region as this instance. + defaultValue: PER_USE + - name: maintenance_window_day + description: The day of week (1-7) for the Cloud SQL instance maintenance. + varType: number + defaultValue: 1 + - name: maintenance_window_hour + description: The hour of day (0-23) maintenance window for the Cloud SQL instance maintenance. + varType: number + defaultValue: 23 + - name: maintenance_window_update_track + description: The update track of maintenance window for the Cloud SQL instance maintenance.Can be either `canary` or `stable`. varType: string - - name: iam_users - description: A list of IAM users to be created in your CloudSQL instance + defaultValue: canary + - name: database_flags + description: The database flags for the Cloud SQL instance. See [more details](https://cloud.google.com/sql/docs/postgres/flags) varType: |- list(object({ - id = string, - email = string + name = string + value = string })) defaultValue: [] - connections: - - source: - source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa - version: v4.3.0 - spec: - outputExpr: id - - source: - source: github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2 - version: v0.13.0 - spec: - outputExpr: service_account_id + - name: user_labels + description: The key/value labels for the Cloud SQL instances. + varType: map(string) + defaultValue: {} + - name: deny_maintenance_period + description: The Deny Maintenance Period fields to prevent automatic maintenance from occurring during a 90-day time period. List accepts only one value. See [more details](https://cloud.google.com/sql/docs/postgres/maintenance) + varType: |- + list(object({ + end_date = string + start_date = string + time = string + })) + defaultValue: [] + - name: backup_configuration + description: The backup_configuration settings subblock for the database setings + varType: |- + object({ + enabled = optional(bool, false) + start_time = optional(string) + location = optional(string) + point_in_time_recovery_enabled = optional(bool, false) + transaction_log_retention_days = optional(string) + retained_backups = optional(number) + retention_unit = optional(string) + }) + defaultValue: {} - name: insights_config description: The insights_config settings for the database. varType: |- @@ -234,10 +196,16 @@ spec: record_application_tags = optional(bool, false) record_client_address = optional(bool, false) }) - - name: instance_type - description: The type of the instance. The supported values are SQL_INSTANCE_TYPE_UNSPECIFIED, CLOUD_SQL_INSTANCE, ON_PREMISES_INSTANCE and READ_REPLICA_INSTANCE. Set to READ_REPLICA_INSTANCE if master_instance_name value is provided - varType: string - defaultValue: CLOUD_SQL_INSTANCE + - name: password_validation_policy_config + description: The password validation policy settings for the database instance. + varType: |- + object({ + min_length = optional(number) + complexity = optional(string) + reuse_interval = optional(number) + disallow_username_substring = optional(bool) + password_change_interval = optional(string) + }) - name: ip_configuration description: The ip configuration for the Cloud SQL instances. varType: |- @@ -245,7 +213,6 @@ spec: authorized_networks = optional(list(map(string)), []) ipv4_enabled = optional(bool, true) private_network = optional(string) - require_ssl = optional(bool) ssl_mode = optional(string) allocated_ip_range = optional(string) enable_private_path_for_google_cloud_services = optional(bool, false) @@ -260,63 +227,6 @@ spec: spec: outputExpr: network_id inputPath: private_network - - name: maintenance_window_day - description: The day of week (1-7) for the Cloud SQL instance maintenance. - varType: number - defaultValue: 1 - - name: maintenance_window_hour - description: The hour of day (0-23) maintenance window for the Cloud SQL instance maintenance. - varType: number - defaultValue: 23 - - name: maintenance_window_update_track - description: The update track of maintenance window for the Cloud SQL instance maintenance.Can be either `canary` or `stable`. - varType: string - defaultValue: canary - - name: master_instance_name - description: Name of the master instance if this is a failover replica. Required for creating failover replica instance. Not needed for master instance. When removed, next terraform apply will promote this failover failover replica instance as master instance - varType: string - - name: module_depends_on - description: List of modules or resources this module depends on. - varType: list(any) - defaultValue: [] - - name: name - description: The name of the Cloud SQL instance - varType: string - required: true - - name: password_validation_policy_config - description: The password validation policy settings for the database instance. - varType: |- - object({ - min_length = optional(number) - complexity = optional(string) - reuse_interval = optional(number) - disallow_username_substring = optional(bool) - password_change_interval = optional(string) - }) - - name: pricing_plan - description: The pricing plan for the Cloud SQL instance. - varType: string - defaultValue: PER_USE - - name: project_id - description: The project ID to manage the Cloud SQL resources - varType: string - required: true - - name: random_instance_name - description: Sets random suffix at the end of the Cloud SQL resource name - varType: bool - defaultValue: false - - name: read_replica_deletion_protection - description: Used to block Terraform from deleting replica SQL Instances. - varType: bool - defaultValue: false - - name: read_replica_deletion_protection_enabled - description: Enables protection of replica instance from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform). - varType: bool - defaultValue: false - - name: read_replica_name_suffix - description: The optional suffix to add to the read instance name - varType: string - defaultValue: "" - 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 varType: |- @@ -346,7 +256,6 @@ spec: authorized_networks = optional(list(map(string)), []) ipv4_enabled = optional(bool) private_network = optional(string, ) - require_ssl = optional(bool) ssl_mode = optional(string) allocated_ip_range = optional(string) enable_private_path_for_google_cloud_services = optional(bool, false) @@ -357,31 +266,31 @@ spec: data_cache_enabled = optional(bool) })) defaultValue: [] - - name: region - description: The region of the Cloud SQL resources - varType: string - defaultValue: us-central1 - - name: root_password - description: Initial root password during creation - varType: string - - name: secondary_zone - description: "The preferred zone for the replica instance, it should be something like: `us-central1-a`, `us-east1-c`." + - name: read_replica_name_suffix + description: The optional suffix to add to the read instance name varType: string - - name: tier - description: The tier for the Cloud SQL instance. + defaultValue: "" + - name: db_name + description: The name of the default database to create varType: string - defaultValue: db-f1-micro - - name: update_timeout - description: The optional timout that is applied to limit long database updates. + defaultValue: default + - name: db_charset + description: The charset for the default database varType: string - defaultValue: 30m - - name: user_deletion_policy - description: "The deletion policy for the user. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where users cannot be deleted from the API if they have been granted SQL roles. Possible values are: \"ABANDON\"." + defaultValue: "" + - name: db_collation + description: "The collation for the default database. Example: 'en_US.UTF8'" varType: string - - name: user_labels - description: The key/value labels for the Cloud SQL instances. - varType: map(string) - defaultValue: {} + defaultValue: "" + - name: additional_databases + description: A list of databases to be created in your cluster + varType: |- + list(object({ + name = string + charset = string + collation = string + })) + defaultValue: [] - name: user_name description: The name of the default user varType: string @@ -390,58 +299,584 @@ spec: description: The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable. varType: string defaultValue: "" - - name: zone - description: "The zone for the Cloud SQL instance, it should be something like: `us-central1-a`, `us-east1-c`." + - name: additional_users + description: A list of users to be created in your cluster. A random password would be set for the user if the `random_password` variable is set. + varType: |- + list(object({ + name = string + password = string + random_password = bool + })) + defaultValue: [] + - name: iam_users + description: A list of IAM users to be created in your CloudSQL instance + varType: |- + list(object({ + id = string, + email = string + })) + defaultValue: [] + connections: + - source: + source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa + version: v4.3.0 + spec: + outputExpr: id + - source: + source: github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2 + version: v0.13.0 + spec: + outputExpr: service_account_id + - name: create_timeout + description: The optional timout that is applied to limit long database creates. + varType: string + defaultValue: 30m + - name: update_timeout + description: The optional timout that is applied to limit long database updates. + varType: string + defaultValue: 30m + - name: delete_timeout + description: The optional timout that is applied to limit long database deletes. + varType: string + defaultValue: 30m + - name: encryption_key_name + description: The full path to the encryption key used for the CMEK disk encryption + varType: string + - name: module_depends_on + description: List of modules or resources this module depends on. + varType: list(any) + defaultValue: [] + - name: deletion_protection + description: Used to block Terraform from deleting a SQL Instance. + varType: bool + defaultValue: true + - name: read_replica_deletion_protection + description: Used to block Terraform from deleting replica SQL Instances. + varType: bool + defaultValue: false + - name: enable_default_db + description: Enable or disable the creation of the default database + varType: bool + defaultValue: true + - name: enable_default_user + description: Enable or disable the creation of the default user + varType: bool + defaultValue: true + - name: database_deletion_policy + description: "The deletion policy for the database. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where databases cannot be deleted from the API if there are users other than cloudsqlsuperuser with access. Possible values are: \"ABANDON\"." varType: string + - name: user_deletion_policy + description: "The deletion policy for the user. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where users cannot be deleted from the API if they have been granted SQL roles. Possible values are: \"ABANDON\"." + varType: string + - name: enable_random_password_special + description: Enable special characters in generated random passwords. + varType: bool + defaultValue: false + - name: connector_enforcement + description: Enforce that clients use the connector library + varType: bool + defaultValue: false + - name: root_password + description: Initial root password during creation + varType: string + - name: data_cache_enabled + description: Whether data cache is enabled for the instance. Defaults to false. Feature is only available for ENTERPRISE_PLUS tier and supported database_versions + varType: bool + defaultValue: false + - name: enable_google_ml_integration + description: Enable database ML integration + varType: bool + defaultValue: false + - name: database_integration_roles + description: The roles required by default database instance service account for integration with GCP services + varType: list(string) + defaultValue: [] outputs: - name: additional_users description: List of maps of additional users and passwords + type: + - tuple + - [] - name: dns_name description: DNS name of the instance endpoint + type: string - name: env_vars description: Exported environment variables + type: + - object + - CLOUD_SQL_DATABASE_CONNECTION_NAME: string + CLOUD_SQL_DATABASE_HOST: string + CLOUD_SQL_DATABASE_NAME: string - name: generated_user_password description: The auto generated default user password if not input password was provided + type: string - name: iam_users description: The list of the IAM users with access to the CloudSQL instance + type: + - list + - - object + - email: string + id: string - name: instance_connection_name description: The connection name of the master instance to be used in connection strings + type: string - name: instance_first_ip_address description: The first IPv4 address of the addresses assigned. + type: string - name: instance_ip_address description: The IPv4 address assigned for the master instance + type: + - list + - - object + - ip_address: string + time_to_retire: string + type: string - name: instance_name description: The instance name for the master instance + type: string - name: instance_psc_attachment description: The psc_service_attachment_link created for the master instance + type: string - name: instance_self_link description: The URI of the master instance + type: string - name: instance_server_ca_cert description: The CA certificate information used to connect to the SQL instance via SSL + type: + - list + - - object + - cert: string + common_name: string + create_time: string + expiration_time: string + sha1_fingerprint: string - name: instance_service_account_email_address description: The service account email address assigned to the master instance + type: string - name: instances description: A list of all `google_sql_database_instance` resources we've created + type: + - tuple + - - - object + - available_maintenance_versions: + - list + - string + clone: + - list + - - object + - allocated_ip_range: string + database_names: + - list + - string + point_in_time: string + preferred_zone: string + source_instance_name: string + connection_name: string + database_version: string + deletion_protection: bool + dns_name: string + encryption_key_name: string + first_ip_address: string + id: string + instance_type: string + ip_address: + - list + - - object + - ip_address: string + time_to_retire: string + type: string + maintenance_version: string + master_instance_name: string + name: string + private_ip_address: string + project: string + psc_service_attachment_link: string + public_ip_address: string + region: string + replica_configuration: + - list + - - object + - ca_certificate: string + client_certificate: string + client_key: string + connect_retry_interval: number + dump_file_path: string + failover_target: bool + master_heartbeat_period: number + password: string + ssl_cipher: string + username: string + verify_server_certificate: bool + restore_backup_context: + - list + - - object + - backup_run_id: number + instance_id: string + project: string + root_password: string + self_link: string + server_ca_cert: + - list + - - object + - cert: string + common_name: string + create_time: string + expiration_time: string + sha1_fingerprint: string + service_account_email_address: string + settings: + - list + - - object + - activation_policy: string + active_directory_config: + - list + - - object + - domain: string + advanced_machine_features: + - list + - - object + - threads_per_core: number + availability_type: string + backup_configuration: + - list + - - object + - backup_retention_settings: + - list + - - object + - retained_backups: number + retention_unit: string + binary_log_enabled: bool + enabled: bool + location: string + point_in_time_recovery_enabled: bool + start_time: string + transaction_log_retention_days: number + collation: string + connector_enforcement: string + data_cache_config: + - list + - - object + - data_cache_enabled: bool + database_flags: + - set + - - object + - name: string + value: string + deletion_protection_enabled: bool + deny_maintenance_period: + - list + - - object + - end_date: string + start_date: string + time: string + disk_autoresize: bool + disk_autoresize_limit: number + disk_size: number + disk_type: string + edition: string + enable_dataplex_integration: bool + enable_google_ml_integration: bool + insights_config: + - list + - - object + - query_insights_enabled: bool + query_plans_per_minute: number + query_string_length: number + record_application_tags: bool + record_client_address: bool + ip_configuration: + - list + - - object + - allocated_ip_range: string + authorized_networks: + - set + - - object + - expiration_time: string + name: string + value: string + enable_private_path_for_google_cloud_services: bool + ipv4_enabled: bool + private_network: string + psc_config: + - set + - - object + - allowed_consumer_projects: + - set + - string + psc_enabled: bool + server_ca_mode: string + ssl_mode: string + location_preference: + - list + - - object + - follow_gae_application: string + secondary_zone: string + zone: string + maintenance_window: + - list + - - object + - day: number + hour: number + update_track: string + password_validation_policy: + - list + - - object + - complexity: string + disallow_username_substring: bool + enable_password_policy: bool + min_length: number + password_change_interval: string + reuse_interval: number + pricing_plan: string + sql_server_audit_config: + - list + - - object + - bucket: string + retention_interval: string + upload_interval: string + tier: string + time_zone: string + user_labels: + - map + - string + version: number + timeouts: + - object + - create: string + delete: string + update: string - name: primary description: The `google_sql_database_instance` resource representing the primary instance + type: + - object + - available_maintenance_versions: + - list + - string + clone: + - list + - - object + - allocated_ip_range: string + database_names: + - list + - string + point_in_time: string + preferred_zone: string + source_instance_name: string + connection_name: string + database_version: string + deletion_protection: bool + dns_name: string + encryption_key_name: string + first_ip_address: string + id: string + instance_type: string + ip_address: + - list + - - object + - ip_address: string + time_to_retire: string + type: string + maintenance_version: string + master_instance_name: string + name: string + private_ip_address: string + project: string + psc_service_attachment_link: string + public_ip_address: string + region: string + replica_configuration: + - list + - - object + - ca_certificate: string + client_certificate: string + client_key: string + connect_retry_interval: number + dump_file_path: string + failover_target: bool + master_heartbeat_period: number + password: string + ssl_cipher: string + username: string + verify_server_certificate: bool + restore_backup_context: + - list + - - object + - backup_run_id: number + instance_id: string + project: string + root_password: string + self_link: string + server_ca_cert: + - list + - - object + - cert: string + common_name: string + create_time: string + expiration_time: string + sha1_fingerprint: string + service_account_email_address: string + settings: + - list + - - object + - activation_policy: string + active_directory_config: + - list + - - object + - domain: string + advanced_machine_features: + - list + - - object + - threads_per_core: number + availability_type: string + backup_configuration: + - list + - - object + - backup_retention_settings: + - list + - - object + - retained_backups: number + retention_unit: string + binary_log_enabled: bool + enabled: bool + location: string + point_in_time_recovery_enabled: bool + start_time: string + transaction_log_retention_days: number + collation: string + connector_enforcement: string + data_cache_config: + - list + - - object + - data_cache_enabled: bool + database_flags: + - set + - - object + - name: string + value: string + deletion_protection_enabled: bool + deny_maintenance_period: + - list + - - object + - end_date: string + start_date: string + time: string + disk_autoresize: bool + disk_autoresize_limit: number + disk_size: number + disk_type: string + edition: string + enable_dataplex_integration: bool + enable_google_ml_integration: bool + insights_config: + - list + - - object + - query_insights_enabled: bool + query_plans_per_minute: number + query_string_length: number + record_application_tags: bool + record_client_address: bool + ip_configuration: + - list + - - object + - allocated_ip_range: string + authorized_networks: + - set + - - object + - expiration_time: string + name: string + value: string + enable_private_path_for_google_cloud_services: bool + ipv4_enabled: bool + private_network: string + psc_config: + - set + - - object + - allowed_consumer_projects: + - set + - string + psc_enabled: bool + server_ca_mode: string + ssl_mode: string + location_preference: + - list + - - object + - follow_gae_application: string + secondary_zone: string + zone: string + maintenance_window: + - list + - - object + - day: number + hour: number + update_track: string + password_validation_policy: + - list + - - object + - complexity: string + disallow_username_substring: bool + enable_password_policy: bool + min_length: number + password_change_interval: string + reuse_interval: number + pricing_plan: string + sql_server_audit_config: + - list + - - object + - bucket: string + retention_interval: string + upload_interval: string + tier: string + time_zone: string + user_labels: + - map + - string + version: number + timeouts: + - object + - create: string + delete: string + update: string - name: private_ip_address description: The first private (PRIVATE) IPv4 address assigned for the master instance + type: string - name: public_ip_address description: The first public (PRIMARY) IPv4 address assigned for the master instance + type: string - name: read_replica_instance_names description: The instance names for the read replica instances + type: + - tuple + - [] - name: replicas description: A list of `google_sql_database_instance` resources representing the replicas + type: + - tuple + - [] - name: replicas_instance_connection_names description: The connection names of the replica instances to be used in connection strings + type: + - tuple + - [] - name: replicas_instance_first_ip_addresses description: The first IPv4 addresses of the addresses assigned for the replica instances + type: + - tuple + - [] - name: replicas_instance_self_links description: The URIs of the replica instances + type: + - tuple + - [] - name: replicas_instance_server_ca_certs description: The CA certificates information used to connect to the replica instances via SSL + type: + - tuple + - [] - name: replicas_instance_service_account_email_addresses description: The service account email addresses assigned to the replica instances + type: + - tuple + - [] requirements: roles: - level: Project From 2d69685a60df12cfa3d4ce6f175edfff755b65cf Mon Sep 17 00:00:00 2001 From: Jieyu Tian Date: Sat, 5 Oct 2024 01:45:02 +0000 Subject: [PATCH 2/2] Generate output types for mysql metadata.yaml --- modules/mssql/metadata.yaml | 552 ++++++++++++++++------- modules/mysql/metadata.yaml | 842 +++++++++++++++++++++++++++--------- 2 files changed, 1024 insertions(+), 370 deletions(-) diff --git a/modules/mssql/metadata.yaml b/modules/mssql/metadata.yaml index 6bd022ee..516e7119 100644 --- a/modules/mssql/metadata.yaml +++ b/modules/mssql/metadata.yaml @@ -62,109 +62,61 @@ spec: location: examples/private_service_access interfaces: variables: - - name: activation_policy - description: The activation policy for the Cloud SQL instance. Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. + - name: project_id + description: The project ID to manage the Cloud SQL resources varType: string - defaultValue: ALWAYS - - name: active_directory_config - description: Active domain that the SQL instance will join. - varType: map(string) - defaultValue: {} - - name: additional_databases - description: A list of databases to be created in your cluster - varType: |- - list(object({ - name = string - charset = string - collation = string - })) - defaultValue: [] - - name: additional_users - description: A list of users to be created in your cluster. A random password would be set for the user if the `random_password` variable is set. - varType: |- - list(object({ - name = string - password = string - random_password = bool - })) - defaultValue: [] - - name: availability_type - description: The availability type for the Cloud SQL instance.This is only used to set up high availability for the MSSQL instance. Can be either `ZONAL` or `REGIONAL`. + required: true + - name: name + description: The name of the Cloud SQL instance varType: string - defaultValue: ZONAL - - name: backup_configuration - description: The database backup configuration. - varType: |- - object({ - binary_log_enabled = bool - enabled = bool - point_in_time_recovery_enabled = bool - start_time = string - transaction_log_retention_days = string - retained_backups = number - retention_unit = string - }) - defaultValue: - binary_log_enabled: null - enabled: false - point_in_time_recovery_enabled: null - retained_backups: null - retention_unit: null - start_time: null - transaction_log_retention_days: null - - name: connector_enforcement - description: Enforce that clients use the connector library + required: true + - name: master_instance_name + description: Name of the master instance if this is a failover replica. Required for creating failover replica instance. Not needed for master instance. When removed, next terraform apply will promote this failover failover replica instance as master instance + varType: string + - name: instance_type + description: The type of the instance. The supported values are SQL_INSTANCE_TYPE_UNSPECIFIED, CLOUD_SQL_INSTANCE, ON_PREMISES_INSTANCE and READ_REPLICA_INSTANCE. Set to READ_REPLICA_INSTANCE when primary_instance_name is provided + varType: string + defaultValue: CLOUD_SQL_INSTANCE + - name: random_instance_name + description: Sets random suffix at the end of the Cloud SQL resource name varType: bool defaultValue: false - - name: create_timeout - description: The optional timeout that is applied to limit long database creates. - varType: string - defaultValue: 30m - - name: database_flags - description: The database flags for the Cloud SQL. See [more details](https://cloud.google.com/sql/docs/sqlserver/flags) - varType: |- - list(object({ - name = string - value = string - })) - defaultValue: [] - name: database_version description: "The database version to use: SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, or SQLSERVER_2017_WEB" varType: string defaultValue: SQLSERVER_2017_STANDARD - - name: db_charset - description: The charset for the default database + - name: region + description: The region of the Cloud SQL resources varType: string - defaultValue: "" - - name: db_collation - description: "The collation for the default database. Example: 'en_US.UTF8'" + defaultValue: us-central1 + - name: tier + description: The tier for the Cloud SQL instance. varType: string - defaultValue: "" - - name: db_name - description: The name of the default database to create + defaultValue: db-custom-2-3840 + - name: edition + description: The edition of the instance, can be ENTERPRISE or ENTERPRISE_PLUS. varType: string - defaultValue: default - - name: delete_timeout - description: The optional timeout that is applied to limit long database deletes. + - name: zone + description: The zone for the Cloud SQL instance. varType: string - defaultValue: 30m - - name: deletion_protection - description: Used to block Terraform from deleting a SQL Instance. - varType: bool - defaultValue: true + - name: secondary_zone + description: "The preferred zone for the read replica instance, it should be something like: `us-central1-a`, `us-east1-c`." + varType: string + - name: follow_gae_application + description: A Google App Engine application whose zone to remain in. Must be in the same region as this instance. + varType: string + - name: activation_policy + description: The activation policy for the Cloud SQL instance. Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. + varType: string + defaultValue: ALWAYS + - name: availability_type + description: The availability type for the Cloud SQL instance.This is only used to set up high availability for the MSSQL instance. Can be either `ZONAL` or `REGIONAL`. + varType: string + defaultValue: ZONAL - name: deletion_protection_enabled description: Enables protection of an instance from accidental deletion protection across all surfaces (API, gcloud, Cloud Console and Terraform). varType: bool defaultValue: false - - name: deny_maintenance_period - description: The Deny Maintenance Period fields to prevent automatic maintenance from occurring during a 90-day time period. List accepts only one value. See [more details](https://cloud.google.com/sql/docs/sqlserver/maintenance) - varType: |- - list(object({ - end_date = string - start_date = string - time = string - })) - defaultValue: [] - name: disk_autoresize description: Configuration to increase storage size. varType: bool @@ -181,43 +133,10 @@ spec: description: The disk type for the Cloud SQL instance. varType: string defaultValue: PD_SSD - - name: edition - description: The edition of the instance, can be ENTERPRISE or ENTERPRISE_PLUS. - varType: string - - name: enable_default_db - description: Enable or disable the creation of the default database - varType: bool - defaultValue: true - - name: enable_default_user - description: Enable or disable the creation of the default user - varType: bool - defaultValue: true - - name: encryption_key_name - description: The full path to the encryption key used for the CMEK disk encryption - varType: string - - name: follow_gae_application - description: A Google App Engine application whose zone to remain in. Must be in the same region as this instance. - varType: string - - name: instance_type - description: The type of the instance. The supported values are SQL_INSTANCE_TYPE_UNSPECIFIED, CLOUD_SQL_INSTANCE, ON_PREMISES_INSTANCE and READ_REPLICA_INSTANCE. Set to READ_REPLICA_INSTANCE when primary_instance_name is provided + - name: pricing_plan + description: The pricing plan for the Cloud SQL instance. varType: string - defaultValue: CLOUD_SQL_INSTANCE - - name: ip_configuration - description: The ip configuration for the Cloud SQL instances. - varType: |- - object({ - authorized_networks = optional(list(map(string)), []) - ipv4_enabled = optional(bool) - private_network = optional(string) - require_ssl = optional(bool) - allocated_ip_range = optional(string) - }) - defaultValue: - allocated_ip_range: null - authorized_networks: [] - ipv4_enabled: true - private_network: null - require_ssl: null + defaultValue: PER_USE - name: maintenance_window_day description: The day of week (1-7) for the Cloud SQL maintenance. varType: number @@ -230,59 +149,96 @@ spec: description: The update track of maintenance window for the Cloud SQL maintenance.Can be either `canary` or `stable`. varType: string defaultValue: canary - - name: master_instance_name - description: Name of the master instance if this is a failover replica. Required for creating failover replica instance. Not needed for master instance. When removed, next terraform apply will promote this failover failover replica instance as master instance - varType: string - - name: module_depends_on - description: List of modules or resources this module depends on. - varType: list(any) + - name: deny_maintenance_period + description: The Deny Maintenance Period fields to prevent automatic maintenance from occurring during a 90-day time period. List accepts only one value. See [more details](https://cloud.google.com/sql/docs/sqlserver/maintenance) + varType: |- + list(object({ + end_date = string + start_date = string + time = string + })) defaultValue: [] - - name: name - description: The name of the Cloud SQL instance - varType: string - required: true - - name: pricing_plan - description: The pricing plan for the Cloud SQL instance. - varType: string - defaultValue: PER_USE - - name: project_id - description: The project ID to manage the Cloud SQL resources - varType: string - required: true - - name: random_instance_name - description: Sets random suffix at the end of the Cloud SQL resource name + - name: database_flags + description: The database flags for the Cloud SQL. See [more details](https://cloud.google.com/sql/docs/sqlserver/flags) + varType: |- + list(object({ + name = string + value = string + })) + defaultValue: [] + - name: data_cache_enabled + description: Whether data cache is enabled for the instance. Defaults to false. Feature is only available for ENTERPRISE_PLUS tier and supported database_versions varType: bool defaultValue: false - - name: region - description: The region of the Cloud SQL resources - varType: string - defaultValue: us-central1 - - name: root_password - description: MSSERVER password for the root user. If not set, a random one will be generated and available in the root_password output variable. - varType: string - defaultValue: "" - - name: secondary_zone - description: "The preferred zone for the read replica instance, it should be something like: `us-central1-a`, `us-east1-c`." - varType: string + - name: active_directory_config + description: Active domain that the SQL instance will join. + varType: map(string) + defaultValue: {} - name: sql_server_audit_config description: SQL server audit config settings. varType: map(string) defaultValue: {} - - name: tier - description: The tier for the Cloud SQL instance. - varType: string - defaultValue: db-custom-2-3840 - - name: time_zone - description: The time zone for Cloud SQL instance. - varType: string - - name: update_timeout - description: The optional timeout that is applied to limit long database updates. - varType: string - defaultValue: 30m - name: user_labels description: The key/value labels for the Cloud SQL instances. varType: map(string) defaultValue: {} + - name: ip_configuration + description: The ip configuration for the Cloud SQL instances. + varType: |- + object({ + authorized_networks = optional(list(map(string)), []) + ipv4_enabled = optional(bool) + private_network = optional(string) + allocated_ip_range = optional(string) + ssl_mode = optional(string) + }) + defaultValue: + allocated_ip_range: null + authorized_networks: [] + ipv4_enabled: true + private_network: null + ssl_mode: null + - name: backup_configuration + description: The database backup configuration. + varType: |- + object({ + binary_log_enabled = bool + enabled = bool + point_in_time_recovery_enabled = bool + start_time = string + transaction_log_retention_days = string + retained_backups = number + retention_unit = string + }) + defaultValue: + binary_log_enabled: null + enabled: false + point_in_time_recovery_enabled: null + retained_backups: null + retention_unit: null + start_time: null + transaction_log_retention_days: null + - name: db_name + description: The name of the default database to create + varType: string + defaultValue: default + - name: db_charset + description: The charset for the default database + varType: string + defaultValue: "" + - name: db_collation + description: "The collation for the default database. Example: 'en_US.UTF8'" + varType: string + defaultValue: "" + - name: additional_databases + description: A list of databases to be created in your cluster + varType: |- + list(object({ + name = string + charset = string + collation = string + })) + defaultValue: [] - name: user_name description: The name of the default user varType: string @@ -291,34 +247,296 @@ spec: description: The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable. varType: string defaultValue: "" - - name: zone - description: The zone for the Cloud SQL instance. + - name: additional_users + description: A list of users to be created in your cluster. A random password would be set for the user if the `random_password` variable is set. + varType: |- + list(object({ + name = string + password = string + random_password = bool + })) + defaultValue: [] + - name: root_password + description: MSSERVER password for the root user. If not set, a random one will be generated and available in the root_password output variable. + varType: string + defaultValue: "" + - name: create_timeout + description: The optional timeout that is applied to limit long database creates. varType: string + defaultValue: 30m + - name: update_timeout + description: The optional timeout that is applied to limit long database updates. + varType: string + defaultValue: 30m + - name: delete_timeout + description: The optional timeout that is applied to limit long database deletes. + varType: string + defaultValue: 30m + - name: module_depends_on + description: List of modules or resources this module depends on. + varType: list(any) + defaultValue: [] + - name: encryption_key_name + description: The full path to the encryption key used for the CMEK disk encryption + varType: string + - name: deletion_protection + description: Used to block Terraform from deleting a SQL Instance. + varType: bool + defaultValue: true + - name: connector_enforcement + description: Enforce that clients use the connector library + varType: bool + defaultValue: false + - name: time_zone + description: The time zone for Cloud SQL instance. + varType: string + - name: enable_default_db + description: Enable or disable the creation of the default database + varType: bool + defaultValue: true + - name: enable_default_user + description: Enable or disable the creation of the default user + varType: bool + defaultValue: true outputs: - name: additional_users description: List of maps of additional users and passwords + type: + - tuple + - [] - name: generated_user_password description: The auto generated default user password if not input password was provided + type: string - name: instance_address description: The IPv4 addesses assigned for the master instance + type: + - list + - - object + - ip_address: string + time_to_retire: string + type: string - name: instance_connection_name description: The connection name of the master instance to be used in connection strings + type: string - name: instance_first_ip_address description: The first IPv4 address of the addresses assigned. + type: string - name: instance_name description: The instance name for the master instance + type: string - name: instance_self_link description: The URI of the master instance + type: string - name: instance_server_ca_cert description: The CA certificate information used to connect to the SQL instance via SSL + type: + - list + - - object + - cert: string + common_name: string + create_time: string + expiration_time: string + sha1_fingerprint: string - name: instance_service_account_email_address description: The service account email address assigned to the master instance + type: string - name: primary description: The `google_sql_database_instance` resource representing the primary instance + type: + - object + - available_maintenance_versions: + - list + - string + clone: + - list + - - object + - allocated_ip_range: string + database_names: + - list + - string + point_in_time: string + preferred_zone: string + source_instance_name: string + connection_name: string + database_version: string + deletion_protection: bool + dns_name: string + encryption_key_name: string + first_ip_address: string + id: string + instance_type: string + ip_address: + - list + - - object + - ip_address: string + time_to_retire: string + type: string + maintenance_version: string + master_instance_name: string + name: string + private_ip_address: string + project: string + psc_service_attachment_link: string + public_ip_address: string + region: string + replica_configuration: + - list + - - object + - ca_certificate: string + client_certificate: string + client_key: string + connect_retry_interval: number + dump_file_path: string + failover_target: bool + master_heartbeat_period: number + password: string + ssl_cipher: string + username: string + verify_server_certificate: bool + restore_backup_context: + - list + - - object + - backup_run_id: number + instance_id: string + project: string + root_password: string + self_link: string + server_ca_cert: + - list + - - object + - cert: string + common_name: string + create_time: string + expiration_time: string + sha1_fingerprint: string + service_account_email_address: string + settings: + - list + - - object + - activation_policy: string + active_directory_config: + - list + - - object + - domain: string + advanced_machine_features: + - list + - - object + - threads_per_core: number + availability_type: string + backup_configuration: + - list + - - object + - backup_retention_settings: + - list + - - object + - retained_backups: number + retention_unit: string + binary_log_enabled: bool + enabled: bool + location: string + point_in_time_recovery_enabled: bool + start_time: string + transaction_log_retention_days: number + collation: string + connector_enforcement: string + data_cache_config: + - list + - - object + - data_cache_enabled: bool + database_flags: + - set + - - object + - name: string + value: string + deletion_protection_enabled: bool + deny_maintenance_period: + - list + - - object + - end_date: string + start_date: string + time: string + disk_autoresize: bool + disk_autoresize_limit: number + disk_size: number + disk_type: string + edition: string + enable_dataplex_integration: bool + enable_google_ml_integration: bool + insights_config: + - list + - - object + - query_insights_enabled: bool + query_plans_per_minute: number + query_string_length: number + record_application_tags: bool + record_client_address: bool + ip_configuration: + - list + - - object + - allocated_ip_range: string + authorized_networks: + - set + - - object + - expiration_time: string + name: string + value: string + enable_private_path_for_google_cloud_services: bool + ipv4_enabled: bool + private_network: string + psc_config: + - set + - - object + - allowed_consumer_projects: + - set + - string + psc_enabled: bool + server_ca_mode: string + ssl_mode: string + location_preference: + - list + - - object + - follow_gae_application: string + secondary_zone: string + zone: string + maintenance_window: + - list + - - object + - day: number + hour: number + update_track: string + password_validation_policy: + - list + - - object + - complexity: string + disallow_username_substring: bool + enable_password_policy: bool + min_length: number + password_change_interval: string + reuse_interval: number + pricing_plan: string + sql_server_audit_config: + - list + - - object + - bucket: string + retention_interval: string + upload_interval: string + tier: string + time_zone: string + user_labels: + - map + - string + version: number + timeouts: + - object + - create: string + delete: string + update: string - name: private_address description: The private IP address assigned for the master instance + type: string - name: root_password description: MSSERVER password for the root user. If not set, a random one will be generated and available in the root_password output variable. + type: string requirements: roles: - level: Project diff --git a/modules/mysql/metadata.yaml b/modules/mysql/metadata.yaml index 9c191f76..1e05a745 100644 --- a/modules/mysql/metadata.yaml +++ b/modules/mysql/metadata.yaml @@ -62,109 +62,68 @@ spec: location: examples/private_service_access interfaces: variables: - - name: activation_policy - description: The activation policy for the master instance. Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. + - name: project_id + description: The project ID to manage the Cloud SQL resources varType: string - defaultValue: ALWAYS - - name: additional_databases - description: A list of databases to be created in your cluster - varType: |- - list(object({ - name = string - charset = string - collation = string - })) - defaultValue: [] - - name: additional_users - description: A list of users to be created in your cluster. A random password would be set for the user if the `random_password` variable is set. - varType: |- - list(object({ - name = string - password = string - random_password = bool - type = string - host = string - })) - defaultValue: [] - - name: availability_type - description: The availability type for the master instance. Can be either `REGIONAL` or `null`. + required: true + - name: name + description: The name of the Cloud SQL resources varType: string - defaultValue: REGIONAL - - name: backup_configuration - description: The backup_configuration settings subblock for the database setings - varType: |- - object({ - binary_log_enabled = optional(bool, false) - enabled = optional(bool, false) - start_time = optional(string) - location = optional(string) - point_in_time_recovery_enabled = optional(bool, false) - transaction_log_retention_days = optional(string) - retained_backups = optional(number) - retention_unit = optional(string) - }) - defaultValue: {} - - name: connector_enforcement - description: Enforce that clients use the connector library + required: true + - name: random_instance_name + description: Sets random suffix at the end of the Cloud SQL resource name varType: bool defaultValue: false - - name: create_timeout - description: The optional timout that is applied to limit long database creates. + - name: replica_database_version + description: The read replica database version to use. This var should only be used during a database update. The update sequence 1. read-replica 2. master, setting this to an updated version will cause the replica to update, then you may update the master with the var database_version and remove this field after update is complete varType: string - defaultValue: 30m - - name: data_cache_enabled - description: Whether data cache is enabled for the instance. Defaults to false. Feature is only available for ENTERPRISE_PLUS tier and supported database_versions - varType: bool - defaultValue: false - - name: database_flags - description: List of Cloud SQL flags that are applied to the database server. See [more details](https://cloud.google.com/sql/docs/mysql/flags) - varType: |- - list(object({ - name = string - value = string - })) - defaultValue: [] - - name: database_integration_roles - description: The roles required by default database instance service account for integration with GCP services - varType: list(string) - defaultValue: [] + defaultValue: "" - name: database_version description: The database version to use varType: string required: true - - name: db_charset - description: The charset for the default database + - name: region + description: The region of the Cloud SQL resources varType: string - defaultValue: "" - - name: db_collation - description: "The collation for the default database. Example: 'utf8_general_ci'" + defaultValue: us-central1 + - name: master_instance_name + description: The name of the existing instance that will act as the master in the replication setup. varType: string - defaultValue: "" - - name: db_name - description: The name of the default database to create + - name: instance_type + description: Users can upgrade a read replica instance to a stand-alone Cloud SQL instance with the help of instance_type. To promote, users have to set the instance_type property as CLOUD_SQL_INSTANCE and remove/unset master_instance_name and replica_configuration from instance configuration. This operation might cause your instance to restart. varType: string - defaultValue: default - - name: delete_timeout - description: The optional timout that is applied to limit long database deletes. + - name: tier + description: The tier for the master instance. varType: string - defaultValue: 30m - - name: deletion_protection - description: Used to block Terraform from deleting a SQL Instance. - varType: bool - defaultValue: true + defaultValue: db-n1-standard-1 + - name: edition + description: The edition of the instance, can be ENTERPRISE or ENTERPRISE_PLUS. + varType: string + - name: zone + description: "The zone for the master instance, it should be something like: `us-central1-a`, `us-east1-c`." + varType: string + - name: secondary_zone + description: "The preferred zone for the secondary/failover instance, it should be something like: `us-central1-a`, `us-east1-c`." + varType: string + - name: follow_gae_application + description: A Google App Engine application whose zone to remain in. Must be in the same region as this instance. + varType: string + - name: activation_policy + description: The activation policy for the master instance. Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. + varType: string + defaultValue: ALWAYS + - name: availability_type + description: The availability type for the master instance. Can be either `REGIONAL` or `null`. + varType: string + defaultValue: REGIONAL - name: deletion_protection_enabled description: Enables protection of an instance from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform). varType: bool defaultValue: false - - name: deny_maintenance_period - description: The Deny Maintenance Period fields to prevent automatic maintenance from occurring during a 90-day time period. List accepts only one value. See [more details](https://cloud.google.com/sql/docs/mysql/maintenance) - varType: |- - list(object({ - end_date = string - start_date = string - time = string - })) - defaultValue: [] + - name: read_replica_deletion_protection_enabled + description: Enables protection of a read replica from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform). + varType: bool + defaultValue: false - name: disk_autoresize description: Configuration to increase storage size varType: bool @@ -181,50 +140,61 @@ spec: description: The disk type for the master instance. varType: string defaultValue: PD_SSD - - name: edition - description: The edition of the instance, can be ENTERPRISE or ENTERPRISE_PLUS. + - name: pricing_plan + description: The pricing plan for the master instance. varType: string - - name: enable_default_db - description: Enable or disable the creation of the default database - varType: bool - defaultValue: true - - name: enable_default_user - description: Enable or disable the creation of the default user - varType: bool - defaultValue: true - - name: enable_google_ml_integration - description: Enable database ML integration - varType: bool - defaultValue: false - - name: enable_random_password_special - description: Enable special characters in generated random passwords. + defaultValue: PER_USE + - name: maintenance_window_day + description: The day of week (1-7) for the master instance maintenance. + varType: number + defaultValue: 1 + - name: maintenance_window_hour + description: The hour of day (0-23) maintenance window for the master instance maintenance. + varType: number + defaultValue: 23 + - name: maintenance_window_update_track + description: The update track of maintenance window for the master instance maintenance. Can be either `canary` or `stable`. + varType: string + defaultValue: canary + - name: database_flags + description: List of Cloud SQL flags that are applied to the database server. See [more details](https://cloud.google.com/sql/docs/mysql/flags) + varType: |- + list(object({ + name = string + value = string + })) + defaultValue: [] + - name: user_labels + description: The key/value labels for the master instances. + varType: map(string) + defaultValue: {} + - name: data_cache_enabled + description: Whether data cache is enabled for the instance. Defaults to false. Feature is only available for ENTERPRISE_PLUS tier and supported database_versions varType: bool defaultValue: false - - name: encryption_key_name - description: The full path to the encryption key used for the CMEK disk encryption - varType: string - - name: follow_gae_application - description: A Google App Engine application whose zone to remain in. Must be in the same region as this instance. - varType: string - - name: iam_users - description: A list of IAM users to be created in your CloudSQL instance + - name: deny_maintenance_period + description: The Deny Maintenance Period fields to prevent automatic maintenance from occurring during a 90-day time period. List accepts only one value. See [more details](https://cloud.google.com/sql/docs/mysql/maintenance) varType: |- list(object({ - id = string, - email = string + end_date = string + start_date = string + time = string })) defaultValue: [] - connections: - - source: - source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa - version: v4.3.0 - spec: - outputExpr: id - - source: - source: github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2 - version: v0.13.0 - spec: - outputExpr: service_account_id + - name: backup_configuration + description: The backup_configuration settings subblock for the database setings + varType: |- + object({ + binary_log_enabled = optional(bool, false) + enabled = optional(bool, false) + start_time = optional(string) + location = optional(string) + point_in_time_recovery_enabled = optional(bool, false) + transaction_log_retention_days = optional(string) + retained_backups = optional(number) + retention_unit = optional(string) + }) + defaultValue: {} - name: insights_config description: The insights_config settings for the database. varType: |- @@ -234,9 +204,6 @@ spec: record_application_tags = bool record_client_address = bool }) - - name: instance_type - description: Users can upgrade a read replica instance to a stand-alone Cloud SQL instance with the help of instance_type. To promote, users have to set the instance_type property as CLOUD_SQL_INSTANCE and remove/unset master_instance_name and replica_configuration from instance configuration. This operation might cause your instance to restart. - varType: string - name: ip_configuration description: The ip_configuration settings subblock varType: |- @@ -244,7 +211,6 @@ spec: authorized_networks = optional(list(map(string)), []) ipv4_enabled = optional(bool, true) private_network = optional(string) - require_ssl = optional(bool) ssl_mode = optional(string) allocated_ip_range = optional(string) enable_private_path_for_google_cloud_services = optional(bool, false) @@ -259,29 +225,6 @@ spec: spec: outputExpr: network_id inputPath: private_network - - name: maintenance_window_day - description: The day of week (1-7) for the master instance maintenance. - varType: number - defaultValue: 1 - - name: maintenance_window_hour - description: The hour of day (0-23) maintenance window for the master instance maintenance. - varType: number - defaultValue: 23 - - name: maintenance_window_update_track - description: The update track of maintenance window for the master instance maintenance. Can be either `canary` or `stable`. - varType: string - defaultValue: canary - - name: master_instance_name - description: The name of the existing instance that will act as the master in the replication setup. - varType: string - - name: module_depends_on - description: List of modules or resources this module depends on. - varType: list(any) - defaultValue: [] - - name: name - description: The name of the Cloud SQL resources - varType: string - required: true - name: password_validation_policy_config description: The password validation policy settings for the database instance. varType: |- @@ -291,30 +234,6 @@ spec: complexity = string disallow_username_substring = bool }) - - name: pricing_plan - description: The pricing plan for the master instance. - varType: string - defaultValue: PER_USE - - name: project_id - description: The project ID to manage the Cloud SQL resources - varType: string - required: true - - name: random_instance_name - description: Sets random suffix at the end of the Cloud SQL resource name - varType: bool - defaultValue: false - - name: read_replica_deletion_protection - description: Used to block Terraform from deleting replica SQL Instances. - varType: bool - defaultValue: false - - name: read_replica_deletion_protection_enabled - description: Enables protection of a read replica from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform). - varType: bool - defaultValue: false - - name: read_replica_name_suffix - description: The optional suffix to add to the read instance name - varType: string - defaultValue: "" - 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 varType: |- @@ -348,7 +267,6 @@ spec: authorized_networks = optional(list(map(string)), []) ipv4_enabled = optional(bool) private_network = optional(string, ) - require_ssl = optional(bool) ssl_mode = optional(string) allocated_ip_range = optional(string) enable_private_path_for_google_cloud_services = optional(bool, false) @@ -356,101 +274,619 @@ spec: psc_allowed_consumer_projects = optional(list(string), []) }) encryption_key_name = optional(string) + data_cache_enabled = optional(bool) })) defaultValue: [] - - name: region - description: The region of the Cloud SQL resources - varType: string - defaultValue: us-central1 - - name: replica_database_version - description: The read replica database version to use. This var should only be used during a database update. The update sequence 1. read-replica 2. master, setting this to an updated version will cause the replica to update, then you may update the master with the var database_version and remove this field after update is complete + - name: read_replica_name_suffix + description: The optional suffix to add to the read instance name varType: string defaultValue: "" - - name: root_password - description: MySQL password for the root user. - varType: string - - name: secondary_zone - description: "The preferred zone for the secondary/failover instance, it should be something like: `us-central1-a`, `us-east1-c`." + - name: db_name + description: The name of the default database to create varType: string - - name: tier - description: The tier for the master instance. + defaultValue: default + - name: db_charset + description: The charset for the default database varType: string - defaultValue: db-n1-standard-1 - - name: update_timeout - description: The optional timout that is applied to limit long database updates. + defaultValue: "" + - name: db_collation + description: "The collation for the default database. Example: 'utf8_general_ci'" varType: string - defaultValue: 30m - - name: user_deletion_policy - description: "The deletion policy for the user. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where users cannot be deleted from the API if they have been granted SQL roles. Possible values are: \"ABANDON\"." + defaultValue: "" + - name: additional_databases + description: A list of databases to be created in your cluster + varType: |- + list(object({ + name = string + charset = string + collation = string + })) + defaultValue: [] + - name: user_name + description: The name of the default user varType: string + defaultValue: default - name: user_host description: The host for the default user varType: string defaultValue: "%" - - name: user_labels - description: The key/value labels for the master instances. - varType: map(string) - defaultValue: {} - - name: user_name - description: The name of the default user + - name: root_password + description: MySQL password for the root user. varType: string - defaultValue: default - name: user_password description: The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable. varType: string defaultValue: "" - - name: zone - description: "The zone for the master instance, it should be something like: `us-central1-a`, `us-east1-c`." + - name: additional_users + description: A list of users to be created in your cluster. A random password would be set for the user if the `random_password` variable is set. + varType: |- + list(object({ + name = string + password = string + random_password = bool + type = string + host = string + })) + defaultValue: [] + - name: iam_users + description: A list of IAM users to be created in your CloudSQL instance + varType: |- + list(object({ + id = string, + email = string + })) + defaultValue: [] + connections: + - source: + source: github.com/terraform-google-modules/terraform-google-service-accounts//modules/simple-sa + version: v4.3.0 + spec: + outputExpr: id + - source: + source: github.com/GoogleCloudPlatform/terraform-google-cloud-run//modules/v2 + version: v0.13.0 + spec: + outputExpr: service_account_id + - name: create_timeout + description: The optional timout that is applied to limit long database creates. + varType: string + defaultValue: 30m + - name: update_timeout + description: The optional timout that is applied to limit long database updates. + varType: string + defaultValue: 30m + - name: delete_timeout + description: The optional timout that is applied to limit long database deletes. + varType: string + defaultValue: 30m + - name: encryption_key_name + description: The full path to the encryption key used for the CMEK disk encryption + varType: string + - name: module_depends_on + description: List of modules or resources this module depends on. + varType: list(any) + defaultValue: [] + - name: deletion_protection + description: Used to block Terraform from deleting a SQL Instance. + varType: bool + defaultValue: true + - name: read_replica_deletion_protection + description: Used to block Terraform from deleting replica SQL Instances. + varType: bool + defaultValue: false + - name: enable_default_db + description: Enable or disable the creation of the default database + varType: bool + defaultValue: true + - name: enable_default_user + description: Enable or disable the creation of the default user + varType: bool + defaultValue: true + - name: enable_random_password_special + description: Enable special characters in generated random passwords. + varType: bool + defaultValue: false + - name: connector_enforcement + description: Enforce that clients use the connector library + varType: bool + defaultValue: false + - name: user_deletion_policy + description: "The deletion policy for the user. Setting ABANDON allows the resource to be abandoned rather than deleted. This is useful for Postgres, where users cannot be deleted from the API if they have been granted SQL roles. Possible values are: \"ABANDON\"." varType: string + - name: enable_google_ml_integration + description: Enable database ML integration + varType: bool + defaultValue: false + - name: database_integration_roles + description: The roles required by default database instance service account for integration with GCP services + varType: list(string) + defaultValue: [] outputs: - name: additional_users description: List of maps of additional users and passwords + type: + - tuple + - [] - name: env_vars description: Exported environment variables + type: + - object + - CLOUD_SQL_DATABASE_CONNECTION_NAME: string + CLOUD_SQL_DATABASE_HOST: string + CLOUD_SQL_DATABASE_NAME: string - name: generated_user_password description: The auto generated default user password if not input password was provided + type: string - name: iam_users description: The list of the IAM users with access to the CloudSQL instance + type: + - list + - - object + - email: string + id: string - name: instance_connection_name description: The connection name of the master instance to be used in connection strings + type: string - name: instance_first_ip_address description: The first IPv4 address of the addresses assigned for the master instance. + type: string - name: instance_ip_address description: The IPv4 address assigned for the master instance + type: + - list + - - object + - ip_address: string + time_to_retire: string + type: string - name: instance_name description: The instance name for the master instance + type: string - name: instance_psc_attachment description: The psc_service_attachment_link created for the master instance + type: string - name: instance_self_link description: The URI of the master instance + type: string - name: instance_server_ca_cert description: The CA certificate information used to connect to the SQL instance via SSL + type: + - list + - - object + - cert: string + common_name: string + create_time: string + expiration_time: string + sha1_fingerprint: string - name: instance_service_account_email_address description: The service account email address assigned to the master instance + type: string - name: instances description: A list of all `google_sql_database_instance` resources we've created + type: + - tuple + - - - object + - available_maintenance_versions: + - list + - string + clone: + - list + - - object + - allocated_ip_range: string + database_names: + - list + - string + point_in_time: string + preferred_zone: string + source_instance_name: string + connection_name: string + database_version: string + deletion_protection: bool + dns_name: string + encryption_key_name: string + first_ip_address: string + id: string + instance_type: string + ip_address: + - list + - - object + - ip_address: string + time_to_retire: string + type: string + maintenance_version: string + master_instance_name: string + name: string + private_ip_address: string + project: string + psc_service_attachment_link: string + public_ip_address: string + region: string + replica_configuration: + - list + - - object + - ca_certificate: string + client_certificate: string + client_key: string + connect_retry_interval: number + dump_file_path: string + failover_target: bool + master_heartbeat_period: number + password: string + ssl_cipher: string + username: string + verify_server_certificate: bool + restore_backup_context: + - list + - - object + - backup_run_id: number + instance_id: string + project: string + root_password: string + self_link: string + server_ca_cert: + - list + - - object + - cert: string + common_name: string + create_time: string + expiration_time: string + sha1_fingerprint: string + service_account_email_address: string + settings: + - list + - - object + - activation_policy: string + active_directory_config: + - list + - - object + - domain: string + advanced_machine_features: + - list + - - object + - threads_per_core: number + availability_type: string + backup_configuration: + - list + - - object + - backup_retention_settings: + - list + - - object + - retained_backups: number + retention_unit: string + binary_log_enabled: bool + enabled: bool + location: string + point_in_time_recovery_enabled: bool + start_time: string + transaction_log_retention_days: number + collation: string + connector_enforcement: string + data_cache_config: + - list + - - object + - data_cache_enabled: bool + database_flags: + - set + - - object + - name: string + value: string + deletion_protection_enabled: bool + deny_maintenance_period: + - list + - - object + - end_date: string + start_date: string + time: string + disk_autoresize: bool + disk_autoresize_limit: number + disk_size: number + disk_type: string + edition: string + enable_dataplex_integration: bool + enable_google_ml_integration: bool + insights_config: + - list + - - object + - query_insights_enabled: bool + query_plans_per_minute: number + query_string_length: number + record_application_tags: bool + record_client_address: bool + ip_configuration: + - list + - - object + - allocated_ip_range: string + authorized_networks: + - set + - - object + - expiration_time: string + name: string + value: string + enable_private_path_for_google_cloud_services: bool + ipv4_enabled: bool + private_network: string + psc_config: + - set + - - object + - allowed_consumer_projects: + - set + - string + psc_enabled: bool + server_ca_mode: string + ssl_mode: string + location_preference: + - list + - - object + - follow_gae_application: string + secondary_zone: string + zone: string + maintenance_window: + - list + - - object + - day: number + hour: number + update_track: string + password_validation_policy: + - list + - - object + - complexity: string + disallow_username_substring: bool + enable_password_policy: bool + min_length: number + password_change_interval: string + reuse_interval: number + pricing_plan: string + sql_server_audit_config: + - list + - - object + - bucket: string + retention_interval: string + upload_interval: string + tier: string + time_zone: string + user_labels: + - map + - string + version: number + timeouts: + - object + - create: string + delete: string + update: string - name: primary description: The `google_sql_database_instance` resource representing the primary instance + type: + - object + - available_maintenance_versions: + - list + - string + clone: + - list + - - object + - allocated_ip_range: string + database_names: + - list + - string + point_in_time: string + preferred_zone: string + source_instance_name: string + connection_name: string + database_version: string + deletion_protection: bool + dns_name: string + encryption_key_name: string + first_ip_address: string + id: string + instance_type: string + ip_address: + - list + - - object + - ip_address: string + time_to_retire: string + type: string + maintenance_version: string + master_instance_name: string + name: string + private_ip_address: string + project: string + psc_service_attachment_link: string + public_ip_address: string + region: string + replica_configuration: + - list + - - object + - ca_certificate: string + client_certificate: string + client_key: string + connect_retry_interval: number + dump_file_path: string + failover_target: bool + master_heartbeat_period: number + password: string + ssl_cipher: string + username: string + verify_server_certificate: bool + restore_backup_context: + - list + - - object + - backup_run_id: number + instance_id: string + project: string + root_password: string + self_link: string + server_ca_cert: + - list + - - object + - cert: string + common_name: string + create_time: string + expiration_time: string + sha1_fingerprint: string + service_account_email_address: string + settings: + - list + - - object + - activation_policy: string + active_directory_config: + - list + - - object + - domain: string + advanced_machine_features: + - list + - - object + - threads_per_core: number + availability_type: string + backup_configuration: + - list + - - object + - backup_retention_settings: + - list + - - object + - retained_backups: number + retention_unit: string + binary_log_enabled: bool + enabled: bool + location: string + point_in_time_recovery_enabled: bool + start_time: string + transaction_log_retention_days: number + collation: string + connector_enforcement: string + data_cache_config: + - list + - - object + - data_cache_enabled: bool + database_flags: + - set + - - object + - name: string + value: string + deletion_protection_enabled: bool + deny_maintenance_period: + - list + - - object + - end_date: string + start_date: string + time: string + disk_autoresize: bool + disk_autoresize_limit: number + disk_size: number + disk_type: string + edition: string + enable_dataplex_integration: bool + enable_google_ml_integration: bool + insights_config: + - list + - - object + - query_insights_enabled: bool + query_plans_per_minute: number + query_string_length: number + record_application_tags: bool + record_client_address: bool + ip_configuration: + - list + - - object + - allocated_ip_range: string + authorized_networks: + - set + - - object + - expiration_time: string + name: string + value: string + enable_private_path_for_google_cloud_services: bool + ipv4_enabled: bool + private_network: string + psc_config: + - set + - - object + - allowed_consumer_projects: + - set + - string + psc_enabled: bool + server_ca_mode: string + ssl_mode: string + location_preference: + - list + - - object + - follow_gae_application: string + secondary_zone: string + zone: string + maintenance_window: + - list + - - object + - day: number + hour: number + update_track: string + password_validation_policy: + - list + - - object + - complexity: string + disallow_username_substring: bool + enable_password_policy: bool + min_length: number + password_change_interval: string + reuse_interval: number + pricing_plan: string + sql_server_audit_config: + - list + - - object + - bucket: string + retention_interval: string + upload_interval: string + tier: string + time_zone: string + user_labels: + - map + - string + version: number + timeouts: + - object + - create: string + delete: string + update: string - name: private_address description: The private IP address assigned for the master instance + type: string - name: private_ip_address description: The first private (PRIVATE) IPv4 address assigned for the master instance + type: string - name: public_ip_address description: The first public (PRIMARY) IPv4 address assigned for the master instance + type: string - name: read_replica_instance_names description: The instance names for the read replica instances + type: + - tuple + - [] - name: replicas description: A list of `google_sql_database_instance` resources representing the replicas + type: + - tuple + - [] - name: replicas_instance_connection_names description: The connection names of the replica instances to be used in connection strings + type: + - tuple + - [] - name: replicas_instance_first_ip_addresses description: The first IPv4 addresses of the addresses assigned for the replica instances + type: + - tuple + - [] - name: replicas_instance_self_links description: The URIs of the replica instances + type: + - tuple + - [] - name: replicas_instance_server_ca_certs description: The CA certificates information used to connect to the replica instances via SSL + type: + - tuple + - [] - name: replicas_instance_service_account_email_addresses description: The service account email addresses assigned to the replica instances + type: + - tuple + - [] requirements: roles: - level: Project