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

postgres_grant privileges always being created at planning #188

@tcondeixa

Description

@tcondeixa

Hi, I'm having problems with postgres_grant always planning changes.

Terraform Version

0.12.26

Postgresql provider version

both 1.6.0. and 1.7.0

Postgres Database

both AWS RDS aurora 10.11 and RDS postgres 10.2

Affected Resource(s)

  • postgresql_grant

Terraform Configuration Files

I'm using terraform modules, so it could be difficult to understand. However I included in the Debug Ouput section an example of what is happening to me in the plan phase.

resource postgresql_grant "user" {
  for_each = var.create ? var.db_users : {}

  database    = var.db_name
  role        = each.key
  schema      = var.db_schema
  object_type = "table"
  privileges  = each.value["permissions"]

  depends_on = [postgresql_role.user]

}

Debug Output

  ~ resource "postgresql_grant" "user" {
        database          = "mydb"
        id                = "reader_mydb_public_table"
        object_type       = "table"
      ~ privileges        = [
          + "SELECT",
        ]
        role              = "reader"
        schema            = "public"
        with_grant_option = false
    }

Expected Behavior

No changes should appear to be applied every time I run terraform. I checked the DB and the privileges are there configured.

Actual Behavior

The priviledge list is always presented as new in terraform plan, so the postgresql_grant is always marked as a resource to be changed.

Steps to Reproduce

I just created a readonly user with postgresql_role, postgresql_grant and postgresql_default_privileges for public schema

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions