hashicorp / terraform-provider-mysql

Terraform MySQL provider – This Terraform provider is archived per our provider archiving process: https://terraform.io/docs/internals/archiving.html
https://www.terraform.io/docs/providers/mysql/
Mozilla Public License 2.0
61 stars 189 forks source link

[provider - mysql] Can't run TF plan when mysql connections are maxed out. #4

Closed hashibot closed 6 years ago

hashibot commented 7 years ago

This issue was originally opened by @rv-acabrera as hashicorp/terraform#11311. It was migrated here as part of the provider split. The original body of the issue is below.


Hi,

Terraform Version

0.8.2 - didn't see this fixed in any of the newer version changelogs.

Affected Resource(s)

Please list the resources as a list, for example:

Terraform Configuration Files

provider "mysql" {
    endpoint = "${aws_eip.bastion.public_ip}:4000"
    username = "${aws_db_instance.production_saeast1.username}"
    password = "<sensitive>"
}

Expected Behavior

I was expecting a terraform plan targeting a single AWS resource to not refresh the mysql provider.

Actual Behavior

The mysql database (rds) was at max connections and not accepting new connections. When we ran a terraform plan, the plan failed and the console returned an error saying that it could not establish a connection the the mysql database. Unfortunately, I don't have the exact output but we tried multiple times and received the same message. When we ran a terraform plan targeting a specific non-mysql resource (aws iam policy), it still failed with the same MySQL error message.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. using the mysql provider, have a MySQL Database that has maximum connections and is not accepting new connections.
  2. Run a terraform plan targeting a non mysql resource terraform plan -target aws_iam_policy.test

Important Factoids

The Mysql instance was RDS MySQL

joestump commented 6 years ago

Unfortunately, there's no simple way to keep Terraform from consuming MySQL connections on a terraform plan – even if it's just other resources that are changing. Terraform performs a read operation by default on plan. You can try -refresh=false, but usually a plan has to refresh in order to figure out what's changed.