is there a way to delete and create an existing qu...
# azure
g
is there a way to delete and create an existing queue in service bus?
c
If you are asking this question I am assuming the queue wasn't created via Pulumi? Or was it?
g
the queue is already in azure, i want to update or recreate it
and also i want to check if a queue is already in azure
i tried using Queue.Get, but it always throws an error if the queue does not exist i have a try catch, but it still fails saying that the error is unhandled
c
Yeah Queue.Get is assertive and you will not be able to catch the exception as the program exits early before you can catch it. Instead, use there should be a
GetQueueAsync
or a similar function in the same namespace as the ServiceBus. Those are known as lookup functions and will allow you to catch the exception.
g
thanks I will try this
c
If the queue is already there, do you want Pulumi to manage it? If so you can import it into your stack first so that Pulumi takes over the queue resource and you can modify it after that just like any other resource.
g
how is that done tho?
c
Search for docs about importing resources. There is also a CLI command that should help generate the code snippet you can use to import the resource.
g
got it. thank you
c
With that you should ensure that nothing else is trying to update the queue resource outside of Pulumi. Otherwise you'll see a diff in your Pulumi previews frequently.
g
got it. actually i was planning on just letting pulumi handle the service bus, without interactions from humans. aside from creating it
👍 1
i tried using this code, but in the preview it only shows delete
c
I didn't quite understand what you mean by that. Can you share the diff with me privately?
g
sure