cyrilgdn / terraform-provider-postgresql

Terraform PostgreSQL provider
https://www.terraform.io/docs/providers/postgresql/
Mozilla Public License 2.0
356 stars 181 forks source link

Dependency wait failed for postgresql_role #364

Open ricardoleal opened 8 months ago

ricardoleal commented 8 months ago

Hi there,

Thanks for the provider, i've having a issue when creating a lot of roles, the creation of the roles itself works great, but when comes to grant roles, provider can't create the role before try to grant it.

Terraform Version

 ~ terraform -v                 
Terraform v1.6.1
on darwin_arm64

Affected Resource(s)

Please list the resources as a list, for example:

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

https://drive.google.com/drive/folders/1LVOyg_kE9FuBjZCjg9Cd8Xd69kRAwW82?usp=sharing

Debug Output

terraform.log in the same share

Expected Behavior

It should calculate the dependency in order to create the roles before grant to another.

Actual Behavior

╷
│ Error: could not grant role grp_su_app_xpto4 to usr_sys_su_app_xpto4: pq: role "grp_su_app_xpto4" does not exist
│ 
│   with postgresql_role.role["usr_sys_su_app_xpto4"],
│   on roles.tf line 1, in resource "postgresql_role" "role":
│    1: resource "postgresql_role" "role" {
│ 
╵

Steps to Reproduce

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

  1. terraform apply

Important Factoids

Using AWS RDS PSQL 14

ricardoleal commented 8 months ago

Tested this scenario with : terraform apply -parallelism=1 and it worked, but in the project i'm creating with 59 roles, it just breaks.

I guess for now i'm going to split manually the resources to tackle the issue temporary.

Ricardo

Jibux commented 8 months ago

I have the exact same issue. Therefore, I have to split my resources unfortunately.