Automation and handling of exceptions - resources ...
# general
b
Automation and handling of exceptions - resources deleted when part of a program crashes Hi. We're creating resources in azure with the azure-native package and use java/groovy with the automation api. We're not sure if we're doing something wrong or if we misunderstand something.. Our issue is that if one part of the program crashes, e.g when getting the value of an output, rest of the program executes and end up deleting already created resource.
e
When the program crashes does it bubble an exception all the way up through the main line of the. program, or is this exception happening inside an apply or other async task?
b
It it happening inside an async task. We provoke it by changing our network to another network that is not allowed by the keyvault firewall. So what we have is: 1. the key vault uri which is an output we call applyValue on 2. Create a SecretClient inside applyValue 3. Fetch the secret 4. Return the secret as the Output
When we run directly via the cli the program crashes as expected and does not do anything more,.
so doing just throw new RuntimeException("foobar") before the resource calls does the same.
e
Wait so the program works when run standalone but doesn't work when called in automation api? Is that changing it to an inline program for automation api
b
We're using it as Local program in the automation api, e.g we have a pulumi.yaml-file and so on, calling it with LocalWorkspace. We're also passing
continueOnError(false)
e
So just so I'm getting things straight 1. When called as a standalone program with the CLI the applyValue throws and the program crashes 2. When called as a program from auto api the applyValue throws but the program carries on and deletes resources ?
b
It seems so. We'll try to create a simple example for reproduction.
e
That is odd, espeically as auto api is just defering to the CLI to run it
If you can get a repro can you raise an issue about this in the pulumi-java repo