What are the available interfaces for being able t...
# python
a
What are the available interfaces for being able to access the current state of a resource in the execution loop of the Pulumi program? I'm trying to add logic to a coponent resource for RDS that manages read replicas, so that I can let it apply minor version upgrades to the replica before the primary, dependent on whether the engine version specified is greater than the one currently deployed.
a
Hard to say without more context about your project/stack setup but I would think either determine the version based of the master instance outputs or use the get_instance function. Or determine the replica engine version by applying on the master output for it to work in cases where you don't have any master instance deployet yet - something like.. (not tested btw..)
Copy code
def determine_replica_engine_version(current: str) -> str:
    if current == "16.1":
        return "16.3"
    return current

replica_version: pulumi.Output[str] = rds_master.engine_version.apply(
    func=lambda version: determine_replica_engine_version(version)
)
a