pulumi/pkg
Will Jones 4e90fcb781 Implement the `CreateIfNotExists` resource option
This commit implements `CreateIfNotExists`, a new resource option that
allows programs to specify resource options that should be created only
if they do not already exist in the provider. Use cases for this feature
include "global" or shared resources, such as AWS service-linked
providers within an account, or SSL policies within a GCP
account/project. `CreateIfNotExists` behaves as follows:

* The option accepts an ID, much like `Import`, that will be used to
  determine whether or not a resource exists using a `Read` operation.
  If it does, resource inputs must match as they would be required to in
  an ordinary import. If not, the resource is created as usual.

* Due to the semantics specified above, it is an error to specify both
  `CreateIfNotExists` and `Import` resource options on a single
  resource.

The "if not exists" part is handled by a provider `Read` call that we
make in step generation. This is not ideal, since we'd like step
generation to be non-blocking (and `Read` could block for an arbitrary
amount of time). However, there aren't many other good options for
achieving this:

* Source evaluation would be a good middle ground, but this would
  require changing the contract of `Read`/introducing another call since
  we do not have a URN at this point.
* Parallelising step generation (see e.g. #15026). This is the "best"
  outcome and feels the most correct, but carries a large amount of risk.

There _are_ instances of us breaking this rule (not blocking in step
generation) already (e.g. `Check` and `Diff`, which "should" be fast but
in reality could do anything they like), and the hypothesis is that
there won't be many resources with this option in a given stack, so this
feels like an acceptable compromise.

A set of lifecycle tests capturing `CreateIfNotExists`' interactions
with existing resource options and scenarios are included. This commit
does not include SDK updates to use the new option; these will be
introduced in future changesets.

Part of #16189
2024-07-02 17:27:42 +01:00
..
asset Move some asset code to pkg (#15162) 2024-01-17 11:30:37 +00:00
authhelpers Add tests for gcpauth pkg (#13926) 2023-09-13 11:27:03 +00:00
backend Implement the `CreateIfNotExists` resource option 2024-07-02 17:27:42 +01:00
cmd/pulumi [engine/import] Guess references to properties between dependant resources during import (#16234) 2024-07-02 10:02:31 +00:00
codegen Fix Python program generation for remote assets (#16556) 2024-07-02 13:34:10 +00:00
display Move sdk/go/common/display to /pkg/display (#13954) 2023-09-18 11:01:28 +00:00
engine Implement the `CreateIfNotExists` resource option 2024-07-02 17:27:42 +01:00
graph Adds a flag to graph command to insert fragment (#14858) 2024-01-08 22:03:08 +00:00
importer [engine/import] Guess references to properties between dependant resources during import (#16234) 2024-07-02 10:02:31 +00:00
operations Move resource.URN to urn.URN (#15689) 2024-03-14 15:28:32 +00:00
resource Implement the `CreateIfNotExists` resource option 2024-07-02 17:27:42 +01:00
secrets cloud backend test: retry creating secrets manager (#16494) 2024-06-27 04:33:56 +00:00
testing/integration Add packagemanager prompt to pulumi new for nodejs (#16417) 2024-06-21 11:35:06 +00:00
util [cli/plugin] Fix plugin install command when plugin type is tool (#16407) 2024-06-17 13:25:57 +00:00
version duplicate version to ensure linking is properly handled 2020-03-19 12:49:34 -07:00
workspace Refactor: move plugin kind to apitype (#15946) 2024-04-25 17:30:30 +00:00
README.md export codegen tests for internal use (#8928) 2022-02-07 12:10:04 +01:00
go.mod Changelog and go.mod updates for v3.122.0 (#16551) 2024-07-02 07:54:27 +00:00
go.sum update pulumi-yaml to 1.9.0 (#16530) 2024-06-28 23:14:58 +00:00

README.md

pulumi/pkg

While pulumi/sdk maintains strict backwards compatibility guarantees, code under pkg/ is handled more informally: while breaking changes are still discouraged they may happen when they make sense.