https://pulumi.com logo
Docs
Join the conversationJoin Slack
Channels
announcements
automation-api
aws
azure
blog-posts
built-with-pulumi
cloudengineering
cloudengineering-support
content-share
contribex
contribute
docs
dotnet
finops
general
getting-started
gitlab
golang
google-cloud
hackathon-03-19-2020
hacktoberfest
install
java
jobs
kubernetes
learn-pulumi-events
linen
localstack
multi-language-hackathon
office-hours
oracle-cloud-infrastructure
plugin-framework
pulumi-cdk
pulumi-crosscode
pulumi-deployments
pulumi-kubernetes-operator
pulumi-service
pulumiverse
python
registry
status
testingtesting123
testingtesting321
typescript
welcome
workshops
yaml
Powered by Linen
dotnet
  • e

    enough-garden-22763

    05/21/2021, 10:47 PM
    Given
    Output<A>, Output<B>, Func<A,B,C>
    and wanting to get
    Output<C>
    is the least verbose option
    Output.Tuple(a,b).Apply(x => func(x.Item1, x.Item2)
    and specifically are there reflection or codegen helpers I’m missing to generalize this on records to convert between records where properties are typed T1,..TN and records where properties are typed
    In/Output<T1>..In/Output<TN>
    ? Working on some codegen helpers here and my current attempt looks like this: https://gist.github.com/t0yv0/a9139fd04f28a5d4e8f1cf20909023ae#file-codegen-cs-L21
    w
    t
    • 3
    • 17
  • s

    salmon-egg-38815

    05/24/2021, 5:09 PM
    Wondered if this might get more traction in here, since it's a dotnetty question
    b
    t
    • 3
    • 10
  • e

    enough-garden-22763

    05/25/2021, 4:11 PM
    Good morning, I wonder what are the conversion paths between
    Task
    and
    Task<T>
    , and correspondingly do we want to model something similar to value-less
    Task
    in the
    Output<T>
    layer? I am going for
    Output<Object>
    carrying a
    null
    to correspond to “value-less” task. I really like how F# does it with
    unit
    type but that seems to not to be in .NET stdlib.
    b
    • 2
    • 31
  • b

    bumpy-motorcycle-53357

    05/25/2021, 4:42 PM
    I'm using Pulumi to deploy a helm chart, which accepts Affinity as a Value. I need to start using that to control where the pods are deployed, but I can't figure out how to configure it using the ChartArgs.Values property. Are there any examples out there for this?
    w
    • 2
    • 9
  • w

    worried-city-86458

    05/27/2021, 11:49 PM
    Say I really want to
    await
    an
    Output<T>
    rather than use
    Output<T>.Apply
    , how should I do that? Any examples?
    b
    t
    • 3
    • 55
  • b

    boundless-monkey-2042

    06/02/2021, 8:20 PM
    Is it possible to cast the result of a LINQ Enumerable.Select 'System.Collections.Generic.IEnumerable<System.Collections.Generic.IEnumerable<Pulumi.AzureNative.Network.Inputs.SecurityRuleArgs>>' to 'Pulumi.InputList<Pulumi.AzureNative.Network.Inputs.SecurityRuleArgs>' ? All the values come from directly from a Pulumi.dev.yaml none are Outputs
    t
    w
    • 3
    • 11
  • m

    mysterious-australia-14256

    06/09/2021, 11:20 AM
    In the old Azure API we could pull back the current Azure Subscription ID using Pulumi.Azure.Core.GetSubscription.InvokeAsync().Result.SubscriptionId. Is there an equivalent in the Azure-Native API?
    t
    • 2
    • 1
  • m

    mysterious-australia-14256

    06/09/2021, 12:10 PM
    I'm having a bit of a struggle with the new AzureNative API and am presumably missing something obvious. I have created a new netcoreapp3.1 project and pasted the ServiceBus C# code from the Pulumi docs into the MyStack.cs file. I am presented with 2 errors, on the lines trying to set the Sku Name and Tier
    Sku = new AzureNative.ServiceBus.Inputs.SBSkuArgs
                {
                    Name =  "Standard",
                    Tier = "Standard",
                },
    The error I get is of the type Cannot implicitly convert type 'string' to 'Pulumi.Input<Pulumi.AzureNative.ServiceBus.SkuName>' Can someone let me know what I am missing? Thanks Alan
    t
    • 2
    • 7
  • w

    worried-city-86458

    06/14/2021, 12:51 AM
    I'm struggling to work out how to pass an output as a helm chart value for external dns...
    t
    • 2
    • 16
  • p

    powerful-football-81694

    06/14/2021, 7:44 PM
    Hi folks! What’s the right way to programmatically get an output value out of a stack from C#, outside the context of Pulumi? I mean, basically what’s the C# equivalent of doing:
    pulumi stack output SomeOutput --stack DaRosenberg/OrgFlow/stackName
    I’ve tried referencing the
    Pulumi
    package and using a
    StackReference.GetValueAsync()
    call, but that only gives me:
    System.InvalidOperationException : Trying to acquire Deployment.Instance before 'Run' was called.
    What’s the right way? Do I need to use the Automation API for things like this?
    b
    b
    • 3
    • 10
  • c

    colossal-vr-62639

    06/23/2021, 5:51 AM
    Hey everyone! What is the canonical way in pulumi to store an array of items and read it as outputs? For example storing a list of subnets...
    return new Dictionary<string, object?>()
        {
            {
                "subnets-public",
                new[] {componentOne.PublicSubnet0.Apply(x => x.Id), componentOne.PublicSubnet1.Apply(x => x.Id)}
            },
        };
    and then in some other project, read the outputs from the stack...
    var subnets = stack.GetOutput("subnets-public")
    b
    • 2
    • 2
  • f

    fast-cpu-35756

    06/24/2021, 5:23 PM
    Hi Team, Anyone could have a clue why I’m facing this error ? looks like something internal is not right while creating
    ScheduledAction
    in AWS:
    var scheduledScaleOutAction = new ScheduledAction($"{name}-scheduled-scale-out", new ScheduledActionArgs
                    {
                        Schedule = "cron(0 00 23 ? * * *)",
                        ServiceNamespace = appScaleTarget.ServiceNamespace,
                        ScalableDimension = appScaleTarget.ScalableDimension,
                        ResourceId = appScaleTarget.ResourceId,
                        ScalableTargetAction = new ScheduledActionScalableTargetActionArgs
                        {
                            MinCapacity = 3,
                            MaxCapacity = 9,
                        },
                    });
    I’m getting the following error:
    Diagnostics:
      pulumi:pulumi:Stack (IdP-Production):
        error: Running program '/Users/alibazzi/Documents/GitHub/*******.IaC.dll' failed with an unhandled exception:
        System.InvalidOperationException: Expected System.Double but got System.String deserializing Pulumi.Aws.AppAutoScaling.Outputs.ScheduledActionScalableTargetAction(maxCapacity)
           at Pulumi.Serialization.Converter.ConvertObject(String context, Object val, Type targetType)
           at Pulumi.Serialization.Converter.ConvertValue(String context, Value value, Type targetType, ImmutableHashSet`1 resources)
           at Pulumi.Deployment.CompleteResourceAsync(Resource resource, Boolean remote, Func`2 newDependency, ResourceArgs args, ResourceOptions options, ImmutableDictionary`2 completionSources)
           at Pulumi.Deployment.Runner.<>c__DisplayClass9_0.<<WhileRunningAsync>g__HandleCompletion|0>d.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at Pulumi.Deployment.Runner.WhileRunningAsync()
    t
    • 2
    • 2
  • m

    mysterious-australia-14256

    06/25/2021, 2:20 PM
    Is it possible to deserialize from a config file into a model that had a property of type Pulumi.Input<string>? I have a yaml file with a config I am trying to deserialize it into a custom object model that has a parameter of type Pulumi.Input<string>. The code I have is along the lines of
    Pulumi.Config config = new Pulumi.Config();
    var mySettings = config.RequireObject<MyModel>("Key");
    MyModel contains several properties and I've recently tried to add a new one with a type of Pulumi.Input<string>?. Since adding that if I try to run the code I get an error saying The JSON value could not be converted to Pulumi.Input`1[System.String] Is this possible at all?
    b
    b
    • 3
    • 7
  • m

    mysterious-australia-14256

    06/25/2021, 4:02 PM
    Is there a way to retrieve an Azure resource from its ID e.g. in the format /subscriptions/<sub number>/resourceGroups/<group name>/providers/Microsoft.Logic/integrationAccounts/<account name> I have found resources.getResource and a more specific one for a particular resource type e.g. logic.getIntegrationAccount but both of those would require some parsing to pull out things such as the resource group name etc.
    t
    • 2
    • 3
  • b

    boundless-monkey-2042

    06/25/2021, 5:28 PM
    Having trouble aligning types for GetVirtualNetwork using values from a stackReference. There must be an easier way? var network = Pulumi.AzureNative.Network.GetVirtualNetwork.InvokeAsync(             new Pulumi.AzureNative.Network.GetVirtualNetworkArgs             {                 // ResourceGroupName =  (string)await spokeStack.RequireValueAsync("SpokeResourceGroupName"),                 ResourceGroupName = spokeStack.RequireOutput("SpokeResourceGroupName").Apply(value => value.ToString()),                 // VirtualNetworkName = (string)await spokeStack.RequireValueAsync("SpokeVnetName"),                 VirtualNetworkName = spokeStack.RequireOutput("SpokeVnetName").Apply(value => value.ToString()),             }         );
    t
    • 2
    • 2
  • e

    enough-butcher-66045

    06/30/2021, 10:13 AM
    hey peeps, I need some help here, I'm trying to convert a
    pulumi import
    output into C# This is what pulumi gives me...
    var slack_webhook = new AzureNative.Web.WebAppFunction("slack-webhook", new AzureNative.Web.WebAppFunctionArgs
            {
                Config =
                {
                    { "bindings",
                    {
    
                        {
                            { "authLevel", "function" },
                            { "direction", "in" },
                            { "methods",
                            {
                                "get",
                                "post",
                            } },
                            { "name", "req" },
                            { "type", "httpTrigger" },
                        },
    
                        {
                            { "direction", "out" },
                            { "name", "res" },
                            { "type", "http" },
                        },
                    } },
                },
    This is what I've mapped the Config to:
    Config = new {
                        Bindings = new object[]
                        {
                            new
                            {
                                AuthLevel = "function",
                                Direction = "in",
                                Name = "req",
                                Type = "httpTrigger"
                            },
                            new
                            {
                                Direction = "out",
                                Name = "res",
                                Type = "http"
                            }
                        }
                    },
    I have no syntax errors in the IDE, but when I try running it I get:
    System.InvalidOperationException: <>f__AnonymousType0`1[[System.Object[], System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=asdasd]] is not a supported argument type.
            resource:slack-webhook[azure-native:web:WebAppFunction].config.id
           at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop, Boolean keepResources)
           at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop, Boolean keepResources)
           at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop, Boolean keepResources)
           at Pulumi.Deployment.SerializeFilteredPropertiesAsync(String label, IDictionary`2 args, Predicate`1 acceptKey, Boolean keepResources)
           at Pulumi.Deployment.PrepareResourceAsync(String label, Resource res, Boolean custom, Boolean remote, ResourceArgs args, ResourceOptions options)
           at Pulumi.Deployment.RegisterResourceAsync(Resource resource, Boolean remote, Func`2 newDependency, ResourceArgs args, ResourceOptions options)
           at Pulumi.Deployment.ReadOrRegisterResourceAsync(Resource resource, Boolean remote, Func`2 newDependency, ResourceArgs args, ResourceOptions options)
           at Pulumi.Deployment.CompleteResourceAsync(Resource resource, Boolean remote, Func`2 newDependency, ResourceArgs args, ResourceOptions options, ImmutableDictionary`2 completionSources)
           at Pulumi.Deployment.Runner.<>c__DisplayClass9_0.<<WhileRunningAsync>g__HandleCompletion|0>d.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
           at Pulumi.Deployment.Runner.WhileRunningAsync()
    I'm wondering what should I use instead? This is what the WebAppFunctionArgs type hint looks like (this is for azure native) Thanks
  • e

    enough-butcher-66045

    06/30/2021, 10:37 AM
    I've updated it to use a dictionary instead of a plain object and now I get:
    error: Code="BadRequest" Message="Encountered an error (InternalServerError) from host runtime." Details=[{"Message":"Encountered an error (InternalServerError) from host runtime."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"
    BadRequest","Message":"Encountered an error (InternalServerError) from host runtime."}}]
  • e

    enough-butcher-66045

    06/30/2021, 10:37 AM
    Config = new Dictionary<string, Dictionary<string, string>[]>
                    {
                        {
                            "Bindings", new[]
                            {
                                new Dictionary<string, string>
                                {
                                    {"AuthLevel", "function"},
                                    {"Direction", "in"},
                                    {"Name", "req"},
                                    {"Type", "httpTrigger"},
                                },
                                new Dictionary<string, string>
                                {
                                    {"Direction", "out"},
                                    {"Name", "res"},
                                    {"Type", "http"}
                                }
                            }
                        },
                    },
    that's how the config looks
  • e

    enough-butcher-66045

    06/30/2021, 10:44 AM
    ok, I could solve it (the error is still very unhelpful), the problem was capitalisation on the dictionary keys, here's the correct one:
    Config = new Dictionary<string, Dictionary<string, string>[]>
                    {
                        {
                            "bindings", new[]
                            {
                                new Dictionary<string, string>
                                {
                                    {"authLevel", "function"},
                                    {"direction", "in"},
                                    {"name", "req"},
                                    {"type", "httpTrigger"},
                                },
                                new Dictionary<string, string>
                                {
                                    {"direction", "out"},
                                    {"name", "res"},
                                    {"type", "http"}
                                }
                            }
                        },
                    },
  • w

    worried-city-86458

    07/01/2021, 8:56 PM
    I've been hitting a few issues lately that look like race conditions as they come and go...
    t
    e
    • 3
    • 8
  • b

    boundless-monkey-2042

    07/02/2021, 5:58 AM
    Is it possible to get an ImmutableDictionary<string, string> from a StackReference? If so how? I output Subnets as an ImmutableDictionary<string, string> and I want to read the Subnet.Id value based on key-name (dev, test, prod). StackRef.RequireOutput returns Output<object> not Output<T>.
    {
      "dev": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/spoke-dev-rg-00000/providers/Microsoft.Network/virtualNetworks/spoke-dev-vnet-00000000/subnets/development"
    }
  • b

    breezy-salesmen-85534

    07/02/2021, 1:30 PM
    i came across https://www.pulumi.com/docs/reference/pkg/azure-native/storage/storageaccount/ as an example for creating storage account network rule sets. Unfortunately the virtual network does not exist when I create the storage account. Can I update a storage account , from a different stack, with a new network rule after the vnet and storage account are created?
    t
    • 2
    • 4
  • n

    nice-scientist-89715

    07/06/2021, 4:19 PM
    Running into an issue with an ECS task definition
    * ClientException: Environment variable name cannot be null or blank.
    Seems to stem from the ContainerDefinitions https://gist.github.com/urothis/197e866016a47d7f9db8e03596d2ef5b Probably related to doing
    {"environment", new[] { new Dictionary<string, object> {
                                        {"PG_ENDPOINT", "potato"},
                                        {"PG_READ_ENDPOINT", "banana"},
                                        {"ASPNETCORE_URLS", "test"}
                                    }}
                                },
    Improperly.
    b
    • 2
    • 17
  • c

    colossal-vr-62639

    07/08/2021, 6:33 AM
    Hey everyone! Using an API Gateway, i'm missing a
    Path
    property of sorts (e.g. https://www.pulumi.com/docs/reference/pkg/aws/apigatewayv2/apimapping/) whereby I can configure/specify the path as illustrated in the AWS Console for API Mappings...
    b
    • 2
    • 1
  • s

    sticky-jordan-27156

    07/17/2021, 12:39 PM
    Hi, I'm trying to deploy to azure using github actions.
    Run pulumi/actions@v3
      with:
        command: up
        stack-name: main
        work-dir: ./infrastructure
        comment-on-pr: false
        github-token: ***
        parallel: 2147483647
        target-dependents: false
        refresh: false
        upsert: false
        edit-pr-comment: true
      env:
        DOTNET_ROOT: /home/runner/.dotnet
        ARM_SUBSCRIPTION_ID: ***
        ARM_CLIENT_ID: ***
        ARM_CLIENT_SECRET: ***
        ARM_TENANT_ID: ***
        PULUMI_ACCESS_TOKEN: ***
    Configured range: ^3
    Matched version: v3.7.0
    Install destination is /home/runner/.pulumi
    Successfully deleted pre-existing /home/runner/.pulumi/bin
    /usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/.pulumi -f /home/runner/work/_temp/b8f38ed6-cbc6-46f5-91a3-80f973240b88
    pulumi up on main
      Updating (main)
      
      
      View Live: <https://app.pulumi.com/nojaf/fantomas-tools/main/updates/782>
      
      
          pulumi:pulumi:Stack fantomas-tools-main  running 'dotnet build -nologo .'
      
          pulumi:pulumi:Stack fantomas-tools-main    Determining projects to restore...
      
          pulumi:pulumi:Stack fantomas-tools-main  /home/runner/.dotnet/sdk/5.0.202/NuGet.targets(131,5): error : Access to the path '/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/obj/1923872f-f258-4991-ba9e-d6d99ee380f4.tmp' is denied. [/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/infrastructure.fsproj]
      
          pulumi:pulumi:Stack fantomas-tools-main  
      
          pulumi:pulumi:Stack fantomas-tools-main  
      
          pulumi:pulumi:Stack fantomas-tools-main    Determining projects to restore...
          pulumi:pulumi:Stack fantomas-tools-main  /home/runner/.dotnet/sdk/5.0.202/NuGet.targets(131,5): error : Access to the path '/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/obj/1923872f-f258-4991-ba9e-d6d99ee380f4.tmp' is denied. [/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/infrastructure.fsproj]
          pulumi:pulumi:Stack fantomas-tools-main  /home/runner/.dotnet/sdk/5.0.202/NuGet.targets(131,5): error :   Permission denied [/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/infrastructure.fsproj]
          pulumi:pulumi:Stack fantomas-tools-main  Build FAILED.
          pulumi:pulumi:Stack fantomas-tools-main  /home/runner/.dotnet/sdk/5.0.202/NuGet.targets(131,5): error : Access to the path '/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/obj/1923872f-f258-4991-ba9e-d6d99ee380f4.tmp' is denied. [/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/infrastructure.fsproj]
          pulumi:pulumi:Stack fantomas-tools-main  /home/runner/.dotnet/sdk/5.0.202/NuGet.targets(131,5): error :   Permission denied [/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/infrastructure.fsproj]
          pulumi:pulumi:Stack fantomas-tools-main      0 Warning(s)
          pulumi:pulumi:Stack fantomas-tools-main      1 Error(s)
          pulumi:pulumi:Stack fantomas-tools-main  Time Elapsed 00:00:06.55
      
          pulumi:pulumi:Stack fantomas-tools-main  9 messages
       
      Diagnostics:
        pulumi:pulumi:Stack (fantomas-tools-main):
            Determining projects to restore...
          /home/runner/.dotnet/sdk/5.0.202/NuGet.targets(131,5): error : Access to the path '/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/obj/1923872f-f258-4991-ba9e-d6d99ee380f4.tmp' is denied. [/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/infrastructure.fsproj]
          /home/runner/.dotnet/sdk/5.0.202/NuGet.targets(131,5): error :   Permission denied [/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/infrastructure.fsproj]
          Build FAILED.
          /home/runner/.dotnet/sdk/5.0.202/NuGet.targets(131,5): error : Access to the path '/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/obj/1923872f-f258-4991-ba9e-d6d99ee380f4.tmp' is denied. [/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/infrastructure.fsproj]
          /home/runner/.dotnet/sdk/5.0.202/NuGet.targets(131,5): error :   Permission denied [/home/runner/work/fantomas-tools/fantomas-tools/infrastructure/infrastructure.fsproj]
              0 Warning(s)
              1 Error(s)
          Time Elapsed 00:00:06.55
       
      
      Error: code: 255
    I'm getting file access errors, any ideas if I missed a setting somewhere? I'm very puzzled why this suddenly is a problem. Full link: https://github.com/fsprojects/fantomas-tools/runs/3092987675?check_suite_focus=true Is anyone doing something similar by any chance?
  • s

    sticky-jordan-27156

    07/18/2021, 11:23 AM
    Still not a hundred percent sure, but I start using a docker build instead of a docker run with a mounted volume and the file locks disappeared. Me problem is resolved now but I'm pretty sure something is up in the pulumi github action.
  • m

    mammoth-toothbrush-9728

    07/19/2021, 7:09 AM
    Hello, I started using the AzureNative package, and I've encountered an issue. I create a
    StorageAccount
    object, and wish to pass its connection string on to my web app, but as opposed to the older Azure package, theres no
    PrimaryConnectionString
    property in the
    StorageAccount
    object anymore. I also couldn't see the Keys for the storage account in order to create the connection string manually. Can anyone guide me ?
    b
    • 2
    • 2
  • m

    mysterious-australia-14256

    07/23/2021, 9:26 AM
    Can anyone provide information on how to use a stack reference with C# and Azure? As an example I have one project that is creating a Log Analytics Workspace (Pulumi.AzureNative.OperationalInsights.Workspace) that I need to reference from additional projects. I have tried outputting the workspace object using
    [Output]
    public Output<Pulumi.AzureNative.OperationalInsights.Workspace> LogAnalyticsWorkspace { get; set; }
    That seems to go out OK with the results something like
    Outputs:
      + LogAnalyticsWorkspace: {
          + URN: "urn:pulumi:<stackname>::<projectname>::azure-native:resources:ResourceGroup$azure-native:operationalinsights:Workspace::<workspacename>"
          + ID : "/subscriptions/<subscriptionid>/resourcegroups/<resourcegroupname>/providers/microsoft.operationalinsights/workspaces/<workspacename>"
          + PackageVersion: ""
        }
    However when I try create a stack reference in the second project with the following code I get an error
    var coreStackReference = new StackReference("coreStackReference", new StackReferenceArgs
    {
    	Name = "<stackname>",
    });
    The error is
    invocation of pulumi:pulumi:getResource returned an error: unknown resource urn:pulumi:<stackname>::<projectname>::azure-native:resources:ResourceGroup$azure-native:operationalinsights:Workspace::<workspacename>
    Is it incorrect to try and pass objects in this way? I don't seem to get the errors when just passing strings so do I need to just pass IDs rather than objects and then rehydrate them somehow?
    b
    • 2
    • 7
  • l

    little-cartoon-10569

    07/26/2021, 5:23 AM
    In the third snippet of the example on https://www.pulumi.com/docs/intro/concepts/stack/#stackreferences, the C# code has an apparently-redundant
    Apply(v => v.ToString())
    . None of the other languages have that. Is it neccessary? If it is, why?
    g
    w
    • 3
    • 2
  • b

    boundless-monkey-2042

    07/29/2021, 2:50 PM
    Having trouble with FileArchive, an empty folder is created in the Storage Account. The folder is in the same folder as Pulumi.dev.yaml I have tried passing the folder Source = new FileArchive(".\\wwwroot\\"), as well as .zip. Running Pulumi v3.8.0 referencing Pulumi.AzureNative v1.19.0
    var wwwroot = new Storage.Blob("wwwroot", new Storage.BlobArgs
            {
                ResourceGroupName = resourceGroup.Name,
                AccountName = storageAccount.Name,
                ContainerName = staticWebsite.ContainerName,
                Source = new FileArchive(".\\wwwroot.zip"),
                ContentType = "Folder",
            });
    t
    • 2
    • 8
Powered by Linen
Title
b

boundless-monkey-2042

07/29/2021, 2:50 PM
Having trouble with FileArchive, an empty folder is created in the Storage Account. The folder is in the same folder as Pulumi.dev.yaml I have tried passing the folder Source = new FileArchive(".\\wwwroot\\"), as well as .zip. Running Pulumi v3.8.0 referencing Pulumi.AzureNative v1.19.0
var wwwroot = new Storage.Blob("wwwroot", new Storage.BlobArgs
        {
            ResourceGroupName = resourceGroup.Name,
            AccountName = storageAccount.Name,
            ContainerName = staticWebsite.ContainerName,
            Source = new FileArchive(".\\wwwroot.zip"),
            ContentType = "Folder",
        });
t

tall-librarian-49374

07/29/2021, 2:53 PM
Try forward slash?
new FileArchive("./wwwroot")
?
b

boundless-monkey-2042

07/29/2021, 3:01 PM
Source = new FileArchive("./wwwroot.zip"), AND Source = new FileArchive("./wwwroot"), same result no error no files.
Following Pulumi examples I added index and 404 html files from the same source folder to the $web container and they upload correctly.
var index_html = new Storage.Blob("index.html", new Storage.BlobArgs
        {
            ResourceGroupName = resourceGroup.Name,
            AccountName = storageAccount.Name,
            ContainerName = staticWebsite.ContainerName,
            Source = new FileAsset("./wwwroot/index.html"),
            ContentType = "text/html",
        });

        var notfound_html = new Storage.Blob("404.html", new Storage.BlobArgs
        {
            ResourceGroupName = resourceGroup.Name,
            AccountName = storageAccount.Name,
            ContainerName = staticWebsite.ContainerName,
            Source = new FileAsset("./wwwroot/404.html"),
            ContentType = "text/html",
        });
Started here - https://github.com/pulumi/examples/tree/master/azure-ts-static-website Pulumi up, all good. Added
const wwwroot = new storage.Blob("wwwroot", {
    resourceGroupName: resourceGroup.name,
    accountName: storageAccount.name,
    containerName: staticWebsite.containerName,
    source: new pulumi.asset.FileArchive(`./wwwroot`),
    contentType: "folder",
});
Returned
error: Error: failed to register new resource index.html [azure-native😒torage:Blob]: 2 UNKNOWN: failed to compute asset hash: asset path './wwwroot' is a directory; try using an archive
@tall-librarian-49374 any further insight on this one?
t

tall-librarian-49374

07/29/2021, 4:02 PM
That doesn’t look right. Could you open an issue in azure-native?
b

boundless-monkey-2042

07/29/2021, 4:03 PM
OK
View count: 1