Terraform v0.8.4
provider "postgresql" {
host = "myhost"
alias = "pg1"
username = "${var.pg-user}"
password = "${var.pg-password}"
}
resource "postgresql_role" "monitoring" {
provider = "postgresql.pg1"
name = "monitoring"
login = true
password = "monitoring"
}
running terraform plan should have retrieved the role created by this configuration in the older version of terraform without issue.
terraform plan errors out with the following message:
Error refreshing state: 1 error(s) occurred:
* postgresql_role.monitoring: Error reading role: pq: column "rolbypassrls" does not exist
Please list the steps required to reproduce the issue, for example:
terraform planThe column "rolbypassrls" about which the provider is complaining was not added to Postgresql until version 9.5, which means I am unable to use this provider / resource for any versions of Postgresql prior to that.
Drat, PostgreSQL 9.3 isn't EOLed yet. Alright, I'll add something to detect the version of PostgreSQL and catalog differences between versions.
Cheers!
FYI .. facing exact same issue when using PostgresSQL 9.4.7 via Amazon RDS.
It seems like this might be related to (but probably not an exact duplicate of) #11875: seems like we have a general problem of dealing with changes to the Postgres language and protocol between versions. I wonder if there's a holistic solution to address all problems of this type, or if we'd need to just spot-patch each situation separately.
@apparentlymart This is a known phenomena when the system catalogs change and something external is poking the system catalogs. I've figured out how I want to solve this problem but haven't had a chance to spin out the necessary fix. It will probably take me one or two nights to knock out the fix once I start work on this, but this is going to keep coming up as PostgreSQL evolves its schema. When I open a PR I'll tie both of these issues to the fix.
@sean- any chance of outlining the general solution? Maybe someone else can take a stab at it? I have a quick fix in mind for the redshift issue, as that is my immediate need, but I could try to solve this issue too.
@likwid RedShift is based on PostgreSQL 8.0.2, which is... old. The thing that needs to happen with the PostgreSQL provider is detect the dialect of PostgreSQL that it's talking to, and then have a query writer that produces the correct SQL based on the capabilities of the target. With CockroachDB and a few others out there, this indirection layer is going to be necessary. The "fix" in this case is trivial and I'll push a patch for this one-off with a note so that I can come back and fix it in the future.
Issue still appears with latest terraform 0.9.11 and postgres 9.4.7.
@kshcherban See and comment on terraform-providers/terraform-provider-postgresql#15 instead.
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.
Most helpful comment
Drat, PostgreSQL 9.3 isn't EOLed yet. Alright, I'll add something to detect the version of PostgreSQL and catalog differences between versions.