0

In pulumi you can use the deleteBeforeReplace parameter to indicate that a resource should be deleted and recreated rather than updated in place. I need to make a change to a resource that requires it to be deleted and then recreated (updating whether an AzureServiceBus subscription requires a sessions). Ideally I would like any future changes that do not require the subscription to be deleted to be update it in place. Is there another option that would allow me to specify in which circumstances the resource is deleted and recreated and in which circumstances it is updated? Obviously I could change the pulumi code after every update but that seems inefficient. I was thinking of something like this:

deleteBeforeReplace: ["requiresSession"]

Current code:

new servicebus.Subscription(subscriptionName, {
  subscriptionName: subscriptionName,
  resourceGroupName: resourceGroupCommonName,
  namespaceName: serviceBusNamespaceName,
  topicName: topicName,
  maxDeliveryCount: 3,
  lockDuration: lockDuration,
  deadLetteringOnMessageExpiration: false,
  requiresSession: true, // This has been changed
}, { deleteBeforeReplace:true }); // This was added to enable the above change
SBFrancies
  • 3,987
  • 2
  • 14
  • 37
  • Have you considered using [`ReplaceOnChanges`](https://www.pulumi.com/docs/intro/concepts/resources/options/replaceonchanges/#replaceonchanges)? It can be used to indicate that changes to certain properties on a resource should force a replacement of the resource instead of an in-place update. – Michal Fudala Feb 10 '23 at 00:12
  • Thank you, that would seem to be exactly what I was looking for. – SBFrancies Feb 10 '23 at 06:07

0 Answers0