Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serverless scale to 0 - terraform plan fails #501

Open
JulesClaussen opened this issue Dec 12, 2024 · 0 comments
Open

Serverless scale to 0 - terraform plan fails #501

JulesClaussen opened this issue Dec 12, 2024 · 0 comments

Comments

@JulesClaussen
Copy link

Hi there,

Terraform Version

1.9.8

Affected Resource(s)

At least postgresql_role.

Terraform Configuration Files

I have updated my aurora config to use the scale to 0 configuration. So when the database is scaled at 0, we have the error of the provider not being able to connect (obviously, the db is down).

resource "postgresql_role" "reader" {
  name     = var.db_reader_username
  login    = true
  password = random_password.reader_db_password.result
  roles    = ["pg_read_all_data"]
}

Debug Output

  ╷
  │ Error: Error connecting to PostgreSQL server mypostgres-server-postgresqlv2.cluster-aaaaaaaaa.***.rds.amazonaws.com (scheme: postgres): EOF
  │ 
  │   with module.aurora_postgresql.postgresql_role.reader,
  │   on .terraform/modules/aurora_postgresql/aurora-pg/aurora.tf line 95, in resource "postgresql_role" "reader":
  │   95: resource "postgresql_role" "reader" {
  │ 
  ╵
 

Expected Behavior

Maybe there could be a way to ping first to boot the database, and then wait for it to be up with a sort of timeout or something like this? In order to be able to resuscitate the database before querying it.

Actual Behavior

Terraform plan fails.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:
0. Create an aurora serverless database, with scale to 0.

  1. Wait for the database to "shutdown" (=scale to 0)
  2. terraform apply

Important Factoids

We have tried the new feature of aurora serverless scale to 0. The db was down at the time of the issue. When the db is up, the problem does NOT occur.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant