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

help with support for version terraform v0.13.x upgrade from v0.12.x #194

Open
miketwenty1 opened this issue Oct 21, 2020 · 1 comment
Open

Comments

@miketwenty1
Copy link

miketwenty1 commented Oct 21, 2020

Hi there,

I'm wondering if there is an issue with this terraform provider with the new version of 0.13.4
I'm unable to figure out how to upgrade/replace the old hashicorp provider that was used in v12.

error with terraform init

Initializing provider plugins...
- terraform.io/builtin/terraform is built in to Terraform
- Using previously-installed hashicorp/template v2.2.0
- Using previously-installed hashicorp/aws v3.11.0
- Using previously-installed terraform-providers/postgresql v1.7.1
- Finding latest version of hashicorp/postgresql...

Error: Failed to install providers

Could not find required providers, but found possible alternatives:

  hashicorp/postgresql -> terraform-providers/postgresql

If these suggestions look correct, upgrade your configuration with the
following command:

The following remote modules must also be upgraded for Terraform 0.13
compatibility:
- module.<some value> at
git::git@git<some value>

One thing to note is the "following command" is blank this seems like a bug.
It seems like the output is telling me to use this new provider from hashicorp/postgresql -> terraform-providers/postgresql

The provider terraform config: (trying to comply with v13 requirements).

provider "postgresql" {
  host              = <some value>
  port              = <some value>
  username          = <some value>
  password          = <some value>
  expected_version  = <some value>
  connect_timeout   = <some value>
  sslmode           = <some value>
}

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
    }
    postgresql = {
      source  = "terraform-providers/postgresql"
    }
  }

  required_version = ">= 0.13"
}

This will sucessfully add the new provider terraform-providers/postgresql to my terraform providers

terraform providers

├── provider[registry.terraform.io/hashicorp/aws]
└── <some module.repo>
    ├── provider[registry.terraform.io/hashicorp/aws]
    ├── provider[registry.terraform.io/terraform-providers/postgresql]
    ├── provider[registry.terraform.io/hashicorp/postgresql]
    ├── provider[terraform.io/builtin/terraform]
    ├── provider[registry.terraform.io/hashicorp/template]

As you can see from this output it
Here is an example of how I'm using the postgresql provider:

Example resources:
resource "postgresql_database" "service" {
  name = var.service_name
}

resource "postgresql_extension" "my_extension" {
  database  = var.service_name
  name      = "pg_transport"

  depends_on = [postgresql_database.service]
}

removing these resources will make the terraform providers command remove the provider[registry.terraform.io/hashicorp/postgresql] .. adding these resources will add it back. It seems to not want to use the given suggested provider.

Please let me know what I'm doing wrong thanks so much.

Edit:
Also note running terraform 0.13upgrade did add a version.tf but didn't fix the issue and didn't add the terraform-providers/postgresql I have above.

@miketwenty1
Copy link
Author

I'm not sure if something changed with the postgres provider. But it seems to just "work" now.
Another theory is.. my issue had to do with a cached .terraform folder in the repo and some weird backend issue.
ultimately the terraform 0.13upgrade did in indeed add the correct required provider info in version.tf .. if you're like me and still got errors try doing a terraform state list remove postgres resources delete .terraform / git clean, and then run terraform init / plan / apply / etc. Worked for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant