-
Notifications
You must be signed in to change notification settings - Fork 459
Description
TL;DR
There was a recent change in the google_sql_user resource. The password should now specified in the password_wo argument. If this is not done, terraform throws an annoying warning:
Warning: Available Write-only Attribute Alternative with module.cloudsql.module.cloudsql-google.google_sql_user.additional_users on .terraform/modules/cloudsql.cloudsql-google/modules/mysql/main.tf line 290, in resource "google_sql_user" "additional_users": password = each.value.random_password ? random_password.additional_passwords[each.value.name].result : each.value.password The attribute password has a write-only alternative password_wo available. Use the write-only alternative of the attribute when possible.
Expected behavior
password_wo is used and no warning is thrown.
Observed behavior
Warning as mentioned above
Terraform Configuration
module "cloudsql-google" {
source = "GoogleCloudPlatform/sql-db/google//modules/mysql"
version = "25.2.2"
database_version = var.sql_version
name = "${var.cluster_name}-mysql"
project_id = var.project_id
zone = "europe-west3-b"
region = var.region
disk_size = var.disk_size
#disk_autoresize_limit = 100
disk_type = "PD_SSD"
deletion_protection = var.deletion_protection
encryption_key_name = var.kms_key
tier = var.tier
user_name = var.sql_user
user_labels = var.user_labels
additional_users = var.additional_users
maintenance_window_day = 6
maintenance_window_hour = 20
maintenance_window_update_track = "canary"
ip_configuration = {
ipv4_enabled = false
ssl_mode = "ENCRYPTED_ONLY"
private_network = data.google_compute_network.selected_network.id
allocated_ip_range = null
authorized_networks = []
}
backup_configuration = {
binary_log_enabled = false #check
enabled = true
start_time = "22:00"
location = var.region
transaction_log_retention_days = 7
retained_backups = 7 #check
retention_unit = "COUNT"
}
enable_default_db = false
additional_databases = [{
name = "XXXX"
charset = "utf8mb4"
collation = "utf8mb4_0900_ai_ci"
},
{
name = "YYYY"
charset = "utf8mb4"
collation = "utf8mb4_0900_ai_ci"
}]
database_flags = concat(var.database_flags_initial, var.sql_mode_bool ? [{
name = "sql_mode"
value = "ALLOW_INVALID_DATES,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
}] : [])
insights_config = {
query_string_length = 1024
record_application_tags = false
record_client_address = false
query_plans_per_minute = 5
}
}
Terraform Version
Terraform v1.11.0
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v6.27.0
+ provider registry.terraform.io/hashicorp/google-beta v6.27.0
Terraform Provider Versions
[wk359@wab-devops-dev-all dev]$ terraform providers
Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/google] >= 6.0.0
├── module.cloudsql
│ ├── provider[registry.terraform.io/hashicorp/google]
│ └── module.cloudsql-google
│ ├── provider[registry.terraform.io/hashicorp/google] >= 6.1.0, < 7.0.0
│ ├── provider[registry.terraform.io/hashicorp/google-beta] >= 6.1.0, < 7.0.0
│ ├── provider[registry.terraform.io/hashicorp/null] ~> 3.1
│ └── provider[registry.terraform.io/hashicorp/random] ~> 3.1
Additional information
No response