-
Notifications
You must be signed in to change notification settings - Fork 212
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
postgresq_grant for schema not working when provider has no expected version #49
Comments
Hi, Thanks for opening this issue and sorry that I didn't answer before. Do you still have this issue? Did you find some leads? I can't see the link between expected version and the grant on schema 🤔 . Do you have Postgresql logs when this problem occurs? It's possible that the GRANT silently failed (for example if you don't have the permissions to change the schema privileges). |
Hello @cyrilgdn, thank you for your response. To be honest, I had forgotten this issue and I must have found a workaround. Looking at what I posted here, versus what I now have in my working configuration, perhaps I was originally missing the table-level permissions within the schema. It works if I also have the following permissions assigned: resource "postgresql_grant" "schema_crud" {
database = data.aws_rds_cluster.postgresql.database_name
role = postgresql_role.readwrite.name
schema = var.schema
object_type = "table"
privileges = ["SELECT", "INSERT", "UPDATE", "DELETE"]
} Thank you for following-up. If the change above is expected for the required behavior, or you don't feel there's much value is pursuing this further, I'm happy to close this issue. |
Hello, I am experiencing the certificate issue mentioned in this post. Could find any other open issues on this topic. @nadirsidi are you able to connect with this provider configuration now? I tried both awspostgres and just postgres. |
Hello @velkovb, it's been a while and I don't have access to the source code anymore because I've since changed jobs. I believe that was my provider config that worked. The trick was that I had to download that Amazon root certificate. The path listed here is a local file inside a docker container I was running in, where
I believe this is the correct documentation to get the root certificate for the provider trust store, https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/ssl-certificate-rotation-aurora-postgresql.html#ssl-certificate-rotation-aurora-postgresql.updating-trust-store |
@nadirsidi Thanks for getting back to me. I was not able to get the |
Very similar issue to #38, I figured I would provide some additional information since I'm not seeing the error response. Instead, my Terraform apply runs but then when I try to run queries with the user, I can see the user doesn't have the necessary schema rights.
Terraform Version
0.14.15
Affected Resource(s)
postgresql_grant
, specifically withobject_type ="schema"
Terraform Configuration Files
Expected Behavior
I would expect the
price_readwrite
role to haveCREATE
privileges on theprice
schema even if theexpected_version
is not set for the provider.Actual Behavior
The
price_readwrite
user does not have permission to create tables in theprice
schema, unless the Postgres version is specified in the provider config.I do have other
postgresql_grant
resources but they are to grant databaseCONNECT
and table CRUD privileges. TheCONNECT
on database seems to work fine. I can't say about the CRUD because it's dependent on the user have schema privileges to being with.Steps to Reproduce
price
schema,price_readwrite
role, and attempt to pass privileges to the role.Important Factoids
Output of
SELECT version()
=PostgreSQL 10.12 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.9.3, 64-bit
Running Terraform in a docker container using terraform binary from Docker image,
COPY --from=hashicorp/terraform:0.14.5 /bin/terraform /bin/terraform
Docker container is running in AWS CodeBuild in private subnet with network access to RDS, also in private subnet.
RDS is Aurora Serverless Postgres-- This seems to work great, even if it is scaled down to 0 it comes back up and allows the provider connection fast enough for Terraform to do its thing.
Helpful query to check schema rights:
awspostgres
connection scheme because the Go Cloud seemed to be downloading the certificate itself, and it kept giving me a x509 error. I found I was only able to connect with the provider configuration above. Upon investigation, this might be a Go 1.15+ thing and how AWS chooses to make their certs, or it looks like Go Cloud is looking at old *.pem files. I am not support confident about this, but I can open a separate issue if you'd like.References
Thank you for your great work!
The text was updated successfully, but these errors were encountered: