Skip to content

Commit f6f1c09

Browse files
committed
fix: azure windows remove extension from destroy graph to avoid stuck destroy operations when instance is stopped. Fix #208
Signed-off-by: Adrian Riobo Lorenzo <[email protected]>
1 parent 284a0a3 commit f6f1c09

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pkg/provider/azure/action/windows/windows.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,10 @@ func (r *WindowsRequest) postInitSetup(ctx *pulumi.Context, rg *resources.Resour
333333
authorizedKey,
334334
)
335335
}).(pulumi.StringOutput)
336-
// the post script will be executed as a extension
336+
// the post script will be executed as a extension,
337+
// this resource is retain on delete b/c it does not create a real resource on the provider
338+
// and also if vm where it has been executed is stopped (i.e. deallocated spot instance) it can
339+
// not be deleted leading to break all destroy operation on the resources.
337340
vme, err := compute.NewVirtualMachineExtension(
338341
ctx,
339342
resourcesUtil.GetResourceName(r.Prefix, azureWindowsDesktopID, "ext"),
@@ -351,7 +354,8 @@ func (r *WindowsRequest) postInitSetup(ctx *pulumi.Context, rg *resources.Resour
351354
"commandToExecute": setupCommand,
352355
},
353356
Tags: qenvsContext.ResourceTags(),
354-
})
357+
},
358+
pulumi.RetainOnDelete(true))
355359
return privateKey, vme, err
356360
}
357361

0 commit comments

Comments
 (0)