Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming a Folder resource name should not fail to apply #180

Closed
rgl opened this issue Aug 13, 2021 · 4 comments
Closed

Renaming a Folder resource name should not fail to apply #180

rgl opened this issue Aug 13, 2021 · 4 comments
Labels
kind/bug Some behavior is incorrect or out of spec resolution/by-design This issue won't be fixed because the functionality is working as designed

Comments

@rgl
Copy link

rgl commented Aug 13, 2021

Renaming the Folder resource name should not fail to apply.

Please note that the Folder path is not modified (this folder path is what actually gets created in vSphere).

Steps to reproduce

  1. Create C# code to create a Folder as:
        var folder = new Folder(
            "example",  // this is the resource name that we will later change.
            new FolderArgs
            {
                Path = "rke_example", // this is the folder path that is actually created in vSphere and we never change it.
                Type = "vm",
                DatacenterId = datacenter.Moid,
            }
        );
  1. run pulumi up
  2. Modify the C# code to use a different folder internal name:
        var folder = new Folder(
            "rke_example", // this resource name was changed from "example" to "rke_example"
  1. run pulumi up

Expected: Expected the Folder in vSphere for not being renamed, because only the resource name was changed.
Actual: Pulumi tried to rename the Folder to the same name, and failed because the folder with a same name already existed.

The actual error is:

Diagnostics:
  vsphere:index:Folder (rke_example):
    error: 1 error occurred:
        * error creating targetFolder: ServerFaultCode: The name 'rke_example' already exists.
@rgl rgl added the kind/bug Some behavior is incorrect or out of spec label Aug 13, 2021
@rgl rgl changed the title Renaming a Folder internal name should not fail to apply Renaming a Folder resource name should not fail to apply Aug 13, 2021
@stack72
Copy link
Contributor

stack72 commented Aug 13, 2021

Hi @rgl

I'm sorry you got this error - what do you want the behaviour to be if Pulumi tries to create a folder that is already in place?

Paul

@rgl
Copy link
Author

rgl commented Aug 13, 2021

The only thing that was renamed in the C# code was the resource name. That should not trigger an actual folder rename in vSphere (because the folder Path set in C# was not changed), correct? If so, there lies the bug.

@stack72
Copy link
Contributor

stack72 commented Aug 13, 2021

Ah! Ok so there lies the Pulumi bug that we should have been more forward about

Pulumi uses autonaming - so the resource name that is passed to the resource constructor, is actually used as part of the resource name

You can override this behaviour by passing a "name" parameter to the resource. This will then use that name specifically and a resource constructor name is free to be as you need

https://www.pulumi.com/docs/intro/concepts/resources/#names

I'm sorry we have not made this clear on our provider

I know this doesn't solve your issue but I hope it does explain what you are seeing

Paul

@mikhailshilkov mikhailshilkov added the resolution/by-design This issue won't be fixed because the functionality is working as designed label Nov 29, 2023
@mikhailshilkov
Copy link
Member

If I read the discussion correctly, this behavior is by design. Since this issue is very old and has been inactive, I'll go ahead and close it as non-actionable.

@mikhailshilkov mikhailshilkov closed this as not planned Won't fix, can't repro, duplicate, stale Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/by-design This issue won't be fixed because the functionality is working as designed
Projects
None yet
Development

No branches or pull requests

3 participants