Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
29 changed files
with
803 additions
and
12 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
changelog/pending/20230115--sdk-go-nodejs-python--fix-deletedwith-resource-option.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
changes: | ||
- type: fix | ||
scope: sdk/go,nodejs,python | ||
description: Fix DeletedWith resource option |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: deleted_with_go | ||
description: A program that uses the DeletedWith resource option | ||
runtime: go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2016-2023, Pulumi Corporation. All rights reserved. | ||
//go:build !all | ||
// +build !all | ||
|
||
// Exposes the FailsOnDelete resource from the testprovider. | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi" | ||
) | ||
|
||
type FailsOnDelete struct { | ||
pulumi.CustomResourceState | ||
} | ||
|
||
func NewFailsOnDelete(ctx *pulumi.Context, name string, opts ...pulumi.ResourceOption) (*FailsOnDelete, error) { | ||
var resource FailsOnDelete | ||
err := ctx.RegisterResource("testprovider:index:FailsOnDelete", name, nil, &resource, opts...) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return &resource, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
module github.com/pulumi/pulumi/tests/deleted_with | ||
|
||
go 1.18 | ||
|
||
require github.com/pulumi/pulumi/sdk/v3 v3.51.1 | ||
|
||
require ( | ||
github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect | ||
github.com/Microsoft/go-winio v0.5.2 // indirect | ||
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect | ||
github.com/acomagu/bufpipe v1.0.3 // indirect | ||
github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect | ||
github.com/blang/semver v3.5.1+incompatible // indirect | ||
github.com/cheggaaa/pb v1.0.29 // indirect | ||
github.com/djherbis/times v1.5.0 // indirect | ||
github.com/emirpasic/gods v1.12.0 // indirect | ||
github.com/go-git/gcfg v1.5.0 // indirect | ||
github.com/go-git/go-billy/v5 v5.3.1 // indirect | ||
github.com/go-git/go-git/v5 v5.4.2 // indirect | ||
github.com/gofrs/uuid v4.2.0+incompatible // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/golang/glog v1.0.0 // indirect | ||
github.com/golang/protobuf v1.5.2 // indirect | ||
github.com/google/go-cmp v0.5.7 // indirect | ||
github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 // indirect | ||
github.com/hashicorp/errwrap v1.1.0 // indirect | ||
github.com/hashicorp/go-multierror v1.1.1 // indirect | ||
github.com/imdario/mergo v0.3.12 // indirect | ||
github.com/inconshreveable/mousetrap v1.0.0 // indirect | ||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect | ||
github.com/kevinburke/ssh_config v1.1.0 // indirect | ||
github.com/mattn/go-colorable v0.1.12 // indirect | ||
github.com/mattn/go-runewidth v0.0.13 // indirect | ||
github.com/mitchellh/go-homedir v1.1.0 // indirect | ||
github.com/mitchellh/go-ps v1.0.0 // indirect | ||
github.com/opentracing/basictracer-go v1.1.0 // indirect | ||
github.com/opentracing/opentracing-go v1.2.0 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/pkg/term v1.1.0 // indirect | ||
github.com/rivo/uniseg v0.2.0 // indirect | ||
github.com/rogpeppe/go-internal v1.8.1 // indirect | ||
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect | ||
github.com/santhosh-tekuri/jsonschema/v5 v5.0.0 // indirect | ||
github.com/sergi/go-diff v1.2.0 // indirect | ||
github.com/spf13/cobra v1.5.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/stretchr/testify v1.8.0 // indirect | ||
github.com/texttheater/golang-levenshtein v1.0.1 // indirect | ||
github.com/tweekmonster/luser v0.0.0-20161003172636-3fa38070dbd7 // indirect | ||
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect | ||
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect | ||
github.com/xanzy/ssh-agent v0.3.2 // indirect | ||
go.uber.org/atomic v1.9.0 // indirect | ||
golang.org/x/crypto v0.0.0-20220824171710-5757bc0c5503 // indirect | ||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect | ||
golang.org/x/sys v0.0.0-20220823224334-20c2bfdbfe24 // indirect | ||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect | ||
golang.org/x/text v0.4.0 // indirect | ||
google.golang.org/genproto v0.0.0-20220405205423-9d709892a2bf // indirect | ||
google.golang.org/grpc v1.51.0 // indirect | ||
google.golang.org/protobuf v1.28.1 // indirect | ||
gopkg.in/warnings.v0 v0.1.2 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
lukechampine.com/frand v1.4.2 // indirect | ||
sourcegraph.com/sourcegraph/appdash v0.0.0-20211028080628-e2786a622600 // indirect | ||
) |
Oops, something went wrong.