pulumi-azure-native
pulumi-azure-native copied to clipboard
Auto-purge CognitiveServices accounts on delete
What happened?
Azure has made an absolutely stupid api.
If you create a cognitive services multi-service account (By specifying kind = "CognitiveServices") using pulumi. Delete it using pulumi and then try to create again you will be told you cannot create it because it has only been soft deleted.
Expected Behavior
I expect the resource to be completely and absolutely gone so I can reuse the name.
Steps to reproduce
var account = new Account("account", new()
{
ResourceGroupName = args.ResourceGroup,
Location = args.Location,
Identity = new IdentityArgs()
{
Type = ResourceIdentityType.None,
},
Kind = "CognitiveServices", // Enable all cognitive services
AccountName = accountName,
Sku = new SkuArgs()
{
Name = "S0"
},
Properties = new AccountPropertiesArgs()
{
PublicNetworkAccess = PublicNetworkAccess.Enabled,
CustomSubDomainName = accountName,
NetworkAcls = new NetworkRuleSetArgs()
{
DefaultAction = NetworkRuleAction.Deny,
VirtualNetworkRules = new VirtualNetworkRuleArgs()
{
Id = args.DigizuiteCoreSubnetId,
IgnoreMissingVnetServiceEndpoint = false,
}
},
},
Tags = args.Tags,
}, opts);
Run pulumi up, down and up on that.
Output of pulumi about
This is a pulumi automation project, so not quite possible.
Additional context
This is not pulumi that is in the wrong here.
Azure is doing something absolutely absurdly horrifyingly immensely stupid here. To actually clean up the account completely, you have to call the "purge" API here: https://learn.microsoft.com/en-us/rest/api/cognitiveservices/accountmanagement/deleted-accounts/purge?tabs=HTTP after you have called delete on the resource. And then you have to await the operation, which they have not documented how to do....
I have not encountered any other resource with this behavior so far.
Contributing
Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).