https://pulumi.com logo
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
  • f

    fresh-lifeguard-12682

    10/23/2020, 10:17 PM
    How can I get the ConnectionString from a Cosmos DB (mongo) using
    Pulumi.Azure.CosmosDB.GetAccountResult
    ? it looks like that only the MasterKey is in that object. However if I use
    Pulumi.Azure.CosmosDB.Account
    there is a
    ConnectionStrings
    property available. I cant use the last approach since I only have the
    Account
    available in the stack that creates the Cosmos Account, I have another stack calling the
    GetAccountResult
    which is the one that needs the Connection String.
  • s

    some-flower-64874

    10/28/2020, 9:46 AM
    I'm struggling to get from Output to Input - specifically I have an
    Output<ImmutableArray<x>>
    that I want to "map" to an
    InputList<y>
    (where y is
    x.Id
    ) - there's a step here I'm failing to take (I think I want the opposite of all...). For extra credit in
    F#
    🙂
    t
    • 2
    • 2
  • s

    some-flower-64874

    10/28/2020, 10:15 AM
    Ok, the magic bit I need is to take advantage of one of these (there are several):
    public static implicit operator InputList<T>(Output<IEnumerable<T>> values)
                => values.Apply(a => ImmutableArray.CreateRange(a));
    asking the question got me closer...
    • 1
    • 1
  • f

    fresh-lifeguard-12682

    10/29/2020, 5:24 PM
    I have been getting this error in all of my stacks today
    azure:appservice:AppService (connectmga-location-cde):
    error: transport is closing
    g
    w
    s
    • 4
    • 14
  • b

    bored-activity-40468

    10/31/2020, 2:50 PM
    @worried-city-86458 I've been messing with your ImmutableExtensions and wondering, what
    (string)resource["kind"] == kind
    does? Thanks.
    Untitled
    w
    • 2
    • 4
  • w

    wet-noon-14291

    11/08/2020, 11:58 PM
    What is the recommended way to run a piece of code after a resource has been provisioned? Is it to do
    Apply
    on a
    Name
    for example and then run some kind there?
    s
    • 2
    • 17
  • f

    fresh-lifeguard-12682

    11/09/2020, 1:52 AM
    How can I find the RelayId from a Hybrid Connection?
  • f

    fresh-lifeguard-12682

    11/09/2020, 2:17 AM
    How can I configure a hybrid connection in an app service, I have been trying to do this but I can’t figure out how to get the RelayId I created this post just in case you want to follow up https://stackoverflow.com/questions/64745249/how-to-find-existing-hybrid-connection-relayid-using-pulumi-azure
    var webApiHybridConnection = new HybridConnection(
        hybridConnectionName,
        new Pulumi.Azure.AppService.HybridConnectionArgs
        {
            AppServiceName = appServiceName,
            ResourceGroupName = resourceGroupName,
            RelayId = "what goes here?",
            Hostname = "",
            Port = 443,
            SendKeyName = $"{_nameSet.AppServiceName(new ServiceName(ServiceName))}-sk",
        });
    t
    • 2
    • 6
  • b

    bored-activity-40468

    11/10/2020, 8:05 PM
    I don't think this is possible but thought I'd ask, is it possible to explicitly set a default provider in a stack's options resource transformation callback?
    t
    • 2
    • 1
  • w

    wet-noon-14291

    11/11/2020, 2:13 PM
    Is there a way to get better exceptions? I have an exception now that states that a key doesn't exists in a stack
    System.Collections.Generic.KeyNotFoundException: Required output 'Pulumi.Input`1[System.String]' does not exist on stack '<stack name>'
    it is super hard to debug this when the stacktrace is only referring to pulumi code and it doesn't say what key that is missing. The code also works when deploying to one environment, but fails for another. The config file should be close to identical...
    • 1
    • 1
  • e

    early-sugar-1496

    11/13/2020, 12:39 PM
    Hi. Sorry for the basic question, but what is the way to call a function related to a resource? For example, getting the credentials for an aks cluster
    var aksCluster = new AzureContainerService.ManagedCluster(
                "test",
                new AzureContainerService.ManagedClusterArgs{});
    
            var kubeConfig = AzureContainerService.ListManagedClusterAdminCredentials.InvokeAsync(
                new AzureContainerService.ListManagedClusterAdminCredentialsArgs
                {
                    ResourceGroupName = resourceGroup.Name,
                    ResourceName = aksCluster.Name,
                }).Result.Kubeconfigs;
    Doesn't compile, with an error on both
    ResourceGroupName
    and
    ResourceName
    ,
    Cannot convert source type 'Pulumi.Output<string>' to target type 'string'
    I'm pretty sure I've got a misunderstanding of properly using outputs 🤔 thanks
    t
    • 2
    • 3
  • p

    powerful-printer-57241

    11/13/2020, 2:54 PM
    Hi, we cannot get the secret config values working. In particular, we have the following config value, set like this:
    pulumi config set --secret databaseServerPassword "abcdef"
    In a stack, we have
    var databaseServerPassword = config.RequireSecret("databaseServerPassword");
    ...
    var database = new Database(...); // This works fine
    
    return new AppService(
        resourcesPrefix,
        new AppServiceArgs
        {
            Name = resourcesPrefix,
            AppServicePlanId = appServicePlanId,
            ResourceGroupName = resourceGroupName,        
            ConnectionStrings =
            {
                new AppServiceConnectionStringArgs
                {
                    Name = "Database",
                    Type = "SQLAzure",
                    Value = Output.Tuple(database.ServerName, database.Name, databaseServerPassword).Apply(t =>
                    {
                        var (serverName, databaseName, databasePassword) = t;                    
                        return $"Data Source=tcp:{serverName}.<http://database.windows.net|database.windows.net>,1433;Initial Catalog={databaseName};User ID={databaseUsername}@{serverName};Password={databasePassword}";
                    })
                }
            }
        }
    );
    The app service is created fine, but without the connection string. If we remove databaseServerPassword from Output.Tuple (and remove the corresponding variable from the connection string), it works fine. Is there a problem in the way we work with secrets/output?
    n
    b
    w
    • 4
    • 6
  • b

    breezy-salesmen-85534

    11/19/2020, 8:05 AM
    Hi Pulumi Community. I have a hard time testing Pulumi for C# and MS Azure. I have look at the unit testing example testing-unit-cs, but when I start debugging Pulumi is not able to read configuration for my pulumi stack. I am stuck in https://github.com/pulumi/pulumi/blob/394c91d7f6ab7a4096f4454827690a460f665433/sdk/dotnet/Pulumi/Deployment/Deployment_Config.cs#L33 because I have not set up environment variable PULUMI_CONFIG .How do I approach this?
    t
    • 2
    • 8
  • d

    delightful-lizard-41466

    11/22/2020, 4:18 PM
    Hi All. There is a way to subscribe to events from “Azure Blob Storage” using C# and not typescript ? A good sample is document here https://github.com/pulumi/pulumi-azure/blob/master/examples/eventgrid/index.ts with the onGridBlobCreate subscription hook.
    t
    • 2
    • 2
  • c

    cuddly-smartphone-15267

    12/02/2020, 11:20 AM
    i was trying to convert a typescript example to .net but couldn't quite work out how - the combination of
    reduce
    and
    apply
    just confused me a lot.. the example is basically creating some dns records for a certificate validation
    const exampleRecord: aws.route53.Record[];
            for (const range of Object.entries(exampleCertificate.domainValidationOptions.apply(domainValidationOptions => domainValidationOptions.reduce((__obj, dvo) => { ...__obj, [dvo.domainName]: {
                name: dvo.resourceRecordName,
                record: dvo.resourceRecordValue,
                type: dvo.resourceRecordType,
            } }))).map(([k, v]) => {key: k, value: v})) {
                exampleRecord.push(new aws.route53.Record(`exampleRecord-${range.key}`, {
                    allowOverwrite: true,
                    name: range.value.name,
                    records: [range.value.record],
                    ttl: 60,
                    type: range.value.type,
                    zoneId: exampleZone.then(exampleZone => exampleZone.zoneId),
                }));
            }
            const exampleCertificateValidation = new aws.acm.CertificateValidation("exampleCertificateValidation", {
                certificateArn: exampleCertificate.arn,
                validationRecordFqdns: exampleRecord.apply(exampleRecord => exampleRecord.map(record => record.fqdn)),
            });
    anybody that is more familiar with typescript than me perhaps suggest how to port it to the equivalent c# code?
    t
    • 2
    • 10
  • l

    late-salesmen-25375

    12/02/2020, 9:38 PM
    Hello! Junior’ish developer here and just getting started with Pulumi. I have some questions and was hoping some of you all might have some insight/real world experience with Pulumi in regards to Outputs. I saw a post above @fresh-summer-65887 but my .NET fu is not so strong yet. Mix that with the newness of Pulumi and it’s a mixture for me making a hot mess out of something. I am toying around in Digital Ocean to practice and learn Ansible by spinning up some machines to run playbooks against. I am able to spin up Droplets and I was able to get the Output working from an example when building only 1 machine but I was hoping to have
    pulumi up
    output the IPv4 and the name of each server for the output which didn’t work when spinning up more than just the one. I thought maybe I could create an Output class sort of like a Model and use that to build my output for the resource types I was building but that sort of didn’t work or . Maybe that is just unnecessary complexity but I thought it might make the project a little cleaner or have the output models in a separate project that could be reused across other projects and I just add a reference to that project. Maybe a NuGet type thing to import that would give you access to all the output information so you didn’t have to rewrite that code again? Any examples of something like this or is this just going about it the wrong way? Or any examples of how others are doing it. I have a very small use case for what I am doing here but could see this being useful in larger build outs of infrastructure in the future. Again I am not a seasoned developer so sorry if someone of this sounds like WTH is this guy talking about. Thanks for any insight.
    t
    • 2
    • 2
  • t

    tall-needle-56640

    12/04/2020, 5:52 PM
    #dotnet #typescript I'm trying to convert this to C#, but I can't make sense of it. Anyone?
    readonly result: Promise<T>;
    
        resolveResult!: (v: any) => void;
        rejectResult!: (e: Error) => void;
    
        constructor(program: () => Promise<T>) {
            this.program = program;
            this.result = new Promise<any>((resolve, reject) => {
                this.resolveResult = resolve;
                this.rejectResult = reject;
            });
            this.running = false;
        }
    f
    l
    t
    • 4
    • 10
  • b

    bored-activity-40468

    12/15/2020, 11:20 PM
    From https://github.com/pulumi/pulumi/issues/3383 I was setting
    aws:region
    to invalid and with 2.15.6 pulumi it says, invalid is an invalid aws region. Did that functionality change?
  • c

    chilly-hairdresser-56259

    12/22/2020, 10:57 PM
    Hello,  I am running into an odd issue that I am activley troubleshooting as it will cause issues down the road if I want to change settings later. Basically for this issue all I am doing is creating a new ECS Task Definition which then is setup as a ScheduledTask using CloudWatch Rule and EventTargets.  On FIRST deploy everything works accordingly, upon modifying the task definition say just CPU it throws an error => “Preview Failed: unexpected unknown property Value”. I enabled DEBUG, but I am not sure what I am exactly looking for.
    Untitled.txt
    g
    c
    f
    • 4
    • 11
  • b

    bitter-coat-39627

    12/28/2020, 4:38 AM
    Hi there! I'm super new to Pulumi (today is my first time using it) and I'm not sure if this question should go here or somewhere more general. I'm still trying to figure out how the
    Pulumi.<some-name>.yaml
    files work. Right now, I'm doing an experiment and created three separate yaml files:
    Pulumi.yaml
    Pulumi.dev.yaml
    Pulumi.prod.yaml
    I added a specific variable to the
    Pulumi.dev.yaml
    and
    Pulumi.prod.yaml
    ones called
    app:environment
    (setting the values to
    dev
    and
    prod
    , respectively) and then added this bit of code to my stack class so I can see the output:
    var config = new Config();
    var env = config.Require("app:environment");
    Console.WriteLine(env);
    Now, when I run
    pulumi up
    for my
    dev
    stack, it gives me the following error:
    Missing Required configuration variable 'dotnettestservice:app:environment'
    It looks like it's looking for it in
    Pulumi.yaml
    , not
    Pulumi.<env>.yaml
    . I have
    dotnettestservice
    defined under the
    name:
    parameter in my
    Pulumi.yaml
    , not in
    Pulumi.dev.yaml
    , nor
    Pulumi.prod.yaml
    . When I do a
    pulumi config get app:environment
    , it gives me the correct value of
    dev
    . My question is, am I allowed to have different required parameters based on the stack? Do I have to have a separate
    name
    parameter in each of these so it doesn't try to use the
    Pulumi.yaml
    one? Also, feel free to let me know if I'm not making sense and need to clarify anything (or if I'm going about this the completely wrong way) 😅 I appreciate any insight you might have ❤️
    t
    • 2
    • 5
  • l

    loud-shampoo-49194

    12/29/2020, 10:38 AM
    I have a quick question about naming resources - what is the difference between the constructor "name" argument and the *Args *Name argument? I'm using AzureNextGen.Latest and it throws an error when the *Args name argument is missing.
    t
    • 2
    • 3
  • l

    loud-shampoo-49194

    12/30/2020, 10:48 AM
    Is there a way to pass dotnet build flags to the pulumi up command? It would be nice to pass a configuration (Instead of using Debug as default)
    t
    • 2
    • 3
  • c

    chilly-hairdresser-56259

    01/05/2021, 1:47 AM
    Hello, I started using the new Lambda Container Image build and release and appears that I am now all of a sudden receiving the following error "The operation cannot be performed at this time. An update is in progress for resource: arn:aws:lambda:XXXXX". Is this due to the timeout for the operation to complete that it is not waiting long enough for the update to complete? I understand this is a "phase" of lambda code being updated, however I am trying to fix this so that our pipelines can update without impacting them.
    b
    • 2
    • 11
  • w

    witty-market-32785

    01/06/2021, 2:16 PM
    Hi everyone, how I can fill the UserAssignedIdentities inside Identity property of Azure Next Gen ApplicationGateway? The documentation seems to be outdated, because UserAssignedIdentities receives a InputMap<object> and I don't undestand how I use this.
    t
    • 2
    • 3
  • b

    brainy-ocean-92780

    01/06/2021, 9:20 PM
    Hello All. I am currently converting some of my pulumi code from TS to c#. In TS I see there is pulumi.getStack() to get the current stack name, however I'm having trouble finding the equivalent in c#, I'm not sure how I came across this function to begin with. Does anyone know of an equivalent in c# and know which part of the library it would be found in?
    w
    • 2
    • 2
  • b

    busy-dress-78329

    01/13/2021, 2:22 AM
    I created a thread with question & answer for those wondering how to configure Hybrid connections using pulumi. https://stackoverflow.com/questions/65692879/how-do-you-create-an-azure-hybrid-connection-using-pulumi/65692880#65692880
    👍 1
  • t

    tall-needle-56640

    01/13/2021, 11:01 PM
    I'm having issues with a thread disappearing. I'm sure this is an async/await problem, but I can't figure out what I'm supposed to do in the context of Pulumi. Here's a sample:
    private static void FunctionDoesNotFinish(Output<string> someValue)
    {
        _ = someValue.Apply<string?>(async c =>
        {
            Console.WriteLine("Start");
    
            for (int i = 0; i <= 1000; i++)
            {
                Console.WriteLine(i);
                await Task.Delay(1);
            }
    
            Console.WriteLine("End");
    
            return null;
        });
    }
    And here is the output:
    Diagnostics:
    pulumi😛ulumi:Stack (AzureSqlAad-dev-asa2):
    Start
    0
    1
    2
    3
    Numbers 4-100 never appear. I'm guessing
    Output.Create
    might be recommended, but I can't get that to work either.
    private static void FunctionDoesNotFinish(Output<string> someValue)
    {
        _ = someValue.Apply<string?>(s => Output.Create<string?>(SomeMethod()));
    }
    
    private static async Task<string?> SomeMethod()
    {
        Console.WriteLine("Start");
    
        for (int i = 0; i <= 1000; i++)
        {
            Console.WriteLine(i);
            await Task.Delay(1);
        }
    
        Console.WriteLine("End");
    
        return null;
    }
    NOTE: My actual code is just adding a user to the DB, so I don't actually care about the return value. @tall-librarian-49374
    t
    • 2
    • 4
  • b

    brainy-ocean-92780

    01/22/2021, 8:21 PM
    I recently converted my project in TS over c#. In TS we could define a set of outputs at like so
    export { resourceGroup }
    where resourceGroup was the result of a declaration. In c# however I get an error stating that the type must be of Output<T>, so in this case Output<ResourceGroup>, but the result of declaring a ResourceGroup is not Output<ResourceGroup> it's ResourceGroup. Is there a way in c# to either convert this resource to the output version of itself? Or is it possible to have the pulumi application have outputs that are not of Output<T>?
    t
    • 2
    • 4
  • b

    brainy-ocean-92780

    01/22/2021, 8:22 PM
    Otherwise I might have to create explicit outputs for each datapoint I care about.
  • b

    breezy-salesmen-85534

    01/26/2021, 10:57 AM
    Hi Pulumi team. Wi Seem to be struggling with Pulumi.Kubernetes 2.7.7. I suspect this to be an issue with Pulumi.Kubernetes.Helm.V3 namspace or kubernetes itself. I am using this along side the Pulumi.Azure package …. Everything works perfect until I want to test this in a unit test. Based on the official C# testing example I have written a simple test (simplified somewhat for your convenience)
    using System.ComponentModel;
    using System.Linq;
    using System.Threading.Tasks;
    using Pulumi.Azure.ContainerService;
    using Vipps.Vce.Core;
    using Xunit;
    namespace Vipps.Vce.International.BlueGreen.Tests
    {
        public class BLueGreenStackTests
        {
            [Fact]
            public async Task Test_BaseStack_Constructor_CreatesAKS()
            {
    
                var resources = await Testing.RunAsync<BlueGreenStack>(); <-- stacktrace covers this
                var aks =  resources.OfType<KubernetesCluster>().FirstOrDefault();
                Assert.NotNull(aks);
                Assert.Equal(name, await aks.Name.GetValueAsync());
            }
        }
    }
    This test crashes with a stacktrace where I am responsible for a single test line 😅 How do I approach this crash?
Powered by Linen
Title
b

breezy-salesmen-85534

01/26/2021, 10:57 AM
Hi Pulumi team. Wi Seem to be struggling with Pulumi.Kubernetes 2.7.7. I suspect this to be an issue with Pulumi.Kubernetes.Helm.V3 namspace or kubernetes itself. I am using this along side the Pulumi.Azure package …. Everything works perfect until I want to test this in a unit test. Based on the official C# testing example I have written a simple test (simplified somewhat for your convenience)
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using Pulumi.Azure.ContainerService;
using Vipps.Vce.Core;
using Xunit;
namespace Vipps.Vce.International.BlueGreen.Tests
{
    public class BLueGreenStackTests
    {
        [Fact]
        public async Task Test_BaseStack_Constructor_CreatesAKS()
        {

            var resources = await Testing.RunAsync<BlueGreenStack>(); <-- stacktrace covers this
            var aks =  resources.OfType<KubernetesCluster>().FirstOrDefault();
            Assert.NotNull(aks);
            Assert.Equal(name, await aks.Name.GetValueAsync());
        }
    }
}
This test crashes with a stacktrace where I am responsible for a single test line 😅 How do I approach this crash?
View count: 2