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
  • r

    rhythmic-vegetable-87369

    01/21/2020, 3:54 AM
    Error validating Template for Deployment "test-dep766717b3" (Resource Group "deployment-test-rg"): The request content was invalid and could not be deserialized: 'Error converting value "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#" to type 'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Data.Definitions.DeploymentParameterDefinition'. Path 'properties.parameters.$schema', line 1, position 6335.'.
  • r

    rhythmic-vegetable-87369

    01/21/2020, 5:36 AM
    Also if I want to pass my own parameters without reading a json file , how can I go about doing it?
  • r

    rhythmic-vegetable-87369

    01/21/2020, 5:37 AM
    I want to pass the service bus connection string as a parameter, and this is created using pulumi in a step above this.
  • a

    adventurous-garage-59192

    01/21/2020, 5:39 AM
    Use
    Parameters
  • a

    adventurous-garage-59192

    01/21/2020, 5:39 AM
    ie
    var siteExtension = new TemplateDeployment("nr-ext", new TemplateDeploymentArgs
                {
                    DeploymentMode = "Incremental",
                    ResourceGroupName = rgname,
                    TemplateBody = File.ReadAllText("siteextension.json"),
                    Parameters = {{"siteName", app.Name}, {"extensionName", "NewRelic.Azure.WebSites.Extension" }, {"extensionVersion", "1.5.0"} }
                });
  • d

    dry-raincoat-51244

    01/22/2020, 12:57 PM
    Hi all, When creating a resource group in Azure, how do I specify which people have access to it (IAM)? // Create an Azure Resource Group var resourceGroup = new ResourceGroup("PulumiTest", new ResourceGroupArgs { Name = "PulumiTest", });
    t
    p
    • 3
    • 10
  • d

    delightful-lizard-41466

    01/25/2020, 11:12 AM
    Hi all , there is a way to get current stack name from C# (like pulumi.getStack() in TS) ?
    p
    • 2
    • 1
  • d

    delightful-lizard-41466

    01/29/2020, 10:57 AM
    Hi folks, I ran a github workflow with "docker://pulumi/actions" and I got some errors when building my pulumi project with the latest version of NetCore sdk (3.1.x) it is not supported by pulumi actions container ?
    c
    • 2
    • 1
  • s

    stocky-spoon-28903

    01/30/2020, 2:30 PM
    @delightful-lizard-41466 It’s likely that the actions container needs updating for some new language runtimes
  • s

    stocky-spoon-28903

    01/30/2020, 2:30 PM
    In the meantime you can use the
    setup-dotnet
    task and the
    action-install-pulumi-cli
    task to get a working envrionment: https://github.com/cecton/mbrman
    d
    • 2
    • 2
  • l

    little-kangaroo-50941

    02/03/2020, 4:19 PM
    Ciao and thanks in advance!
  • l

    little-kangaroo-50941

    02/03/2020, 4:23 PM
    could you please telle me why if I set a config with "pulumi config set sql:username" in one stack then when I try to retrieve it from Program.cs the error is "Missing Required configuration variable ProjectName😒ql:username" ?
    m
    • 2
    • 9
  • l

    little-kangaroo-50941

    02/03/2020, 4:24 PM
    the project name appears to be concatenated in the namespace
  • d

    delightful-dawn-43855

    02/06/2020, 10:56 AM
    Hi, i'm having some issues with Azure Servicebus Queues deployed via Pulumi. Pulumi feels that the name of the queue is changed, although it's not (and it's all lowercase), and when pulumi tries to delete/replace the queue it sometimes report success but the queue is not created properly... is this a known issue? Code looks like this:
    var servicebusnamespace = new Namespace($"{standardPrefixName}-sb", new NamespaceArgs
    			{
    				ResourceGroupName = resourceGroup.Name,
    				Sku = "Standard",
    				ZoneRedundant = false,
    			});
    
    			Pulumi.Azure.ServiceBus.QueueArgs DefaultQueueSetting = new Pulumi.Azure.ServiceBus.QueueArgs
    			{
    				ResourceGroupName = resourceGroup.Name,
    				NamespaceName = servicebusnamespace.Name,
    				MaxSizeInMegabytes = 1024,
    				LockDuration = "PT5M",
    				RequiresDuplicateDetection = true,
    				RequiresSession = false,
    				DefaultMessageTtl = "PT12H",
    				DeadLetteringOnMessageExpiration = true,
    				MaxDeliveryCount = 10,
    				EnablePartitioning = true,
    			};
    
    			DefaultQueueSetting.Name = KnownQueues.UpdatedCompany;
    			var updatedcompanyQueue = new Queue(KnownQueues.UpdatedCompany, DefaultQueueSetting);
    
    			DefaultQueueSetting.Name = KnownQueues.UpdatedPanel;
    			var UpdatedPanelQueue = new Queue(KnownQueues.UpdatedPanel, DefaultQueueSetting);
    t
    • 2
    • 10
  • d

    delightful-lizard-41466

    02/11/2020, 3:38 PM
    Hi folks In C# there is a way to get a reference or id for an existent "azure storage account" created in a different pulumi stack ? Just an example ...
    g
    • 2
    • 3
  • f

    freezing-waiter-91293

    02/12/2020, 12:33 PM
    Hi everyone, I am new to pulumi and I am trying to create my first deployment. For our stack we need the Azure FormRecognizer cognitive services account, I know that it is validated and the "FormRecognizer" kind is not in the list of valid kinds - the pr to add it is already merged to the terraform provider 🙂. My question is: can I somehow make pulumi ignore the validation error and proceed on creating the infrastructure ? sort of a --force flag ?
    b
    • 2
    • 4
  • s

    stocky-crayon-93563

    02/12/2020, 6:16 PM
    Hi folks, I'm trying to enable advanced threat protection for an Azure SQL database, struggling to find the correct type - am I being stupid or is it not available/accessible?
    b
    • 2
    • 7
  • f

    future-kite-91191

    02/19/2020, 8:04 AM
    Good morning! I'm having a hard time to get value of an
    Output<string>
    var randomStringResult = string.Empty;
                var randomString = new RandomPassword("random", new RandomPasswordArgs() { Length = 63 }).Result.Apply(v => randomStringResult = v);
    I'm probably missing something obvious here? I need to generate a random password and need access to the generated string result
    b
    t
    m
    • 4
    • 5
  • m

    millions-journalist-34868

    02/19/2020, 12:40 PM
    Hi. I am new to Pulumi and I was wondering what was the proper way to organize its code. Right now all my azure ressources are created in the Main of my Program.cs file which is getting bigger and bigger 😞. Samples that I saw were doing the same thing which seems fine for a few ressources but as my infrastructure is growing it's getting less nice. Are there good practices to organize the code ?
    t
    • 2
    • 4
  • f

    future-kite-91191

    02/20/2020, 4:08 PM
    Quick question, is this the proper way to get ref to an existing Azure KeyVault secret in C#?
    Pulumi.Azure.KeyVault.Secret.Get("Redis--Password", keyVault.Id).Vault
    b
    t
    • 3
    • 7
  • b

    bored-jordan-47264

    02/21/2020, 5:16 PM
    Hi all, am trying to use StackReference in dotnet. With TS I could export a resource and import it using
    getOutput
    then cast it to the correct type, but when I export using dotnet it exports a string. Are there any docs for this?
    t
    • 2
    • 2
  • s

    straight-flower-13757

    02/22/2020, 4:51 AM
    Hi all, first of all thanks for the great tool I have a question regarding async operations in
    ComponentResource
    I have something similar to this in the
    Deployment.RunAsync
    like
    return Deployment.RunAsync(async () =>
    {
                var assumeRoleDocument = await Pulumi.Aws.Iam.Invokes.GetPolicyDocument(new Pulumi.Aws.Iam.GetPolicyDocumentArgs
                {
                    Statements = {
                        ...
                        }
                    }
                });
    
                var ecsPolicyRole = new Pulumi.Aws.Iam.Role($"{name}-ecs-role", new Pulumi.Aws.Iam.RoleArgs
                {
                    AssumeRolePolicy = assumeRoleDocument.Json
                });
    
    });
    Now I’m trying to move that into a dedicated module, using
    ComponentResource
    What is your recommendation for doing that since I can’t await in the constructor of the custom
    ComponentResource
    ? I did this hack, but not sure if I’m missing something that will make it more straight forward:
    public class EcsService : ComponentResource
        {
            public EcsService(string name, EcsServiceResourceOptions options)
                : base("foo:pulumi:ecs", name, options)
            {
                 var assumeRoleDocument = Pulumi.Aws.Iam.Invokes.GetPolicyDocument(new Pulumi.Aws.Iam.GetPolicyDocumentArgs
                {
                    Statements = {
                        ...
                        }
                    }
                });
    
                var ecsPolicyRole = new Pulumi.Aws.Iam.Role($"{name}-ecs-role", new Pulumi.Aws.Iam.RoleArgs
                {
                    AssumeRolePolicy = Output.Create("").Apply(async _ => (await assumeRoleDocument).Json) //getting advantage of the built in Output type and its Apply func
                }, new CustomResourceOptions { Parent = this });
             }
          }
    t
    • 2
    • 3
  • l

    little-kangaroo-50941

    02/24/2020, 9:54 AM
    Ciao! Dynamic Providers are still not supported in .NET correct? Is there a way to create the $Web folder in an Azure Storage Account using C# ?
    t
    s
    f
    • 4
    • 22
  • s

    straight-flower-13757

    02/27/2020, 5:32 PM
    Hi, I came back with another question: I have a stack that consists of a
    ComponentResource
    like
    public class EcsService : ComponentResource
        {
            public EcsService(string name, EcsServiceResourceOptions options)
                : base("foo:pulumi:ecs", name, options)
            {
                 ...
                 var parameters = new List<Pulumi.Aws.Ssm.Parameter>();
    
                foreach (KeyValuePair<string, string> variable in options.EnvironmentVariables) // EnvironmentVariables is InputMap<string>
                {
                    var Parameter = new Pulumi.Aws.Ssm.Parameter(variable.Key, 
                    ...
                    , new CustomResourceOptions { Parent = this });
                    parameters.Add(Parameter);
                }
                ...
             }
         }
    I’m trying to use this component like:
    class Program
        {
            static Task<int> Main()
            {
                return Deployment.RunAsync(() =>
                {
                    var config = new Config();
    
                    var environmentVariables = new InputMap<string>();
    
                    foreach (var item in config.RequireObject<JsonElement>("environmentVariables").EnumerateObject()) //those environmentVariables are inserted as pulumi config set --path environmentVariables.foo val .. etc
                        environmentVariables.Add(item.Name, item.Value.GetString());
    
                    var service = new EcsService(config.Require("name"), new EcsServiceResourceOptions
                    {
                        ...
                        EnvironmentVariables = environmentVariables,
                        ...
                    });
          }
    I’m getting the following exception:
    error: Running program '....' failed with an unhandled exception:
        System.NotSupportedException: A Pulumi.InputMap`1[[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]] cannot be synchronously enumerated. Use GetAsyncEnumerator instead.
    But I can’t await the foreach in the constructor of
    EcsService
    , any advice ? And what you think around the way I’m importing multiple key/value pairs from config into an InputMap<string>, is there better way ?
    t
    • 2
    • 12
  • l

    little-kangaroo-50941

    02/27/2020, 10:17 PM
    Ciao! Is it possible to deploy an Azure App Service with the last (3.1 would be ok) .Net Core runtime? I can’t see “runtime” option in the object model…and also I cannot see it in Terraform
    t
    a
    • 3
    • 7
  • a

    ambitious-apartment-7017

    03/07/2020, 2:29 PM
    In Azure Active Directory, I have an App Registration. I want to add a permission using Pulumi. I can do it in the Azure Portal manually, as shown in the attached image. Can someone point me to an example of how to do this with Pulumi (C#), please?
    t
    c
    b
    • 4
    • 8
  • s

    stale-address-4911

    03/11/2020, 9:04 AM
    Hi, Do we have a sample app which creates a VM, configures IIS on the VM, then enable a app pool and configures Load balancer and host an app
    t
    • 2
    • 1
  • f

    fast-dinner-32080

    03/11/2020, 5:16 PM
    Currently I am only able to use Pulumi 1.11.0-preview and not a newer nuget version. If I try to use a newer one such as 1.11.1 or even 1.12.0 I get a System.MissingMethodException: Method not found error. Just wanting to make sure this is expected in the current preview versions or if something has changed which I need to make modifications to work.
    error: Running program '/repos/pulumi-projects/rancher-server-cluster/bin/Debug/netcoreapp3.1/rancher-server-cluster.dll' failed with an unhandled exception:
        System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
         ---> System.MissingMethodException: Method not found: 'Void Pulumi.ProviderResource..ctor(System.String, System.String, Pulumi.ResourceArgs, Pulumi.ResourceOptions)'.
           at Pulumi.VSphere.Provider..ctor(String name, ProviderArgs args, ResourceOptions options)
           at RancherServerCluster..ctor() in /repos/pulumi-projects/rancher-server-cluster/RancherServerCluster.cs:line 19
           --- End of inner exception stack trace ---
           at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
           at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
           at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
           at System.Activator.CreateInstance[T]()
           at Pulumi.Deployment.Runner.RunAsync[TStack]()
    t
    • 2
    • 4
  • f

    fast-dinner-32080

    03/11/2020, 9:29 PM
    How do I create an output for a class that is inheriting Stack. You used to just run it all in a single Deployment.Run which would return a dictionary but now that is is a separate class (from the template generator) and not sure how to return outputs. The documents still have the older way.
    t
    • 2
    • 10
  • f

    fast-dinner-32080

    03/12/2020, 12:37 AM
    How would I add an output and an input value. Basically trying to take a disk size which is provided by an output and add to it an Input value. This isn't possible to do
    Size = args.VmTemplate.Apply(x => x.Disks[0].Size ) + args.SrvExtendSize
    as well as
    Size = args.VmTemplate.Apply(x => x.Disks[0].Size ) + args.SrvExtendSize.ToOutput()
    So I must be missing something
    s
    • 2
    • 5
Powered by Linen
Title
f

fast-dinner-32080

03/12/2020, 12:37 AM
How would I add an output and an input value. Basically trying to take a disk size which is provided by an output and add to it an Input value. This isn't possible to do
Size = args.VmTemplate.Apply(x => x.Disks[0].Size ) + args.SrvExtendSize
as well as
Size = args.VmTemplate.Apply(x => x.Disks[0].Size ) + args.SrvExtendSize.ToOutput()
So I must be missing something
I can call ToString on each and parse them back to an int but that doesn't seem right at all. Is there a special function to do math against outputs and inputs?
s

straight-flower-13757

03/12/2020, 1:29 AM
I think you can do something similar to this:
Output.Tuple<?, int>(args.VmTemplate, args.SrvExtendSize).Apply(t => {
   var (template, extendedSize) = t;
   return template.Disks[0].Size + args.SrvExtendSize;
});
that will take both inputs and make sure that both are counted in/awaited if needed before converting them into a single output.
f

fast-dinner-32080

03/12/2020, 1:51 AM
Ah that seems to work.
Size = Output.Tuple(args.VmTemplate, args.SrvExtendSize).Apply(t => {
    var (template, extendedSize) = t;
    return template.Disks[0].Size + extendedSize;
}),
It just seems like a lot of work to just add two ints.
Thanks for the reply!!
s

straight-flower-13757

03/12/2020, 1:55 AM
Welcome, been there before 😄
View count: 1