diff --git a/modules/cloudsql-instance/README.md b/modules/cloudsql-instance/README.md index 2cbb09b9..bf2a12e4 100644 --- a/modules/cloudsql-instance/README.md +++ b/modules/cloudsql-instance/README.md @@ -151,7 +151,7 @@ module "db" { | [network](variables.tf#L102) | VPC self link where the instances will be deployed. Private Service Networking must be enabled and configured in this VPC. | string | ✓ | | | [project_id](variables.tf#L113) | The ID of the project where this instances will be created. | string | ✓ | | | [region](variables.tf#L118) | Region of the primary instance. | string | ✓ | | -| [tier](variables.tf#L132) | The machine type to use for the instances. | string | ✓ | | +| [tier](variables.tf#L138) | The machine type to use for the instances. | string | ✓ | | | [authorized_networks](variables.tf#L17) | Map of NAME=>CIDR_RANGE to allow to connect to the database(s). | map(string) | | null | | [availability_type](variables.tf#L23) | Availability type for the primary replica. Either `ZONAL` or `REGIONAL`. | string | | "ZONAL" | | [backup_configuration](variables.tf#L29) | Backup settings for primary instance. Will be automatically enabled if using MySQL with one or more replicas. | object({…}) | | {…} | @@ -161,11 +161,12 @@ module "db" { | [disk_type](variables.tf#L73) | The type of data disk: `PD_SSD` or `PD_HDD`. | string | | "PD_SSD" | | [encryption_key_name](variables.tf#L79) | The full path to the encryption key used for the CMEK disk encryption of the primary instance. | string | | null | | [flags](variables.tf#L85) | Map FLAG_NAME=>VALUE for database-specific tuning. | map(string) | | null | -| [ipv4_enabled](variables.tf#L143) | Add a public IP address to database instance. | bool | | false | +| [ipv4_enabled](variables.tf#L149) | Add a public IP address to database instance. | bool | | false | | [labels](variables.tf#L91) | Labels to be attached to all instances. | map(string) | | null | | [prefix](variables.tf#L107) | Prefix used to generate instance names. | string | | null | | [replicas](variables.tf#L123) | Map of NAME=> {REGION, KMS_KEY} for additional read replicas. Set to null to disable replica creation. | map(object({…})) | | {} | -| [users](variables.tf#L137) | Map of users to create in the primary instance (and replicated to other replicas) in the format USER=>PASSWORD. For MySQL, anything afterr the first `@` (if persent) will be used as the user's host. Set PASSWORD to null if you want to get an autogenerated password. | map(string) | | null | +| [root_password](variables.tf#L132) | Root password of the Cloud SQL instance. Required for MS SQL Server | string | | null | +| [users](variables.tf#L143) | Map of users to create in the primary instance (and replicated to other replicas) in the format USER=>PASSWORD. For MySQL, anything afterr the first `@` (if persent) will be used as the user's host. Set PASSWORD to null if you want to get an autogenerated password. | map(string) | | null | ## Outputs diff --git a/modules/cloudsql-instance/main.tf b/modules/cloudsql-instance/main.tf index 6cd280be..f15b386b 100644 --- a/modules/cloudsql-instance/main.tf +++ b/modules/cloudsql-instance/main.tf @@ -50,6 +50,7 @@ resource "google_sql_database_instance" "primary" { region = var.region database_version = var.database_version encryption_key_name = var.encryption_key_name + root_password = var.root_password settings { tier = var.tier diff --git a/modules/cloudsql-instance/variables.tf b/modules/cloudsql-instance/variables.tf index cd1581a2..05fbaf29 100644 --- a/modules/cloudsql-instance/variables.tf +++ b/modules/cloudsql-instance/variables.tf @@ -129,6 +129,12 @@ variable "replicas" { default = {} } +variable "root_password" { + description = "Root password of the Cloud SQL instance. Required for MS SQL Server" + type = string + default = null +} + variable "tier" { description = "The machine type to use for the instances." type = string