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.

postgresql_grant does not revoke permission during resource deletion #196

@kamil-rogon-dragon

Description

@kamil-rogon-dragon

Hi there,

Terraform Version

Terraform v0.12.29
+ provider.postgresql v1.7.1

Affected Resource(s)

  • postgresql_grant

Terraform Configuration Files

resource "postgresql_database" "this" {
  name  = var.name
  owner = var.main_username
}

resource "postgresql_grant" "database_to_public" {
  object_type = "database"
  database    = postgresql_database.this.name
  role        = "public"
  privileges  = ["TEMPORARY"]
}
provider "postgresql" {
  host      = var.hostname
  username  = var.main_username
  password  = var.main_password
  database  = var.main_database
  sslmode   = "require"
  superuser = false
}

variable "hostname" {
  type = string
}

variable "main_username" {
  default = "postgres"
  type    = string
}

variable "main_password" {
  type = string
}

variable "main_database" {
  default = "postgres"
  type    = string
}

variable "name" {
  default = "name-1"
}

Actual Behavior

Commenting out postgresql_grant.database_to_public or destroying that with target should revoke permissions.

Expected Behavior

Refresh before the apply or destroy removes the resource from state and no revoke is performed (0 added, 0 changed, 0 destroyed).

Steps to Reproduce

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

  1. terraform apply
  2. terraform destroy --target postgresql_grant.database_to_public.
    • Alternatively comment out postgresql_grant.database_to_public resource and run terraform apply.

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