pulumi / pulumi-dotnet

.NET support for Pulumi
Apache License 2.0
23 stars 19 forks source link

Pulumi program hangs when resource transformation throws an exception #174

Closed Zaid-Ajaj closed 2 days ago

Zaid-Ajaj commented 11 months ago

What happened?

When using a ResourceTransformation as a stack option and that transform throws an exception, pulumi preview and pulumi up hang forever.

Expected Behavior

pulumi preview and pulumi up should not hang, instead, the transformation should catch errors and show them to users.

Steps to reproduce

The following C# Pulumi program demonstrates the problem:

using System.Threading.Tasks;
using Pulumi;
using Pulumi.Aws.S3;

class MyStack : Stack
{
    static StackOptions Options() => new StackOptions()
    {
        ResourceTransformations = { FailingTransform() } 
    };

    public MyStack() : base(Options())
    {
        var bucket = new Bucket("my-bucket");
    }

    static ResourceTransformation FailingTransform() 
    {
        return args => 
        {
            throw new System.Exception("Boom!");
            return null;
        };
    }
}

class Program
{
    static Task<int> Main() => Deployment.RunAsync<MyStack>();
}

Output of pulumi about

CLI          
Version      3.78.1
Go Version   go1.20.7
Go Compiler  gc

Plugins
NAME    VERSION
aws     6.0.2
dotnet  unknown

Host     
OS       darwin
Version  13.2.1
Arch     arm64

Additional context

No response

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).

darthkurak commented 1 month ago

Is there a chance to fix that?