Skip to content
This repository has been archived by the owner on Nov 14, 2020. It is now read-only.

PostgreSQL provider is not using lazy connections #140

Closed
estahn opened this issue May 26, 2020 · 1 comment · Fixed by #199 or cyrilgdn/terraform-provider-postgresql#5
Closed

Comments

@estahn
Copy link
Contributor

estahn commented May 26, 2020

Terraform Version

Terraform v0.12.24
+ provider.aws v2.36.0
+ provider.kubernetes v1.10.0
+ provider.mysql v1.9.0
+ provider.postgresql v1.6.0
+ provider.rabbitmq v1.3.0
+ provider.random v2.2.1

Affected Resource(s)

  • provider.postgres

Terraform Configuration Files

provider "postgresql" {
  version  = "~> 1.6"
  alias    = "foo"
  host     = aws_db_instance.foo.address
  username = var.foo_username
  password = var.foo_password
  connect_timeout = 10
  superuser = false
}

Debug Output

aws_db_parameter_group.custom-notmidship: Importing from ID "custom-notmidship"...
aws_db_parameter_group.custom-notmidship: Import prepared!
  Prepared aws_db_parameter_group for import
aws_db_parameter_group.custom-notmidship: Refreshing state... [id=custom-notmidship]
Error: Error initializing PostgreSQL client: error detecting capabilities: error PostgreSQL version: dial tcp 172.31.31.5:5432: connect: operation timed out
  on /myproject/providers.tf line 89, in provider "postgresql":
  89: provider "postgresql" {

Expected Behavior

Running an import action (or any action for that matter) which is not touching posgres resources should not trigger the initialisation of the postgres provider.

Example:

 terraform import aws_db_parameter_group.custom-notmidship custom-notmidship

Actual Behavior

The postgres provider tries to connect to the database.

Steps to Reproduce

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

  1. Define postgres provider, see above
  2. Run terraform import ...
@mced
Copy link
Contributor

mced commented Oct 22, 2020

@cyrilgdn Do you have any news on this or a workaround except commenting postgresql providers when importing a resource ?

cyrilgdn pushed a commit that referenced this issue Nov 11, 2020
Running an import action (or any action for that matter) which is not
touching posgres resources should not trigger the initialisation of the
postgres provider.

Same behaviour as terraform-provider-mysql.

Fixes #140

Signed-off-by: Enrico Stahn <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants