-
Notifications
You must be signed in to change notification settings - Fork 10k
Closed as not planned
Labels
bugwaiting for reproductionunable to reproduce issue without further informationunable to reproduce issue without further information
Description
Hi,
With Terraform 0.14.6, I have a problem when using the mysql provider in a module, it works at first run, but at second run I have this error during the plan stage Could not connect to server: dial tcp 127.0.0.1:3306: connect: connection refused
With Terraform 0.13.6, I have no problem it works with the same code
Best regards
Terraform Version
Terraform v0.14.6
+ provider registry.terraform.io/hashicorp/azurerm v2.47.0
+ provider registry.terraform.io/hashicorp/random v3.0.1
+ provider registry.terraform.io/terraform-providers/mysql v1.9.0
Terraform Configuration Files
In my stack
module "mysql" {
source = "/home/xxxx/git/projects/cloud/azure/terraform/modules/db-maria"
(...)
In my module
provider "mysql" {
alias = "create-users"
endpoint = format("%s:3306", azurerm_mariadb_server.mariadb_server.fqdn)
username = local.administrator_login
password = local.administrator_password
tls = var.force_ssl
}
resource "random_password" "db_passwords" {
count = var.create_databases_users ? length(var.databases_names) : 0
special = false
length = 32
}
resource "mysql_user" "users" {
count = var.create_databases_users ? length(var.databases_names) : 0
provider = mysql.create-users
user = (var.enable_user_suffix ? format("%s_user", var.databases_names[count.index]) : var.databases_names[count.index])
plaintext_password = random_password.db_passwords[count.index].result
host = "%"
depends_on = [azurerm_mariadb_database.mariadb_db, azurerm_mariadb_firewall_rule.mariadb_fw_rule]
}
resource "mysql_grant" "roles" {
count = var.create_databases_users ? length(var.databases_names) : 0
provider = mysql.create-users
user = (var.enable_user_suffix ? format("%s_user", var.databases_names[count.index]) : var.databases_names[count.index])
host = "%"
database = var.databases_names[count.index]
privileges = ["ALL"]
depends_on = [mysql_user.users]
}
Steps to Reproduce
terraform init
terraform apply
terraform apply
calebAtIspot
Metadata
Metadata
Assignees
Labels
bugwaiting for reproductionunable to reproduce issue without further informationunable to reproduce issue without further information