few-telephone-23228
02/16/2025, 12:53 AMpulumi up is run, subsequent runs should not check again, and thus not try to alter the database, even if a snapshot has been create before the subsequent pulumi up is run.
Basically:
snapshot = find_latest_snapshot(filter=some_useful_filter)
if snapshot: # or maybe snapshot.id or similar
create_db_from_snapshot(snapshot)
else:
create_db_without_snapshot()
Would be nice if e.g. LatestSnapsshot was a resource, with the check for existing snapshot was done in the create method of a dynamic provider, but any way that works is fine. The problem with a resource for this is of course that I would get a pulumi.Output back, so I suspect I would have wrap it all in an Output.apply to get a useful value to check against.
I also need to do the same for an ebs volume snapshot, but if I can find a good pattern for the above, I*m sure I can use the same for the volume snapshot.
If this makes any kind of sense, and if anyone has any tips, I would be very happy.modern-zebra-45309
02/16/2025, 12:20 PMSnapshotIdentifier input can either be None or the string ID.
If I understand correctly, since https://github.com/hashicorp/terraform-provider-aws/pull/18013 (this is the upstream provider that pulumi-aws uses) you can remove the SnapshotIdentifier without triggering recreation of the RDS instance. (You just can't set it to a different snapshot ID.)
Hence, it might be easiest to do the snapshot ID lookup only if the RDS instance does not yet exist (e.g., check via aws.rds.getInstance or even outside of the Pulumi program), and otherwise set the snapshot ID to None.few-telephone-23228
02/17/2025, 9:56 AM