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

Terraform init fails when trying to use cyrilgdn/postgresql provider due to old hashicorp/postgresql provider #30559

Closed
pj opened this issue Feb 18, 2022 · 2 comments
Labels
bug new new issue not yet triaged

Comments

@pj
Copy link

pj commented Feb 18, 2022

Terraform Version

1.1.6

Terraform Configuration Files

terraform {
  required_version = ">= 1.1.6"
  required_providers {
    postgres = {
      source = "cyrilgdn/postgresql"
      version = "1.15.0"
    }
  }
}

provider "postgresql" {
  host = "test"
  port = 5432
  database = "test"
  username = "test"
  password = "test"
  sslmode = "require"
  connect_timeout = 15
}

Debug Output

2022-02-18T20:09:08.031Z [INFO]  Terraform version: 1.1.6
2022-02-18T20:09:08.031Z [INFO]  Go runtime version: go1.17.2
2022-02-18T20:09:08.031Z [INFO]  CLI args: []string{"/bin/terraform", "init"}
2022-02-18T20:09:08.031Z [DEBUG] Attempting to open CLI config file: /root/.terraformrc
2022-02-18T20:09:08.031Z [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2022-02-18T20:09:08.032Z [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2022-02-18T20:09:08.032Z [DEBUG] ignoring non-existing provider search directory /root/.terraform.d/plugins
2022-02-18T20:09:08.032Z [DEBUG] ignoring non-existing provider search directory /root/.local/share/terraform/plugins
2022-02-18T20:09:08.032Z [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins
2022-02-18T20:09:08.032Z [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins
2022-02-18T20:09:08.033Z [INFO]  CLI command args: []string{"init"}

Initializing the backend...
2022-02-18T20:09:08.039Z [DEBUG] New state was assigned lineage "745fb3d5-6c9c-4d50-080c-f901a3699f38"
2022-02-18T20:09:08.040Z [DEBUG] checking for provisioner in "."
2022-02-18T20:09:08.041Z [DEBUG] checking for provisioner in "/bin"

Initializing provider plugins...
- Finding cyrilgdn/postgresql versions matching "1.15.0"...
2022-02-18T20:09:08.041Z [DEBUG] Service discovery for registry.terraform.io at https://registry.terraform.io/.well-known/terraform.json
2022-02-18T20:09:08.136Z [DEBUG] GET https://registry.terraform.io/v1/providers/cyrilgdn/postgresql/versions
- Finding latest version of hashicorp/postgresql...
2022-02-18T20:09:08.208Z [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/postgresql/versions
2022-02-18T20:09:08.309Z [DEBUG] GET https://registry.terraform.io/v1/providers/cyrilgdn/postgresql/1.15.0/download/linux/amd64
2022-02-18T20:09:08.365Z [DEBUG] GET https://github.com/cyrilgdn/terraform-provider-postgresql/releases/download/v1.15.0/terraform-provider-postgresql_1.15.0_SHA256SUMS
2022-02-18T20:09:08.720Z [DEBUG] GET https://github.com/cyrilgdn/terraform-provider-postgresql/releases/download/v1.15.0/terraform-provider-postgresql_1.15.0_SHA256SUMS.sig
- Installing cyrilgdn/postgresql v1.15.0...
2022-02-18T20:09:11.263Z [DEBUG] Provider signed by 3918DD444A3876A6 Cyril Gaudin (Terraform providers) <[email protected]>
- Installed cyrilgdn/postgresql v1.15.0 (self-signed, key ID 3918DD444A3876A6)

Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/postgresql: provider registry registry.terraform.io does
│ not have a provider named registry.terraform.io/hashicorp/postgresql
│
│ Did you intend to use cyrilgdn/postgresql? If so, you must specify that source address in each module which requires that provider.
│ To see which modules are currently depending on hashicorp/postgresql, run the following command:
│     terraform providers
╵

Expected Behavior

postgresql provider from cyrilgdn installed correctly.

Actual Behavior

Error produced.

Steps to Reproduce

Run terraform init on the configuration. I've got a repo with a Dockerfile at https://github.com/pj/terraform_postgresql_problem, to run the configuration without any local configuration.

References

hashicorp/terraform-provider-postgresql#194 - This seems the same, but deleting the .terraform directory didn't help.

@pj pj added bug new new issue not yet triaged labels Feb 18, 2022
@pj
Copy link
Author

pj commented Feb 18, 2022

My bad, config should be:

terraform {
  required_version = ">= 1.1.6"
  required_providers {
    postgresql = { # This line is what needs to change.
      source = "cyrilgdn/postgresql"
      version = "1.15.0"
    }
  }
}

provider "postgresql" {
  host = "test"
  port = 5432
  database = "test"
  username = "test"
  password = "test"
  sslmode = "require"
  connect_timeout = 15
}

@pj pj closed this as completed Feb 18, 2022
@github-actions
Copy link
Contributor

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug new new issue not yet triaged
Projects
None yet
Development

No branches or pull requests

1 participant