pulumi / pulumi-dotnet

.NET support for Pulumi
Apache License 2.0
28 stars 25 forks source link

[automation] Implement Stack.ImportAsync() for batch importing resources into a stack #296

Closed Zaid-Ajaj closed 4 months ago

Zaid-Ajaj commented 4 months ago

Addressing https://github.com/pulumi/pulumi/issues/8237

Following a similar pattern to how I implemented the NodeJS API https://github.com/pulumi/pulumi/pull/16615

This PR extends the automation API to allow batch importing resources into a stack. An example of how this looks like:

var result = await stack.ImportAsync(new()
{
    Protect = false,
    Resources = new()
    {
        new()
        {
            Type = "random:index/randomPassword:RandomPassword",
            Name = "randomPassword",
            Id = "supersecret"
        }
    }
});

Also implements an enum converter for UpdateKind since JSON deserialization was failing when encountering update kind resource-import, this is now fixed.