hashicorp / terraform-provider-postgresql

As part of our introduction to self-service publishing in the Terraform Registry, this copy of the provider has been archived, and ownership has been transferred to active maintainers in the community. Please see the new location on the Terraform Registry: https://registry.terraform.io/providers/cyrilgdn/postgresql
https://github.com/cyrilgdn/terraform-provider-postgresql
Mozilla Public License 2.0
103 stars 79 forks source link

terraform progresql create role #163

Open ghost opened 4 years ago

ghost commented 4 years ago

This issue was originally opened by @Mike-Hawkins as hashicorp/terraform#25683. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.12.28
+ provider.postgresql v1.7.0
+ provider.random v2.3.0

Terraform Configuration Files

default.tf

provider "postgresql" {
  alias = "pg"
  host            = "tester.amazonaws.com"
  database        = "postgres"
  username        = "master"
  password        = "password"
  expected_version = "12.3"
}

resource "random_id" "password" {
  byte_length = 16
}

resource "postgresql_role" "default" {
  provider = "postgresql.pg"
  name = "tester_user"
  login = true
  password = random_id.password.hex
  encrypted_password = false
  inherit = false
}

Debug Output

Crash Output

Crash.log

Expected Behavior

Terraform should have created the role within the database

Actual Behavior

Crashing on terraform apply but, not on terraform plan

Steps to Reproduce

terraform init
terraform apply

Additional Context

The user that is being used for the role creation does have proper permissions to log into the database and create users

References

Mike-Hawkins commented 4 years ago

For future Reference. If you have the PGSERVICEFILE variable set you will get this error. After unsetting the variable it works as expected