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

The provider doesn't like spaces in passwords

Open red8888 opened this issue 3 years ago • 2 comments

Version:

Terraform v0.14.11
+ provider registry.terraform.io/cyrilgdn/postgresql v1.14.0
+ provider registry.terraform.io/hashicorp/aws v3.56.0
+ provider registry.terraform.io/hashicorp/google v3.65.0
+ provider registry.terraform.io/hashicorp/google-beta v3.82.0
+ provider registry.terraform.io/hashicorp/http v2.1.0

This works:

provider "postgresql" {
  scheme    = "gcppostgres"
  host      = <my cloudsql host>
  username  = "test"
  password  = "abc123"
  superuser = false
}

This throws Error: error detecting capabilities: error PostgreSQL version: pq: password authentication failed for user "test":

provider "postgresql" {
  scheme    = "gcppostgres"
  host      = <my cloudsql host>
  username  = "test"
  password  = "this is a pass phrase"
  superuser = false
}

red8888 avatar Aug 31 '21 14:08 red8888

QueryEscape call encodes a space with a "+" character, whereas lib/pq requires any part of a connection URI to be encoded with percent-encoding. @cyrilgdn What do you think about using PathEscape instead of QueryEscape? I can prepare a PR if you are okay with this change.

kostiantyn-nemchenko avatar Sep 01 '21 14:09 kostiantyn-nemchenko

What do you think about using PathEscape instead of QueryEscape? I can prepare a PR if you are okay with this change.

@kostiantyn-nemchenko If it fixes it, go ahead yes :+1: Thanks in advance!

cyrilgdn avatar Sep 02 '21 07:09 cyrilgdn