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

Synthetic property preventing import #237

Open
Raniz85 opened this issue Apr 26, 2023 · 5 comments
Open

Synthetic property preventing import #237

Raniz85 opened this issue Apr 26, 2023 · 5 comments
Labels
kind/bug Some behavior is incorrect or out of spec

Comments

@Raniz85
Copy link

Raniz85 commented Apr 26, 2023

What happened?

We manage GitLab with a project that uses predefined building blocks that contain defaults that we don't want our developers to change. Among these we set archive_on_delete to prevent accidental deletion of projects.

This attribute however prevents us from importing existing projects since we can't import projects that have diffs and we can't set archive_on_delete since it's an attribute that is only set in the stack and not actually reflected in GitLab.

Expected Behavior

The import should succeed regardless of the value of archive_on_delete.

Steps to reproduce

  1. Create a new stack with pulumi-gitlab.
  2. Create a gitlab.Project that corresponds to a project that should be imported, set archive_on_delete to True and import_ to the ID of the project to import.
  3. Make sure that all other attributes in the GitLab project and the pulumi resource are the same
  4. Try to run pulumi up

Output of pulumi about

CLI
Version 3.55.0
Go Version go1.20
Go Compiler gc

Plugins
NAME VERSION
gitlab 4.9.0
python unknown

Host
OS debian
Version bookworm/sid
Arch x86_64

This project is written in python: executable='/usr/bin/python3' version='3.10.6
'

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@Raniz85 Raniz85 added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Apr 26, 2023
@abhinav
Copy link

abhinav commented Apr 26, 2023

Thanks for the issue, @Raniz85.
I'll move this to pulumi-gitlab since it's specific to the GitLab provider.
Folks there should be able to follow up on this.

@abhinav abhinav transferred this issue from pulumi/pulumi Apr 26, 2023
@iwahbe
Copy link
Member

iwahbe commented Apr 26, 2023

Hi @Raniz85. Thanks for letting us know about this. As a workaround, is it possible to leave archive_on_delete as false while you import, and then set it to true in an update?

@iwahbe iwahbe removed the needs-triage Needs attention from the triage team label Apr 26, 2023
@iwahbe
Copy link
Member

iwahbe commented Apr 26, 2023

Also, can you post the error you get when you run pulumi up? This helps us confirm that we are getting the same error you are when reproducing the problem.

@Raniz85
Copy link
Author

Raniz85 commented Apr 27, 2023

Hi @Raniz85. Thanks for letting us know about this. As a workaround, is it possible to leave archive_on_delete as false while you import, and then set it to true in an update?

Yeah, we do that now but I'd rather not since that means someone has to remember to change that after importing or deleting the project will be final.

I would expect this to work like protect which we can set when importing.

The error I get is this:

Previewing update (lxd):
     Type                              Name                                                            Plan       Info
     pulumi:pulumi:Stack               gitlab-cac-lxd                                                             0 messages
 =   └─ gitlab:index:Project           bbe4817d-2f31-4232-a287-d81eff8aacab                            import     [diff: +archiveOnDestroy]; 1 warning


Diagnostics:
  gitlab:index:Project (bbe4817d-2f31-4232-a287-d81eff8aacab):
    warning: inputs to import do not match the existing resource; importing this resource will fail

Do you want to perform this update? yes
Updating (lxd):
     Type                     Name                                  Status                   Info
     pulumi:pulumi:Stack      gitlab-cac-lxd                        **failed**               1 error
 =   └─ gitlab:index:Project  bbe4817d-2f31-4232-a287-d81eff8aacab  **importing failed**     1 error


Diagnostics:
  gitlab:index:Project (bbe4817d-2f31-4232-a287-d81eff8aacab):
    error: inputs to import do not match the existing resource

Resources:
    7 unchanged

Duration: 3s

@iwahbe
Copy link
Member

iwahbe commented May 16, 2023

Thanks. We're seeing the same issue you are. I'm not sure what the resolution will be here. The problem is that while you understand that archive_on_delete is a synthetic property, the Pulumi engine does not.

I think that pulumi/pulumi#12042 is the most relevant issue in pulumi/pulumi.

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
Projects
None yet
Development

No branches or pull requests

3 participants