Search code examples
azurepulumiazure-sql-managed-instance

Pulumi stack update failed due to operation timed out error


I am trying to create Azure SQL Managed Instance using C# (Pulumi Azure Native). When executing pulumi up -s dev, getting operation timed out error as following:

enter image description here

(provisioning Managed Instance is a long running operation and in case of Pulumi, it is taking around 4 hours mentioned that when we create Managed Instance using Azure portal, it does not take that much time)

I tried multiple times and that error is happening exactly after 2 hours. Followings are the issues due to operation timed out error:

  • After 2 hours, Pulumi cli gave error: operation timed out, but I checked Azure portal & (after around 4 hours) Managed Instance was created successfully. I connected to Managed Instance using SSMS via public endpoint and restored AdventureWorks2019.bak successfully
  • Although Managed Instance was created successfully, Pulumi does not recognize that Managed Instance was provisioned. So executing pulumi preview -s dev or pulumi up -s dev gives "+ 1 to create" means Pulumi will try to cerate Managed Instance again (and will fail since Managed Instance already exists)

Why operation timed out error is occurring and how to solve it ?


Solution

  • Looks like 2 hours is a default timeout for this resource type. You can overwrite it with CustomTimeouts option like

    new ManagedInstance("managedinstance", new ManagedInstanceArgs
    {
        ..
    }, new CustomResourceOptions
    {
        CustomTimeouts = new CustomTimeouts
        {
            Create = TimeSpan.FromHours(4),
            Update = TimeSpan.FromHours(4),
        }
    });