Skip to content

Constant configuration drift on postgresql_grant for ALL TABLES #303

@mbrancato

Description

@mbrancato

Terraform Version

Terraform v1.4.6
on darwin_amd64
+ provider registry.terraform.io/cyrilgdn/postgresql v1.19.0

Affected Resource(s)

  • postgresql_grant

Terraform Configuration Files

resource "postgresql_grant" "access" {
  provider    = postgresql.mydb
  database    = var.database
  object_type = "table"
  schema      = var.schema
  privileges  = ["SELECT", "INSERT", "UPDATE", "DELETE"]
  role        = var.role
}

And role is in the form [email protected] for google service accounts

Expected Behavior

Grants are already applied, it shouldn't try to recreate them.

Actual Behavior

Almost all the time, but not quite always, it wants to replace the grants:

-/+ resource "postgresql_grant" "access" {
      ~ id                = "[email protected]_something_something_table" -> (known after apply)
      ~ privileges        = [ # forces replacement
          + "DELETE",
          + "INSERT",
          + "SELECT",
          + "UPDATE",
        ]
        # (5 unchanged attributes hidden)
    }

Steps to Reproduce

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

  1. terraform plan

Important Factoids

Cloud SQL on Google with IAM auth.

When I try to inspect the state I get an error, even with the latest version of Terraform:

% terraform state show "postgresql_grant.access"
unsupported attribute "columns"
# postgresql_grant.access:
resource "postgresql_grant" "access" {

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions