https://pulumi.com logo
#general
Title
# general
g

glamorous-flower-38169

08/23/2023, 6:26 PM
I'm trying to understand how to correctly use
deleteBeforeReplace
. I have an SSL certificate which is validated by a DNS record, and I have introduced a
pulumi.ComponentResource
as abstraction / indirection. This causes the identifier to change, which results in it being replaced – but DNS records are of course globally unique:
Copy code
* creating Route 53 Record: InvalidChangeBatch: [Tried to create resource record set [name='_188ff1aaf1299c19ad8ef397241447ab.staging.staging.zemn.me.', type='CNAME'] but it already exists]
    	status code: 400, request id: 57ec904c-b634-47b1-9165-01954fcd5305
I have
deleteBeforeReplace
set, but I am guessing that since the indirection has been introduced, pulumi doesn't realise that the old and new Records are related. What's the solution here? Change: https://github.com/Zemnmez/monorepo/pull/3635 Thomas
b

billowy-army-68599

08/23/2023, 7:04 PM
did you set deletebeforereplace and run a successful
up
before making any other changes?
you can’t just set it in code, it has to run and be set on the resource property before it’ll apply
g

glamorous-flower-38169

08/23/2023, 9:39 PM
I made a PR that landed first that sent in
deleteBeforeReplace
. What I have realised though is that pulumi doesn't know a replace is taking place due to the refactoring
I realised that I need to use an alias mapping to make Pulumi aware that these were once the same record in code
2 Views