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

Provider doesn't seem to honor retainOnDelete #244

Closed
cnunciato opened this issue Jul 31, 2023 · 4 comments
Closed

Provider doesn't seem to honor retainOnDelete #244

cnunciato opened this issue Jul 31, 2023 · 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

@cnunciato
Copy link

cnunciato commented Jul 31, 2023

In looking into pulumi/pulumi-synced-folder#44, I was assuming that by setting retainOnDelete: true , I'd be instructing Pulumi (as the docs suggest) "not [to] call through to the resource provider’s delete method". The Command provider, however, doesn't seem to honor this setting.

Given an S3 bucket and this TypeScript program, which uses the managedObjects property to delegate control over the bucket's files to the AWS CLI via the Command provider, I'd expect that after a pulumi up and pulumi destroy, the bucket would contain the files that'd been synced from my-folder:

import * as synced from "@pulumi/synced-folder";

const folder = new synced.S3BucketFolder("my-folder", {
    path: "./my-folder",
    bucketName: "my-bucket",
    acl: aws.s3.PrivateAcl,
    managedObjects: false,
}, { retainOnDelete: true });

Instead, those files are deleted:

$ pulumi up

Updating (dev)
...
     Type                                   Name                    Status              
 +   pulumi:pulumi:Stack                    synced-folder-dev       created (0.95s)     
 +   └─ synced-folder:index:S3BucketFolder  my-folder               created (0.60s)     
 +      └─ command:local:Command            my-folder-sync-command  created (1s)        

Resources:
    + 3 created

Duration: 4s

$ aws s3 ls s3://my-bucket
2023-07-31 11:24:52        112 index.html

$ pulumi destroy 

Destroying (dev)
...

     Type                                   Name                    Status           
 -   pulumi:pulumi:Stack                    synced-folder-dev       deleted          
 -   └─ synced-folder:index:S3BucketFolder  my-folder               deleted          
 -      └─ command:local:Command            my-folder-sync-command  deleted (3s)  

$ aws s3 ls s3://my-bucket
[no results]

Here's a snip from the logs showing the delete step being run:

I0731 11:53:51.206716   22698 log.go:81] SnapshotManager: Beginning mutation for step `delete` on resource `urn:pulumi:dev::synced-folder::synced-folder:index:S3BucketFolder::my-folder`
I0731 11:53:51.206743   22698 log.go:81] SnapshotManager.doDelete(urn:pulumi:dev::synced-folder::synced-folder:index:S3BucketFolder::my-folder)
I0731 11:53:51.206754   22698 log.go:81] SnapshotManager.markPendingOperation(urn:pulumi:dev::synced-folder::synced-folder:index:S3BucketFolder::my-folder, deleting)
I0731 11:53:51.374517   22698 log.go:81] StepExecutor worker(1): applying step delete on urn:pulumi:dev::synced-folder::synced-folder:index:S3BucketFolder::my-folder (preview false)
I0731 11:53:51.374577   22698 log.go:81] SnapshotManager: deleteSnapshotMutation.End(..., true)
I0731 11:53:51.374595   22698 log.go:81] SnapshotManager.markOperationComplete(urn:pulumi:dev::synced-folder::synced-folder:index:S3BucketFolder::my-folder)
I0731 11:53:51.374605   22698 log.go:81] Marked old state snapshot as done: urn:pulumi:dev::synced-folder::synced-folder:index:S3BucketFolder::my-folder
I0731 11:53:51.501183   22698 log.go:81] StepExecutor worker(1): step delete on urn:pulumi:dev::synced-folder::synced-folder:index:S3BucketFolder::my-folder retired
@mnlumi mnlumi added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Jul 31, 2023
@guineveresaenger guineveresaenger added p1 A bug severe enough to be the next item assigned to an engineer and removed needs-triage Needs attention from the triage team labels Aug 1, 2023
@rquitales
Copy link
Member

@cnunciato I believe that pulumi-synced-folder is a Pulumi component so the retainOnDelete setting shouldn't apply? Reference documentation link

The retainOnDelete resource option does not apply to component resources, and will not have the intended effect.

@guineveresaenger guineveresaenger added resolution/by-design This issue won't be fixed because the functionality is working as designed and removed p1 A bug severe enough to be the next item assigned to an engineer labels Aug 1, 2023
@guineveresaenger
Copy link

Closing this as a no-op.

My recommendation would be to work with provider-level resources for this.

@cnunciato
Copy link
Author

Ah! Thanks folks. Sorry I missed that.

@cnunciato
Copy link
Author

Although, just to be thorough (and for the docs, as I'd like to make sure they're complete): Are there any plans to support this for components also? Or is there some reason that can't be done?

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

4 participants