hi all, I have a resouce which used to be a c# voi...
# general
l
hi all, I have a resouce which used to be a c# void where resource were created, and now it's refactored to a "proper" pulumi class - inheriting from pulumi "stack". When I do pulumi preview now, I get
Copy code
error: Duplicate resource URN 'urn:pulumi:<stuff>::pulumi:pulumi:Stack::<stuff>'; try giving it a unique name
anyone know if there's a way around this? The entire stack is the same, its just that it's being instantiated slightly differently
its even showing me that things are the same:
Copy code
pulumi preview -j --show-sames
{
    "steps": [
        {
            "op": "same",
            "urn": "urn:pulumi:prod::<stuff>::pulumi:pulumi:Stack::<stuff>",
            "oldState": {
                "urn": "urn:pulumi:prod::<stuff>::pulumi:pulumi:Stack::<stuff>",
                "custom": false,
                "type": "pulumi:pulumi:Stack",
                "created": "0001-01-01T00:00:00Z",
                "modified": "0001-01-01T00:00:00Z"
            },
            "newState": {
                "urn": "urn:pulumi:prod::<stuff>::pulumi:pulumi:Stack::<stuff>",
                "custom": false,
                "type": "pulumi:pulumi:Stack",
                "created": "0001-01-01T00:00:00Z",
                "modified": "0001-01-01T00:00:00Z"
            },
            "detailedDiff": null
        }
    ],
    "diagnostics": [
        {
            "urn": "urn:pulumi:prod::<stuff>::pulumi:pulumi:Stack::<stuff>",
            "message": "error: Duplicate resource URN 'urn:pulumi:prod::<stuff>::pulumi:pulumi:Stack::<stuff>'; try giving it a unique name\n",
            "severity": "error"
        }
    ],
    "duration": 643302009,
    "changeSummary": {
        "same": 1
    }
}
(my problem is that i'm trying to provide stack output, and for that to work I have to inherit from
Stack
, which I didn't do from the start. Now the stack has a lot of resources, and I'd very reluctant to tear everything down.
l
I cannot think of a reason to extend the Stack class. You can provide stack outputs by adding them to the existing stack object, you don't need to create a new one. And you don't need to create a new Stack class.
l
no I'm not extending stack, but inherit from it. If I don't, no outputs are provided. (this is c#)
at least that's what the docs say I should do:
Copy code
public class MyStack : Stack
{
    public MyStack()
    {
        ...
        this.Url = resource.Url;
    }

    // 'url' is the output name. By default, it would take the property name 'Url'.
    [Output("url")] Output<string> Url { get; set; }
}
I'd love it if there was a python-style "stack.export" somewhere in the c# sdk too
l
This seems to be a very specific question then. Maybe #CQ2QFLNFL would be a good place to find the relevant expertise?
l
will do. THanks!