I'm trying to figure out a dependency issue and fe...
# general
b
I'm trying to figure out a dependency issue and feel like I'm missing the right resource option to use. We're creating an RDS database with Pulumi and also configuring users/schemas/permissions. Since the latter all live inside the database, they need to be recreated if the db gets recreated, ie they are implicitly deleted on a db instance deletion.
depends_on
forces the correct ordering but Pulumi doesn't know to recreate them.
replace_on_changes
would work except its only for properties on the same resource.
m
maybe you want
delete_before_replace=True
?
Are you working only with the RDS Instance resource, or other Pulumi Resources, e.g. https://www.pulumi.com/registry/packages/postgresql/api-docs/
b
https://www.pulumi.com/registry/packages/aws-native/api-docs/rds/dbinstance/ for the instance, and then yeah, that postgres package for configuring postgres itself. Provider that connects up to the ip grabbed from the dbinstance, and using
postgresql.Role
,
postgresql.Schema
,
postgresql.GrantRole
, etc. with that provider
Specifically what happens right now is that when there's a change to the DBInstance definition that forces the RDS instance to be recreated, that happens but Pulumi doesn't try to recreate the schemas because it doesn't know they got deleted
m
In that case, maybe you want to try delete before replace as well?
and is the parent / child relationship between the resources defined?
b
no, that I think is the thing that's missing
m
b
I have depends_on
but let me try that
ok, that maybe works, but I just broke something else that this all depends on 😅 so I need to go spend some time fixing that before I can fully test this. Let's hope it's working when I come back to it. Thanks for your help!
g
@brave-motorcycle-67487 There’s a property called ‘deletedWith’ that I think you are looking for. Though it does not appear to be covered in the documentation 🤔
b
I've confirmed that parent and depends_on do not fix this
deleted_with it appears did not work at all in the version of the python sdk I've been using 😬 https://github.com/pulumi/pulumi/commit/0b13f9169d6f3bb57195ae98bec04753abca1c62 so I'm upgrading and testing it
yeah, that doesn't work either - it still doesn't prompt recreation of the schemas
274 Views