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

postgresql_grant does not revoke permission during resource deletion #196

Open
kamil-rogon-dragon opened this issue Oct 28, 2020 · 0 comments

Comments

@kamil-rogon-dragon
Copy link

kamil-rogon-dragon commented Oct 28, 2020

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.
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