https://pulumi.com logo
Title
w

white-rain-67342

12/06/2022, 9:45 PM
Hello everyone. I am seeing that whenever I deploy a new version of my infrastructure, it replaces my RDS replica -despite no changes happening to my RDS definition. I see the following when I run my
pulumi up
command:
+-     └─ aws:rds:Instance                              dev-db-rds-replica                  replace     [diff: -storageEncrypted~replicateSourceDb]
Has anyone seen this before? It is quite frustrating?
l

little-cartoon-10569

12/06/2022, 9:48 PM
Did you previously change the instance via the console, then run
pulumi refresh
?
This doesn't happen unless Pulumi detects a difference between the code and the state. If you haven't changed the code, then state must have changed.
w

white-rain-67342

12/06/2022, 9:49 PM
I have not changed anything through the console
l

little-cartoon-10569

12/06/2022, 9:50 PM
What are the changing values (view details)?
And how are you setting the replicateSourceDb? Is the value constant?
w

white-rain-67342

12/06/2022, 9:50 PM
replicateSourceDb: this.db.arn,
l

little-cartoon-10569

12/06/2022, 9:51 PM
Where
this.db
is a different instance, presumably?
w

white-rain-67342

12/06/2022, 9:51 PM
that is correct - but the instance is not changing
Do you want to perform this update? details
  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:dev::kable-infrastructure::pulumi:pulumi:Stack::kable-infrastructure-dev]
        > aws:ec2/vpc:Vpc: (read)
            [id=vpc-00cfcc90ebcb40c37]
            [urn=urn:pulumi:dev::kable-infrastructure::infrastructure:fargate$aws:ec2/vpc:Vpc::kable-app-cluster-service-vpc]
            [provider=urn:pulumi:dev::kable-infrastructure::pulumi:providers:aws::default_5_18_0::756ee237-668a-4a77-a769-0200bcbf0e4c]
        ++aws:rds/instance:Instance: (create-replacement)
            [id=dev-kable-db-rds-replica64d5a22]
            [urn=urn:pulumi:dev::kable-infrastructure::custom:resource:DB$aws:rds/instance:Instance::dev-kable-db-rds-replica]
            [provider=urn:pulumi:dev::kable-infrastructure::pulumi:providers:aws::default_5_18_0::756ee237-668a-4a77-a769-0200bcbf0e4c]
          ~ replicateSourceDb: "dev-kable-db-rds6311b5b" => "arn:aws:rds:us-east-1:370114867760:db:dev-kable-db-rds6311b5b"
          - storageEncrypted : true
        +-aws:rds/instance:Instance: (replace)
            [id=dev-kable-db-rds-replica64d5a22]
            [urn=urn:pulumi:dev::kable-infrastructure::custom:resource:DB$aws:rds/instance:Instance::dev-kable-db-rds-replica]
            [provider=urn:pulumi:dev::kable-infrastructure::pulumi:providers:aws::default_5_18_0::756ee237-668a-4a77-a769-0200bcbf0e4c]
          ~ replicateSourceDb: "dev-kable-db-rds6311b5b" => "arn:aws:rds:us-east-1:370114867760:db:dev-kable-db-rds6311b5b"
          - storageEncrypted : true
        --aws:rds/instance:Instance: (delete-replaced)
            [id=dev-kable-db-rds-replica64d5a22]
            [urn=urn:pulumi:dev::kable-infrastructure::custom:resource:DB$aws:rds/instance:Instance::dev-kable-db-rds-replica]
            [provider=urn:pulumi:dev::kable-infrastructure::pulumi:providers:aws::default_5_18_0::756ee237-668a-4a77-a769-0200bcbf0e4c]
This is the describe of the instance
l

little-cartoon-10569

12/06/2022, 9:52 PM
Are you building anything inside an
apply()
? I'd say that there is actually no changed, but Pulumi can't be definite about this, so it's pessimistically warning you of a potential change.
There's your problem:
replicateSourceDb: "dev-kable-db-rds6311b5b" => "arn:aws:rds:us-east-1:370114867760:db:dev-kable-db-rds6311b5b"
That's a real change.
You had the ID, and you're now correctly setting it to the ARN.
w

white-rain-67342

12/06/2022, 9:55 PM
Oh interesting. Nothing in my code is changing but it looks like the state pulumi is checking against is
l

little-cartoon-10569

12/06/2022, 9:55 PM
So you can fix this by changing your code to match.
identifier is valid if you're replicating a single instance.
You use ARN if you're replicating a multi-AZ instance, I think?
w

white-rain-67342

12/06/2022, 9:55 PM
It is a single az instance
l

little-cartoon-10569

12/06/2022, 9:56 PM
And perhaps RDS is changing the value behind the scenes.
Change
this.db.arn
to
this.db.identifier
and it should work.
w

white-rain-67342

12/06/2022, 9:56 PM
I think I am telling pulumi to replicate the arn, it is somehow storing the id, so then when I say store the arn, it recreates it every time. Thanks for the help!