terraform-provider-postgresql icon indicating copy to clipboard operation
terraform-provider-postgresql copied to clipboard

pq: database "existing DB" does not exist when it does

Open paulpog-checkit opened this issue 2 years ago • 1 comments

Hi there,

Thank you for opening an issue. Please provide the following information:

Terraform Version

1.1.7

Affected Resource(s)

postgresql_grant

Expected Behavior

The grant should have been applied to the schema in that DB

Actual Behavior

Error: error detecting capabilities: error PostgreSQL version: pq: database "checkit-nick_cloud_job_scheduler" does not exist │ │ with module.define-test-users["aurora-test-cluster ssaini"].module.test-define-new-user["0"].module.table_grants_per_db["existing db"].postgresql_grant.schema_access["0"], │ on ../modules/rds_user_table_grants/db_table_grants.tf line 1, in resource "postgresql_grant" "schema_access": │ 1: resource "postgresql_grant" "schema_access" {

Steps to Reproduce

  1. terraform apply

Important Factoids

The DB was actually created by another terraform, thus there is nothing in this state file about the DB. However, the resource shouldn't be depending on it being defined in the state file and should check the AWS environment, or allow for an ID to be passed in via a Data Source.

paulpog-checkit avatar Sep 26 '22 15:09 paulpog-checkit

For us, this happens with any database with _ in the name, suggesting it's an issue with the handling of _s

bh9 avatar Mar 28 '23 09:03 bh9