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

    08/04/2021, 1:33 AM
    Hi, Can I use SQL queries within a pulumi deployment project to check for the existence of a record, and create it if it doesn't exist?
    t
    • 2
    • 2
  • b

    boundless-tailor-35598

    08/05/2021, 4:39 PM
    I have a network stack that is creating a vpc and a bunch of public subnets:
    [Output] public Output<string> VpcId { get; set; }
    [Output] public Output<ImmutableArray<string>> PublicSubnetIds { get; set; }
    and am trying to reference these from another stack. I can reference the stack and can get the VpcId back using:
    var network = new StackReference(SeparateNetworkStackName);
    var vpcId = network.GetOutput("VpcId").Apply(x => x.ToString());
    However, I can't work out how to retrieve the array of public subnets. These would seems like a fairly common operation. Anyone know how to do it?
  • b

    boundless-tailor-35598

    08/05/2021, 4:51 PM
    Appear to have got this working. Can't believe this is the right way to do it, so if someone knows the right way, please let me know. This is what I did:
  • b

    boundless-tailor-35598

    08/05/2021, 4:52 PM
    Output<object> publicSubnetIds = network.GetOutput("PublicSubnetIds");
    Output<ImmutableArray<object>> subnets = publicSubnetIds.Apply(x => (ImmutableArray<object>) x);
    var secondPublicSubnetId = subnets.Apply(x => x[1].ToString());
  • g

    green-stone-37839

    08/05/2021, 5:16 PM
    You should be able to do something like:
    stack.GetOuput("output").Apply(x => x as string[]);
  • b

    boundless-tailor-35598

    08/05/2021, 7:17 PM
    Thanks Phillip. I tried this but I don't think it works if your Output is ImmutableArray<string>>. I guess, I could change the stack output to be Output<string[]>, but will leave as is for the moment.
  • w

    worried-city-86458

    08/05/2021, 7:46 PM
    message has been deleted
  • b

    boundless-tailor-35598

    08/06/2021, 8:28 AM
    Very cool. Not played with the automation api yet, but planning to and examples are handy. Pulumi is fantastic, but sometimes there is a lack of examples - perhaps due to the fact that is supports a number of languages.
  • e

    enough-garden-22763

    08/13/2021, 10:54 PM
    TIL how to compile a project against a local .NET Pulumi SDK. Replace
    <PackageReference Include="Pulumi" Version="3.9.1" />
    with
    <ProjectReference Include="..\..\..\..\pulumi\sdk\dotnet\Pulumi\Pulumi.csproj" />
    everywhere and add
    <AssemblyVersion>3.9.0.0</AssemblyVersion>
    in
    Pulumi.csproj
    . Not as seamless as
    replace
    command I got used to in
    go.mod
    but it helped me a lot making iterative changes. Is that how folks do it or is there an easier way?
    t
    b
    • 3
    • 2
  • n

    numerous-action-56322

    08/17/2021, 1:14 PM
    Hi, I'm new to Pulumi and I was wondering if someone could point me to an example of a real life implementation of a ComponentResource in dotNet. My apologies if this question has already been addressed and answered in the past.
    b
    w
    • 3
    • 6
  • b

    boundless-car-60268

    08/26/2021, 8:52 AM
    As we don't have dynamic resource provides in .NET, is there a way to detect when a stack is being destroyed? My scenario is that we've implemented a
    CustomResource
    that adds some database entries. I'd like to remove those entries if the resource is being destroyed. I'm pretty sure that the answer, if there is one, is that something will need to be executed outside of the
    CustomResource
    derived class.
    b
    • 2
    • 2
  • n

    numerous-action-56322

    08/26/2021, 4:27 PM
    Hi, I'm using the azure native provider and I can't find a way to create an empty data disk and then attach it to a new vm. Any help is much appreciated. Thank you !
  • m

    miniature-leather-70472

    09/02/2021, 1:06 PM
    is it possible to have a component resource inherit from another component resource? We've got a component resource that we'd like to make some of the methods virtual and overwrite them in a child class, but it looks like it might not be possible, particuarly because we can't register the child class with the component resource class
    b
    • 2
    • 4
  • b

    bulky-policeman-29913

    09/05/2021, 7:08 PM
    Ok I have to be doing something dumb. I have read inputs and outputs a hundred times and I still can't figure out how to get an output value to resolve as a string when I need it to build a say a script value for another resource. I have tried
    var x = resource.prop.Apply(x => x)
    t
    • 2
    • 2
  • b

    bulky-policeman-29913

    09/05/2021, 7:10 PM
    etc and still it just shows Pulumi.Output as the value (ie: tostring in c# of an object)
  • b

    bulky-policeman-29913

    09/05/2021, 7:40 PM
    nevermind it just registered you cant pass a string to an input it has to be an input or an output to resolve dependencies...light bulb moment đź’ˇ
    👍 1
  • r

    rapid-soccer-18092

    09/07/2021, 7:21 AM
    Using the pulumi/pulumi-dotnet docker image to integrate pulumi into a deployment pipeline. Although just found that it's still using .NET Core 3.1 (and not .NET 5). Any suggestion on my best course of action here? I could write my own docker image - I don't really see another way? Thanks 🙂
    t
    w
    • 3
    • 5
  • b

    boundless-monkey-2042

    09/09/2021, 9:11 PM
    We provision a “hub and spoke” network topology with several projects and stacks that span subscriptions. When provisioning spokes we use two providers to provision peering from hub to spoke and spoke to hub. When a spoke stack is destroyed peerings are properly removed, all good.  When the hub is updated all subnet peerings are dropped, not so good. Running Pulumi refresh and Pulumi up on each spoke stack restores the missing peerings but is there a better way? All spokes could be provisioned with a single stack but that feels wrong. Thoughts?
    b
    • 2
    • 2
  • b

    broad-chef-99140

    09/10/2021, 4:11 PM
    How to structure your .net files? What is the best practice for structuring the .cs files in a large stack within a project. In Terraform, you would typically group all of the resource related to the same "thing" into a .tf file For example for an Azure Function, the app service plan, storage and app service itself might all go into one .tf file. What is the equivalent for Pulumi to avoid having one giant .cs file for the stack (or is the answer that I should have a stack for each "thing" in my system and use Stack References to create inter-stack dependencies?). I have thought about using
    partial class
    but wanted to reach out to see if there are any conventions?
    b
    • 2
    • 5
  • w

    worried-city-86458

    09/14/2021, 3:51 AM
    I keep fighting outputs... given an
    Output<ImmutableArray<string>>
    (of aws subnet ids fwiw), I need to create a bunch of aws resources for each subnet. Unless I'm missing something, there doesn't seem to be a nice way to enumerate the array outside of apply, since there's no way to get the array length, unless I use
    OutputUtilities
    .
    t
    b
    • 3
    • 7
  • w

    worried-lunch-10568

    09/15/2021, 5:05 AM
    Hey guys, is there any news regarding policy support in c#? Github issue was created more than a year ago..
    đź‘€ 1
    b
    c
    • 3
    • 4
  • b

    broad-chef-99140

    09/21/2021, 3:14 PM
    Appsettings.json and Secrets.json in Pulumi. What are the best practices for using
    appsettings.json
    and
    secrets.json
    in C# Pulumi projects? My scenario is that I want to use a connection string for a resource on a completely different resource group. not controlled by pulumi as an application setting for my azure app service. I want to store the value of this connection string in
    secrets.json
    like I would for any typicaly .net application. The only docs I can find is this https://www.pulumi.com/blog/7-ways-to-deal-with-application-secrets-in-azure/#2-configuration-files but this simply says "_With some configuration not shown here, the properties are filled at startup_", but it is the stuff that is not shown that I would love to see.
    g
    w
    • 3
    • 3
  • e

    enough-butcher-66045

    09/22/2021, 3:36 AM
    Hey peeps, I'm setting up frontdoor and one of the properties that I can set up in Azure for a frontend is
    customHttpsConfiguration
    , but this option doesn't seem to exist in the Pulumi SDK?
    t
    • 2
    • 2
  • e

    enough-butcher-66045

    09/22/2021, 3:36 AM
    this is for FrontendEndpointArgs
  • r

    rapid-soccer-18092

    09/22/2021, 7:54 AM
    Quick one. I have an args property of
    Input<string>
    and I need to assign it to an
    object
    type in my values object map, but implicit typing doesn't kick in so the assigned value is Input<T>. See below... the
    args.DatadogApiKey
    is `Input<string>`:
    var datadogChart = new Chart("datadog-chart",
                    new ChartArgs
                    {
                        Chart = "datadog",
                        Version = args.DatadogChartVersion,
                        Namespace = "default",
                        Values = new Dictionary<string, object>
                        {
                            ["datadog"] = new Dictionary<string, object>
                            {
                                ["apiKey"] = args.DatadogApiKey,
                                ["site"] = "<http://datadoghq.eu|datadoghq.eu>"
                            },
                        }
                    });
    t
    • 2
    • 10
  • w

    wooden-lifeguard-41446

    09/23/2021, 8:13 AM
    Hi guys, do we have a way to mock StackReference and/or pulumi.config for unit test? I'm stuck with it , can't find any example.
    b
    • 2
    • 2
  • s

    swift-island-2275

    09/29/2021, 8:42 AM
    Hi, I've tried to import existing resources with import command. The case is that the code seems incorrect, as I get some errors, for example look below
    var aks_mypool_12128392_vmss = new AzureNative.Compute.VirtualMachineScaleSet("aks-mypool-12128392-vmss", new AzureNative.Compute.VirtualMachineScaleSetArgs
    {
        DoNotRunExtensionsOnOverprovisionedVMs = false,
        Identity = new AzureNative.Compute.Inputs.VirtualMachineScaleSetIdentityArgs
        {
            Type = "UserAssigned",
    The Type property is of type Input<Pulumi.AzureNative.Compute.ResourceIdentityType>? and it seems there's no implicit conversion from string. Is it a bug ?
  • m

    mysterious-australia-14256

    10/01/2021, 10:56 AM
    Is it possible to specify JsonSerializerOptions to use with the Pulumi.Config.Get/Require methods or would I need to specify it manually as an attribute for each property in my model?
    b
    w
    • 3
    • 2
  • f

    fierce-cat-91199

    10/03/2021, 11:48 PM
    Hi everyone, I'm having an issue that hopefully someone can help with 🙂 I am building my dotnet project and then setting
    runtime:options:binary
    in my Pulumi.yaml pointing to the built DLL. However, now when running
    pulumi preview
    , I get
    Error: no resource plugin 'azure-native-v1.34.0' found in the workspace or on your $PATH
    . Without the binary option, pulumi is working, and strangely my stack is using v1.33 of the azure-native plugin
    b
    • 2
    • 3
  • e

    enough-garden-22763

    10/04/2021, 3:08 PM
    Hello friends! I’m running into some difficulty deeply converting
    inputShape(T)
    style records to
    Input<T>
    with the facilities in the SDK, specifically Inputs.GetAmiIdsFilterInputArgs to Inputs.GetAmiIdsFilterArgs from the AWS provider. GetAmiIdsFilterInputArgs essentially is a record that’s deeply transformed by codegen to insert
    Input<_>
    layer everywhere to make it easier for the users to pass outputs in. In my work I need to “unnest” all these inputs back. I found a different way forward but it’s striking me as not exactly elegant and it will make the implementation diverge from what we have in some other language SDKs. So I’d like to solicit feedback here, perhaps I’m missing something obvious.
    w
    • 2
    • 6
Powered by Linen
Title
e

enough-garden-22763

10/04/2021, 3:08 PM
Hello friends! I’m running into some difficulty deeply converting
inputShape(T)
style records to
Input<T>
with the facilities in the SDK, specifically Inputs.GetAmiIdsFilterInputArgs to Inputs.GetAmiIdsFilterArgs from the AWS provider. GetAmiIdsFilterInputArgs essentially is a record that’s deeply transformed by codegen to insert
Input<_>
layer everywhere to make it easier for the users to pass outputs in. In my work I need to “unnest” all these inputs back. I found a different way forward but it’s striking me as not exactly elegant and it will make the implementation diverge from what we have in some other language SDKs. So I’d like to solicit feedback here, perhaps I’m missing something obvious.
https://github.com/pulumi/pulumi/pull/7899 is the context with all the gory detail
w

worried-city-86458

10/04/2021, 6:49 PM
That's a lot to take in, so rather than try to understand it all I'll just ask some dumb questions... • is this a problem to be solved at compile time or run time? • if codegen is used to create one type, can't it be used to create the other?
e

enough-garden-22763

10/04/2021, 8:13 PM
Both compile-time and runtime solutions are acceptable here
Codegen doesn’t seem to be smart enough at the moment to be able to create a function that auto-converts between the two types. So I was hoping that runtime can.
The runtime is, it seems, capable of serializing both types to the same underlying structure.
I’d prefer a runtime solution as not to generate too much converter code.
View count: 1