-
Notifications
You must be signed in to change notification settings - Fork 216
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
Granting / revoking privileges on tables through "objects" is not atomic #208
Comments
Hello. Are there any updates on this topic? We also ran into this issue... |
This seems like a rather big issue to be occuring. i have a couple ideas on work arounds , but this is the type of logic id expect the plugin to handle |
is one work around, in which you isolate all grants to their own resource. |
@cyrilgdn is there any reason why objects needs to we already revoke and then grant but in the same transactions, so no downtime. So deleting the resource first seems redundant? I can throw up a PR to remove this so it can be updated in place |
Has there been any update on this? |
Hi there,
Thank you for opening an issue. Please provide the following information:
Terraform Version
Terraform v1.1.9
on darwin_amd64
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
When changing the
objects
from["table-one"]
to["table-one", "table-two"]
, the permissions should be revoked / granted atomatically, so that existing systems querying the database don't temporarily see errors.Actual Behavior
Because of the way
objects
was implemented in #105 (specifically, theForceNew
schema flag), Terraform forces the plan to destroy and recreate the grant which does not happen within the same postgres transaction. Therefore, postgres roles using the "SELECT" permission on "table-one" temporarily see errors for a little while when Terraform has deleted but not yet recreated the permission grants.Steps to Reproduce
select count(*) from "table-one";
objects = ["table-one"]
line toobjects = ["table-one", "table-two"]
and apply the changes through terraformQuestion
Are there any smart workarounds for this? For testing and dev purposes, this behaviour is OK, but for production systems that are running hundreds of queries per second through a role managed with this provider, seeing errors for about a second is something I would definitely like to avoid. Thank you!
The text was updated successfully, but these errors were encountered: