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

Add DeletedWith resource option #11095

Merged
merged 8 commits into from Nov 4, 2022
Merged

Add DeletedWith resource option #11095

merged 8 commits into from Nov 4, 2022

Conversation

same-id
Copy link
Contributor

@same-id same-id commented Oct 20, 2022

Description

In many cases there is no need to delete resources if the container resource is going to be deleted as well.

A few examples:

  • Database object (roles, tables) when database is being deleted
  • Cloud IAM bindings when user itself is being deleted

This helps with:

  • Speeding the deletion process
  • Removing unnecessary calls to providers
  • Avoiding failed deletions when the pulumi user running the plan has access to the container resource but not the contained ones

To avoid deleting contained resources, set the DeletedWith resource option to the container resource.

TODO:
Should we support DeletedWith with PendingDeletes?
Special case might be when contained resource is marked as pending deletion
but we now want to delete the container resource, so ultimately there is no
need to delete the contained anymore

Fixes # (issue)

Checklist

  • I have added tests that prove my fix is effective or that my feature works
  • I have run make changelog and committed the changelog/pending/<file> documenting my change
  • Yes, there are changes in this PR that warrants bumping the Pulumi Service API version

@github-actions
Copy link

PR is now waiting for a maintainer to take action.

Note for the maintainer: Commands available:

  • /run-acceptance-tests - used to test run the acceptance tests for the project
  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@pulumi-bot
Copy link
Contributor

pulumi-bot commented Oct 20, 2022

Changelog

[uncommitted] (2022-11-04)

Features

  • [pkg] Add DeletedWith as a resource option.

@same-id same-id changed the title Add DeletedWithParent resource option Add DeletedWithParent resource option Oct 20, 2022
@github-actions
Copy link

PR is now waiting for a maintainer to take action.

Note for the maintainer: Commands available:

  • /run-acceptance-tests - used to test run the acceptance tests for the project
  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@iwahbe
Copy link
Member

iwahbe commented Oct 20, 2022

/run-acceptance-tests
Please view the results of the acceptance tests Here

@AaronFriel
Copy link
Member

@same-id Thank you for making this PR, it's an impressive first time contribution!

I've given you a shoutout on our internal slack and hope you can get in touch with Lee on the community slack so we can send some swag your way.

At the same time, I'll confer with the team soon about how to proceed on this. We're usually pretty cautious about adding new resource options; if we have any changes in mind, we'll try to make pretty deliberate, specific suggestions. Looking forward to seeing this land - it might play a role in fixing one of the first bugs I filed against Pulumi in 2019 (pulumi/pulumi-gcp#268).

@AaronFriel AaronFriel added kind/enhancement Improvements or new features area/engine Pulumi engine labels Oct 20, 2022
@AaronFriel AaronFriel added this to the 0.80 milestone Oct 20, 2022
@AaronFriel AaronFriel self-assigned this Oct 20, 2022
@Frassle
Copy link
Member

Frassle commented Oct 20, 2022

In many cases there is no need to delete resources if the container resource is going to be deleted as well.

We have an issue for this #10634.

I'm not sure "parent" is the right relationship to be tracking this, it already is suffering a bit from confusing and overloaded semantics.

My original thinking about this was that users wouldn't be able to control it at all, instead resource providers would just state the container relationships. On further thinking that probably won't suffice, if just because providers won't always be fully up to date and people will need local workarounds.

But any option we do add should synchronize well with the idea that providers might also be setting things here, and as above I don't think it should have anything to do with the parent relationship.

@sam-utila
Copy link

sam-utila commented Oct 20, 2022

(Just noticed I switched from private user to work user, still me, same-id, with a different id ;-) )

In many cases there is no need to delete resources if the container resource is going to be deleted as well.

We have an issue for this #10634.

Dor from our company (utila.io) opened it :-)

I'm not sure "parent" is the right relationship to be tracking this, it already is suffering a bit from confusing and overloaded semantics.

I was also not sure about using Parent for this feature since it binds the child resource to inherit properties (like transformations) that might not be relevant for "skip deletion" functionality.

Another option was to use just a URN DeletedWith resource option that points to the container resource instead of piggybacking on top of existing Parent field just because it can specify a URN.
Although from naming perspective I was at first sure that the Parent option was the thing I was looking for and would in fact give us this functionality (before this change).

My original thinking about this was that users wouldn't be able to control it at all, instead resource providers would just state the container relationships. On further thinking that probably won't suffice, if just because providers won't always be fully up to date and people will need local workarounds.

I agree, probably we can model a DeletedWith relation between multiple resources, accept the fact that some resources have a mutual DeletedWith relation, or maybe even circular one.
In fact, a resource might have multiple DeletedWith relations: (hypothetical example) An edge (x, y) is deleted automatically if either x or y are deleted.

Workaround might be to extend with ExtraDeletedWith as an array of resources. (just in terms of naming)

Maybe even if resources are "skipping" deletion we would also want to communicate that to the user as a different operation: "delegated delete" instead of "delete"

But any option we do add should synchronize well with the idea that providers might also be setting things here, and as above I don't think it should have anything to do with the parent relationship.

I would love the overriding functionality hit master from one side since this solves an acute pain today.

From the other hand I do understand that some changes deserve some time for discussion and to "sleep on it" - and then of course spend some time to pick the perfect option name :-)

However I do think that I would hate to see this feature being dragged on out of existance.

As I mentioned (in the TODO:) there are some edge cases like "Pending Deletions" + current deletions that we might also dwell on, or cases where the providers are changing: GCP provider -> Postgres Cloud SQL DB -> Postgres provider -> Role; deleting the Postgres Cloud SQL DB should save the deletion of the Role within it, even though they are handled by different providers.
So waiting out for the perfect solution might take some time (as I assume this feature is something that was probably discussed very early on on Pulumi HQ's whiteboards but was probably, and justifiably put off in favor of simplicity)

Maybe if we define this feature under non-stable API/ABI and release it under PULUMI_EXPERIMENTAL=1 (or a specific experimental flag, to avoid getting ALL experimental features) it will allow us to release this feature faster for people that like to live on the edge :-)

This commit mainly shows that this functionality is easy to achieve with a relatively few changes, and might help set the discussion and the appetite for it.

I would even argue that this type of feature would even be useful on a "best effort" basis -> worst case, you will do the "slow path", so the risk is minimal.

Thanks!

@Frassle
Copy link
Member

Frassle commented Oct 24, 2022

Dor from our company (utila.io) opened it :-)

👍

I would love the overriding functionality hit master from one side since this solves an acute pain today.

Sure, I'm quite happy to just get a new resource option in now and we can internally iterate on later extending schemas and things to explain these relationships as well. The engine is not in place to be able to use that information yet, so it would just be wasted effort if done right now.

Another option was to use just a URN DeletedWith resource option that points to the container resource instead of piggybacking on top of existing Parent field just because it can specify a URN.

I think something like this is much more workable.

In fact, a resource might have multiple DeletedWith relations: (hypothetical example) An edge (x, y) is deleted automatically if either x or y are deleted.

Is that likely? I've been trying to think of any examples where a resource has multiple containers, where if either any or all get deleted it also gets deleted but so far everything I've thought of only has one container. My worry with adding a URN list option is you have to decided if that's an AND or OR operation (i.e. if x has deletedWith: [y, z] do you delete x if just y is deleted or only when y and z are deleted).

Maybe even if resources are "skipping" deletion we would also want to communicate that to the user as a different operation: "delegated delete" instead of "delete"

I think that will be needed. The engine still needs to do a state delete, and if we ever add lifecycle delete hooks they would still need to fire, so this isn't skipping the delete from the engines point of view, just from the providers point of view.

@iwahbe
Copy link
Member

iwahbe commented Oct 24, 2022

Sure, I'm quite happy to just get a new resource option in now and we can internally iterate on later extending schemas and things to explain these relationships as well. The engine is not in place to be able to use that information yet, so it would just be wasted effort if done right now.

We have precedent for this strategy. replaceOnChanges is implemented as a resource option, which we later added to the schema. The schema communicates to the engine via embedding the provided replaceOnChanges values in the generated SDK, which passes them to the engine.

@same-id
Copy link
Contributor Author

same-id commented Oct 24, 2022

Dor from our company (utila.io) opened it :-)

👍

I would love the overriding functionality hit master from one side since this solves an acute pain today.

Sure, I'm quite happy to just get a new resource option in now and we can internally iterate on later extending schemas and things to explain these relationships as well. The engine is not in place to be able to use that information yet, so it would just be wasted effort if done right now.

Another option was to use just a URN DeletedWith resource option that points to the container resource instead of piggybacking on top of existing Parent field just because it can specify a URN.

I think something like this is much more workable.

Tell me if you want me to resubmit the PR with that option (and maybe choose a different name) or whether you are going to implement this internally in Pulumi

In fact, a resource might have multiple DeletedWith relations: (hypothetical example) An edge (x, y) is deleted automatically if either x or y are deleted.

Is that likely? I've been trying to think of any examples where a resource has multiple containers, where if either any or all get deleted it also gets deleted but so far everything I've thought of only has one container. My worry with adding a URN list option is you have to decided if that's an AND or OR operation (i.e. if x has deletedWith: [y, z] do you delete x if just y is deleted or only when y and z are deleted).

I thought of OR relation only.
My initial thought was something like in GCP you can create a new role and a new user, and then bind that role in IAM.

If the role is deleted (need to make sure) then the IAM binding is deleted
If the user is deleted then the IAM binding is deleted

So:

IAM-Binding { deletedWith: [NewRole, NewUser] } (no need to delete the IAM binding if role OR user is being deleted)

But need to make sure.

Maybe even if resources are "skipping" deletion we would also want to communicate that to the user as a different operation: "delegated delete" instead of "delete"

I think that will be needed. The engine still needs to do a state delete, and if we ever add lifecycle delete hooks they would still need to fire, so this isn't skipping the delete from the engines point of view, just from the providers point of view.

@Frassle
Copy link
Member

Frassle commented Oct 25, 2022

Tell me if you want me to resubmit the PR with that option (and maybe choose a different name) or whether you are going to implement this internally in Pulumi

If you can I'm happy to help with reviewing that and getting it in.

IAM-Binding { deletedWith: [NewRole, NewUser] } (no need to delete the IAM binding if role OR user is being deleted)

That sounds reasonable. So if either parent gets deleted the IAM binding would get deleted by aws as well so rather than us doing (Delete binding, Delete role) we can safely just do (Delete role) to get the same end result?

Given that I think a URN[] DeletedBy resource option sounds correct?

@errordeveloper
Copy link

As I mentioned in pulumi/pulumi-kubernetes#2211, Kubernetes is another example. There are, of course, some object that own cloud resources, like service with an external LB, storage volumes and various CRs (perhaps stacks managed by the Pulumi operator would be a good example along with CrossPlane and other similar solutions). The API will need to have an explicit opt-in with a default allow filter (so that user doesn't need to enumerate all the common resource types).

@same-id
Copy link
Contributor Author

same-id commented Oct 25, 2022

That sounds reasonable. So if either parent gets deleted the IAM binding would get deleted by aws as well so rather than us doing (Delete binding, Delete role) we can safely just do (Delete role) to get the same end result?

Given that I think a URN[] DeletedBy resource option sounds correct?

Not sure about the name DeletedBy, "A is deleted if B is deleted" made me choose DeletedWith

One more thing that concerns me is that I assume that you can't specify circular Parent dependencies.
(Pulumi shows all children as )

In the current implementation I used the DeletedWithParent which helped. Otherwise, in the current implementation if we specify:
A DeletedWith B
B DeletedWith A

Then none will get deleted.

WDYT

@Frassle
Copy link
Member

Frassle commented Oct 25, 2022

One more thing that concerns me is that I assume that you can't specify circular Parent dependencies.

That's correct for Parents, and also for Dependencies.

A DeletedWith B
B DeletedWith A

Then none will get deleted.

It's not generally possible to define circular resources in pulumi programs anyway, but given that x DeletedWith y tells the engine that if it deletes y then it can elide the delete for x, it doesn't define the deletion order (that's done via dependencies). So if you change the program to just delete A or B in the above case it will just elide the actual delete for the other but mark it as deleted. If you delete both the engine will decide which one to really delete based on dependency ordering (which can't be circular). So even if we did end up with cycles in the DeletedWith graph I think the engine could cope with it.

@same-id
Copy link
Contributor Author

same-id commented Oct 25, 2022

I understand, I was referring to my current implementation:

Now, I skip deletion if DeletedWithParent is in otherDeletions==sg.deletes

Where sg.deletes is all the deletions that are about to happen.

If I change DeletedWithParent to DeletedWith and then supply:
A deleted with B
B deleted with A

Then both deletions will be skipped, which is not intended.

So there are 3 options:

  1. Keep using DeletedWithParent and have additional Parent semantics
  2. Change to DeletedWith and not allow cycles (need to make sure) - is this by default? I think we need to add checks
  3. Change to DeletedWith and allow cycles, but make sure at least one element in the cycle is deleted, it's a bit more tricky and the current sg.deletes implementation will not work IMO

@Frassle
Copy link
Member

Frassle commented Oct 26, 2022

So there are 3 options:

Option three is clearly the ideal, but if it's overly tricky we could take option 2 for the first version of this feature.

@same-id
Copy link
Contributor Author

same-id commented Oct 26, 2022

Maybe also introduce option number 4: (which is actually option number 0)

Keep as it is.
If there's a cycle, none will get deleted, and it's up to the user to avoid this, it's an "expert override" feature anyway, just need to document this.

@Frassle
Copy link
Member

Frassle commented Oct 26, 2022

If there's a cycle, none will get deleted, and it's up to the user to avoid this, it's an "expert override" feature anyway, just need to document this.

Yeh actually that's fine for the first pass at this.

@github-actions
Copy link

PR is now waiting for a maintainer to take action.

Note for the maintainer: Commands available:

  • /run-acceptance-tests - used to test run the acceptance tests for the project
  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@same-id same-id changed the title Add DeletedWithParent resource option Add DeletedWith resource option Oct 30, 2022
@Frassle
Copy link
Member

Frassle commented Nov 4, 2022

bors merge

bors bot added a commit that referenced this pull request Nov 4, 2022
11095: Add `DeletedWith` resource option r=Frassle a=same-id

# Description

In many cases there is no need to delete resources if the container resource is going to be deleted as well.

A few examples:
 * Database object (roles, tables) when database is being deleted
 * Cloud IAM bindings when user itself is being deleted

This helps with:
 * Speeding the deletion process
 * Removing unnecessary calls to providers
 * Avoiding failed deletions when the pulumi user running the plan has access to the container resource but not the contained ones

To avoid deleting contained resources, set the `DeletedWith` resource option to the container resource.

TODO:
 Should we support DeletedWith with PendingDeletes?
 Special case might be when contained resource is marked as pending deletion
 but we now want to delete the container resource, so ultimately there is no
 need to delete the contained anymore

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->


Fixes # (issue)

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.

Not sure - maybe
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Sam Eiderman <sameid@gmail.com>
Co-authored-by: Fraser Waters <fraser@pulumi.com>
@bors
Copy link
Contributor

bors bot commented Nov 4, 2022

Build failed:

@Frassle
Copy link
Member

Frassle commented Nov 4, 2022

bors retry

bors bot added a commit that referenced this pull request Nov 4, 2022
11095: Add `DeletedWith` resource option r=Frassle a=same-id

# Description

In many cases there is no need to delete resources if the container resource is going to be deleted as well.

A few examples:
 * Database object (roles, tables) when database is being deleted
 * Cloud IAM bindings when user itself is being deleted

This helps with:
 * Speeding the deletion process
 * Removing unnecessary calls to providers
 * Avoiding failed deletions when the pulumi user running the plan has access to the container resource but not the contained ones

To avoid deleting contained resources, set the `DeletedWith` resource option to the container resource.

TODO:
 Should we support DeletedWith with PendingDeletes?
 Special case might be when contained resource is marked as pending deletion
 but we now want to delete the container resource, so ultimately there is no
 need to delete the contained anymore

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->


Fixes # (issue)

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.

Not sure - maybe
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Sam Eiderman <sameid@gmail.com>
Co-authored-by: Fraser Waters <fraser@pulumi.com>
@bors
Copy link
Contributor

bors bot commented Nov 4, 2022

Build failed:

@github-actions
Copy link

github-actions bot commented Nov 4, 2022

PR is now waiting for a maintainer to take action.

Note for the maintainer: Commands available:

  • /run-acceptance-tests - used to test run the acceptance tests for the project
  • /run-codegen - used to test the Pull Request against downstream codegen
  • /run-docs-gen - used to test the Pull Request against documentation generation

@Frassle
Copy link
Member

Frassle commented Nov 4, 2022

bors merge

bors bot added a commit that referenced this pull request Nov 4, 2022
11095: Add `DeletedWith` resource option r=Frassle a=same-id

# Description

In many cases there is no need to delete resources if the container resource is going to be deleted as well.

A few examples:
 * Database object (roles, tables) when database is being deleted
 * Cloud IAM bindings when user itself is being deleted

This helps with:
 * Speeding the deletion process
 * Removing unnecessary calls to providers
 * Avoiding failed deletions when the pulumi user running the plan has access to the container resource but not the contained ones

To avoid deleting contained resources, set the `DeletedWith` resource option to the container resource.

TODO:
 Should we support DeletedWith with PendingDeletes?
 Special case might be when contained resource is marked as pending deletion
 but we now want to delete the container resource, so ultimately there is no
 need to delete the contained anymore

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->


Fixes # (issue)

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.

Not sure - maybe
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Sam Eiderman <sameid@gmail.com>
Co-authored-by: Fraser Waters <fraser@pulumi.com>
@bors
Copy link
Contributor

bors bot commented Nov 4, 2022

Build failed:

@Frassle
Copy link
Member

Frassle commented Nov 4, 2022

bors retry

@bors
Copy link
Contributor

bors bot commented Nov 4, 2022

Build succeeded:

@bors bors bot merged commit fc7c341 into pulumi:master Nov 4, 2022
@same-id
Copy link
Contributor Author

same-id commented Nov 4, 2022

Thanks for helping me take it to the finish line

@Frassle
Copy link
Member

Frassle commented Nov 4, 2022

No worries :) Thanks for the substantial contribution!

iwahbe added a commit that referenced this pull request Nov 10, 2022
bors bot added a commit that referenced this pull request Nov 10, 2022
11306: [sdk/nodejs] Cleanup use of `asyncTest` and `assertAsyncThrows` r=justinvp a=justinvp

The `asyncTest` and `assertAsyncThrows` helpers were necessary when originally written, but are no longer needed as Mocha has built-in support for testing async functions that return promises, and Node's `assert.rejects` can be used to assert whether a promise has been rejected.

11313: Regenerate .pyi files, sort diffs on proto cksum r=iwahbe a=iwahbe

Regenerate the .pyi files as left from #11095. 

It's unclear to me why this didn't happen in the initial PR. The only thing I can think of is that .checksum.txt was manually edited. 

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
Co-authored-by: Ian Wahbe <ian@wahbe.com>
@sam-utila
Copy link

I think there's a small problem with the PR that we didn't flush out at testing.

DeletedWith should be Resource in the Go SDK and not a URN - and be used just like Parent

Can we "breaking change" this?

@Frassle
Copy link
Member

Frassle commented Nov 21, 2022

We do plan on changing that, it will be a breaking change but it's likely no one is using this yet.

abhinav pushed a commit to pulumi/pulumi-dotnet that referenced this pull request Jan 11, 2023
11095: Add `DeletedWith` resource option r=Frassle a=same-id

# Description

In many cases there is no need to delete resources if the container resource is going to be deleted as well.

A few examples:
 * Database object (roles, tables) when database is being deleted
 * Cloud IAM bindings when user itself is being deleted

This helps with:
 * Speeding the deletion process
 * Removing unnecessary calls to providers
 * Avoiding failed deletions when the pulumi user running the plan has access to the container resource but not the contained ones

To avoid deleting contained resources, set the `DeletedWith` resource option to the container resource.

TODO:
 Should we support DeletedWith with PendingDeletes?
 Special case might be when contained resource is marked as pending deletion
 but we now want to delete the container resource, so ultimately there is no
 need to delete the contained anymore

<!--- 
Thanks so much for your contribution! If this is your first time contributing, please ensure that you have read the [CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md) documentation.
-->


Fixes # (issue)

## Checklist

<!--- Please provide details if the checkbox below is to be left unchecked. -->
- [x] I have added tests that prove my fix is effective or that my feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the `changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the Pulumi Service,
then the service should honor older versions of the CLI where this change would not exist.
You must then bump the API version in /pkg/backend/httpstate/client/api.go, as well as add
it to the service.

Not sure - maybe
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi Service API version
  <!-- `@Pulumi` employees: If yes, you must submit corresponding changes in the service repo. -->


Co-authored-by: Sam Eiderman <sameid@gmail.com>
Co-authored-by: Fraser Waters <fraser@pulumi.com>
bors bot added a commit that referenced this pull request Jan 16, 2023
11883: [sdk/{go,nodejs,python}] Fix `DeletedWith` resource option r=justinvp a=justinvp

This change fixes the `DeletedWith` resource option in the Go, Node.js, and Python SDKs and adds tests.

This feature was a community contribution and while there were engine tests included with the [original PR](#11095), there weren't any tests confirming the functionality worked correctly from each SDK.

Here's a summary of the fixes:

* Go: The `DeletedWith` resource option was never usable as it accepted a URN instead of a Resource. We discussed this internally a while back and decided to go ahead and fix this. (Note: While changing the signature is technically a breaking change, the feature is currently unusable, so the change would not break anyone, so there's no need to wait for a major version bump.)

* Node.js: The `deletedWith` resource option did not work at all from the Node.js SDK because it was incorrectly passing the resource object itself in the RegisterResource request, rather than the resource's URN.

* Python: The `deleted_with` resource option did not work at all from the Python SDK because it was incorrectly passing the resource object itself in the RegisterResource request, rather than the resource's URN.

A `FailsOnDelete` resource has been added to the testprovider, which will fail when its `Delete` gRPC is called. The tests use this to ensure `Delete` is not called for resources of this type with the `DeletedWith` option specified.

Fixes #11358
Fixes #11622

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/engine Pulumi engine kind/enhancement Improvements or new features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants