Commit graph

11 commits

Author SHA1 Message Date
Levi Blackstone 1c87d58b4a
Fix bug with ComponentResource resource refs (#5949)
Now that resources are serialized as refs, ComponentResources
may try to unmarshal local resource refs before they are
initialized during the RegisterResource step.

This change avoids that issue by skipping Output marshaling
for local ComponentResources during the RegisterResource step.
These Outputs will be handled instead during the
RegisterResourceOutputs step.

Co-authored-by: Pat Gavlin <pat@pulumi.com>
2020-12-18 14:45:52 -07:00
Pat Gavlin 860ea4dc84
Add ignoreChanges preprocessing in ImportStep. (#5976)
The step generator applies `ignoreChanges` pre-processing for all
resources by copying old input values to the new goal for any properties
mentioned in the `ignoreChanges` list. However, this pre-processing
depends on the existence of prior inputs, which by definition does not
exist for a resource being imported prior to the issuance of the
`ImportStep`. These changes add this processing to the implementation of
`ImportStep`, using the inputs read from the provider as the prior
inputs.
2020-12-17 14:46:50 -08:00
Pat Gavlin 9b6a7a4397
Improve resource ref unit tests. (#5960)
- Add component ref coverage to the existing test
- Add coverage for a downlevel SDK communicating with an engine that
  supports resource refs
- Add coverage for a downlevel engine communicating with an SDK that
  supports resource refs

As part of improving coverage, these changes add a knob to explicitly
disable resource refs in the engine without the use of the environment
variable. The environment variable is now only read by the CLI, and has
been restored to its prior polarity (i.e. `PULUMI_ENABLE_RESOURCE_REFERENCES`).
2020-12-16 12:38:20 -08:00
Komal a75f63edb5
Fix linting. (#5954) 2020-12-15 17:56:42 -08:00
Pat Gavlin 20743f7be3
Split engine unit tests into individual files. (#5951)
Each file covers a particular feature. These changes are intended to
make the tests easier to navigate.
2020-12-15 14:24:46 -08:00
Pat Gavlin 807b09d6a6
Fix a few issues with resource references. (#5804)
- Differentiate between resource references that have no ID (i.e. because
  the referenced resource is not a CustomResource) and resource references
  that have IDs that are not known. This is necessary for proper
  backwards-compatible serialization of resource references.
- Fix the key that stores a resource reference's package version in the
  .NET, NodeJS, and Python SDKs.
- Ensure that the resource monitor's marshalling/unmarshalling  of inputs
  and outputs to/from calls to `Construct` retain resource references as
  appropriate.
- Fix serialization behavior for resources -> resource references in the
  Go SDK: if a resource's ID is unknown, it should still be serialized
  as a resource reference, albeit a reference with an unknown ID.
2020-11-23 11:15:10 -08:00
Pat Gavlin 1e0c9efdd7
Respect provider config secretness. (#5742)
Just what it says on the tin. This is implemented by changing the
`GetPackageConfig` method of `ConfigSource` to return a `PropertyMap`
and ensuring that any secret config is represented by a `Secret`.
2020-11-12 12:18:12 -08:00
Pat Gavlin 0ec12d01f9
Create a builtin provider during import. (#5730)
`pulumi import` may otherwise fail if there are providers in the
statefile.
2020-11-10 21:11:30 -08:00
Pat Gavlin 696cff10ec
Add engine support for getResource. (#5646)
The langauge SDKs will use this function to fetch the state required to
deserialize a resource reference. SDK support will be added as a follow-up
change.

Contributes to #2430.
2020-11-02 13:36:12 -08:00
Pat Gavlin 3d2e31289a
Add support for serialized resource references. (#5041)
Resources are serialized as their URN, ID, and package version. Each
Pulumi package is expected to register itself with the SDK. The package
will be invoked to construct appropriate instances of rehydrated
resources. Packages are distinguished by their name and their version.

This is the foundation of cross-process resources.

Related to #2430.

Co-authored-by: Mikhail Shilkov <github@mikhail.io>
Co-authored-by: Luke Hoban <luke@pulumi.com>
Co-authored-by: Levi Blackstone <levi@pulumi.com>
2020-10-27 10:12:12 -07:00
Pat Gavlin eaac9280f5
Refactor lifecycle tests. (#5575)
Move these tests to a new package, `lifecycletest`, that also exposes
APIs that allow consumers to implement their own lifecycle tests. This
is intended to ease the burden of testing plugin implementations and to
set the stage for cleaning up the lifecycle tests themselves.

This involves two changes to the public API, only one of which is
strictly necessary:

- The `host` field of `UpdateOptions` is now exported
- The `Journal` type has been moved from test-only code to the package
  proper

The former change is necessary, as it is the mechanism by which package
consumers may inject their own plugin loaders. I was reluctant to expose
this field originally because I wanted to ensure that the behavior of
packages that embed Pulumi is consistent with that of the Pulumi CLI
with respect to plugin loading. I now believe that the risk of consumers
changing this behavior outside of test scenarios is low enough that we
can expose this field. This may also be useful for future scenarios,
e.g. statically linking providers and Pulumi programs.

The latter change is not necessary, but fleshes out the engine package
into a more complete toolkit. Downstream consumers may use the Journal
type to conveniently implement snapshotting.
2020-10-15 10:35:09 -07:00