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
automation-api
  • b

    brave-planet-10645

    03/30/2021, 1:31 PM
    What's in
    DefaultStack()
  • p

    plain-quill-22197

    03/30/2021, 1:32 PM
    it's quite a lot of kubernetes resources
  • p

    plain-quill-22197

    03/30/2021, 1:32 PM
    but it's the stack that I use for production deployments like this:
    await Pulumi.Deployment.RunAsync<AutoDevOps.DefaultStack>();
  • p

    plain-quill-22197

    03/30/2021, 1:32 PM
    and it works
  • b

    brave-planet-10645

    03/30/2021, 1:33 PM
    And what is
    autoDevOps.Urn
    ?
  • b

    brave-planet-10645

    03/30/2021, 1:33 PM
    is that the URN of the stack?
  • p

    prehistoric-coat-10166

    03/30/2021, 1:35 PM
    I think manually instantiating a class inheriting from
    Stack
    inside a program might be a problem? I recall seeing similar error which was caused by calling
    new StackClass()
    inside a program
  • p

    plain-quill-22197

    03/30/2021, 1:35 PM
    I think so. but, I don't think I get to that point. it fails with this error saying that the stack URN must be unique. I don't really understand it as I do not control how stacks are being created. I control creation of all other resources within the stack, but not the stack itself
  • b

    brave-planet-10645

    03/30/2021, 1:35 PM
    So you're not creating the stack in your pulumi program, you're referencing the resources you want to create
  • p

    plain-quill-22197

    03/30/2021, 1:36 PM
    no, what I have is this:
    using var appStack = await LocalWorkspace.CreateOrSelectStackAsync(stackArgs);
  • b

    brave-planet-10645

    03/30/2021, 1:36 PM
    and if
    DefaultStack
    is inheriting from Stack then that's why you're getting the duplicate resource urn error
  • p

    plain-quill-22197

    03/30/2021, 1:36 PM
    yes, DefaultStack inherits from Stack
  • p

    plain-quill-22197

    03/30/2021, 1:36 PM
    I will try without it
  • p

    plain-quill-22197

    03/30/2021, 1:39 PM
    I am still wondering how it happens as all I can see is those calls to pulumi CLI
  • b

    brave-planet-10645

    03/30/2021, 1:43 PM
    Take a look here: https://github.com/pierskarsenbarg/pulumi-demos/tree/main/csharp-automation this is a really simple version that should help
  • b

    brave-planet-10645

    03/30/2021, 1:43 PM
    so you wouldn't use the urn as the output because it doesn't exist yet
  • b

    brave-planet-10645

    03/30/2021, 1:43 PM
    (unless there is a resource that returns it)
  • p

    plain-quill-22197

    03/30/2021, 1:44 PM
    👍
  • b

    bored-oyster-3147

    03/30/2021, 1:52 PM
    yea if you're using a
    Pulumi.Stack
    class in an inline function than you must do
    PulumiFn.Create<TStack>()
    because if you provide just a delegate than the pulumi engine is wrapping it in a
    Pulumi.Stack
    resource internally and you can only have 1
    Pulumi.Stack
    resource declared
    👍 1
  • b

    bored-oyster-3147

    03/30/2021, 1:54 PM
    It's the same functionality if you were to use
    Deployment.RunAsync(async () => { // declare resources });
    instead of
    Deployment.RunAsync<TStack>();
  • p

    plain-quill-22197

    03/30/2021, 4:02 PM
    I tried the
    Create
    function, but I had to iterate a lot because of the "project name doesn't match" issue
  • p

    plain-quill-22197

    03/30/2021, 4:02 PM
    I confirm that not using a derived class solves the issue
  • p

    plain-quill-22197

    03/30/2021, 4:03 PM
    concerning the project name, it seems that somewhere the project name, which contains dashes, gets stripped of them. but when creating or selecting a stack, the check is done using the right value
  • p

    plain-quill-22197

    03/30/2021, 4:17 PM
    found it. the code set the project name to
    roomote/cal-sync
  • p

    plain-quill-22197

    03/30/2021, 4:17 PM
    so the slash was converted to
    /
    in one place but not in another
  • b

    bored-oyster-3147

    03/30/2021, 4:28 PM
    that must be a bug then, could you open an issue for it?
  • p

    plain-quill-22197

    03/30/2021, 4:32 PM
    I don't think the project name should support slashes, but some better diagnostic would be helpful
  • p

    plain-quill-22197

    03/30/2021, 4:32 PM
    it all eventually started to work, however
  • p

    plain-quill-22197

    03/30/2021, 4:33 PM
    the deployment done using an application that is doing the automation, doesn't include the CI environment details
  • p

    plain-quill-22197

    03/30/2021, 4:33 PM
    unlike any normal deployment, which picks up (in my case GitLab) details and links the deployment to a commit and the repo
Powered by Linen
Title
p

plain-quill-22197

03/30/2021, 4:33 PM
unlike any normal deployment, which picks up (in my case GitLab) details and links the deployment to a commit and the repo
View count: 1