terraform-google-modules / terraform-google-sql-db

Creates a Cloud SQL database instance
https://registry.terraform.io/modules/terraform-google-modules/sql-db/google
Apache License 2.0
266 stars 425 forks source link

Missing generated_root_password output #576

Closed guicane closed 6 months ago

guicane commented 9 months ago

TL;DR

When the module auto generates a root password there's no output for it so I can't throw the password in my secret manager.

Expected behavior

generated_root_password should be available as an output just like generated_user_password is.

Observed behavior

generated_root_password output isn't available to use.

Terraform Configuration

module "sql-db_mysql" {
  source  = "GoogleCloudPlatform/sql-db/google//modules/mysql"
  version = "18.2.0"

  name                 = var.mysql_instance_name
  project_id           = var.project
  region               = var.region
  zone                 = var.zone
  database_version     = var.mysql_database_version
  deletion_protection  = var.deletion_protection
  random_instance_name = true

  #master
  tier    = var.tier
  edition = var.edition

  ip_configuration = {
    require_ssl         = true
    ipv4_enabled        = falseto OrgPolicy
    private_network     = data.google_compute_network.peering_network.id
    allocated_ip_range  = data.google_compute_global_address.sql_psc.name
    authorized_networks = []
  }
}

resource "google_secret_manager_secret" "mysql_root_password" {
  project   = var.project
  secret_id = "${module.sql-db_mysql.instance_name}-mysql-root-password"
  labels    = var.user_labels

  replication {
    user_managed {
      replicas {
        location = "region-here"
      }
    }
  }
}

resource "google_secret_manager_secret_version" "mysql_root_password" {
  secret      = google_secret_manager_secret.mysql_root_password.id
  secret_data = module.sql-db_mysql.generated_root_password
}

Terraform Version

terraform 1.5.7

Additional information

No response

github-actions[bot] commented 6 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days