Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a grant to an x role is trying to add a role to the postgres role #492

Open
kodless opened this issue Dec 4, 2024 · 0 comments
Open

Comments

@kodless
Copy link

kodless commented Dec 4, 2024

Terraform Version

1.9.6

Provider Version

1.24.0

Affected Resource(s)

  • postgresql_grant

Terraform Configuration Files

provider "postgresql" {
  alias     = "qa-authz"
  host      = "rds.endpoint"
  username  = "postgres"
  password  = "redacted"
  database  = "postgres"
  sslmode   = "require"
  superuser = false
  port      = 5432
}

resource "postgresql_role" "role" {
  password                  = "REDACTED"
  name                      = "debezium"
  skip_reassign_owned       = false
  login                     = true
  roles                     = [ "rds_replication", "readonly_role" ]
  bypass_row_level_security = true
  create_database           = false
  replication               = false
  statement_timeout         = null
}

resource "postgresql_grant" "grant" {
  role              = postgresql_role.role.name
  database          = "authorizer"
  schema            = "kafka"
  object_type       = "table"
  privileges        = [ "INSERT", "SELECT", "UPDATE", "DELETE", "TRUNCATE", "REFERENCES", "TRIGGER" ]
  objects           = [ "debezium_snapshot_signals" ]
  with_grant_option = false
}

Debug Output

https://gist.github.com/kodless/f1f3da77b81e95f5a73b94b6373bcf31

Expected Behavior

Add a new grant for debezium role.

Actual Behavior

The provider is trying to grant the role authorizer_migrate to postgres role which is confusing.

2024-12-02 17:18:21 UTC:10.141.121.97(48032):postgres@authorizer:[8008]:STATEMENT:  GRANT "authorizer_migrate" TO "postgres"
2024-12-02 17:18:21 UTC:10.141.121.97(48032):postgres@authorizer:[8008]:ERROR:  role "authorizer_migrate" is a member of role "postgres"

Steps to Reproduce

  1. terraform apply

Important Factoids

Running on Terraform Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant