Commit graph

484 commits

Author SHA1 Message Date
Alex Clemmer f21da64f96 Add query mode to the language protocol
`pulumi query` requires that language plugins know about "query mode" so
that they don't do things like try to register the default stack
resource.

To communicate that a language host should boot into query mode, we
augment the language plugin protocol to include this information.
2019-05-02 18:08:08 -07:00
Matt Ellis 8979e301d1 Bump gRPC dependency to 1.20.2
This version has prebuilt binaries for Node 12.
2019-05-01 10:04:27 -07:00
Matt Ellis 9325b6ec61 Add logging to tests 2019-05-01 10:04:27 -07:00
CyrusNajmabadi a602cccc3e
Properly mark members as @internal (#2670) 2019-04-23 19:24:06 -07:00
Sean Gillespie ad32d9d8ac
Plumb provider version through language hosts to engine (#2656)
* NodeJS: allow callers to override provider version

* Python: allow callers to override provider version

* NodeJS: add version for invoke

* Python: add version to invoke

* NodeJS: add tests for ReadResource

* Post-merge cleanup

* update doc comments
2019-04-23 11:02:51 -07:00
Luke Hoban 0550f71a35
Add an ignoreChanges resource option (#2657)
Fixes #2277.

Adds a new ignoreChanges resource option that allows specifying a list of property names whose values will be ignored during updates. The property values will be used for Create, but will be ignored for purposes of updates, and as a result also cannot trigger replacements.

This is a feature of the Pulumi engine, not of the resource providers, so no new logic is needed in providers to support this feature. Instead, the engine simply replaces the values of input properties in the goal state with old inputs for properties marked as ignoreChanges.

Currently, only top level properties may be specified in ignoreChanges. In the future, this could be extended to support paths to nested properties (including into array elements) with a JSONPath/JMESPath syntax.
2019-04-22 13:54:48 -07:00
Joe Duffy 644d5dc916
Enable unit testing for Pulumi programs (#2638)
* Enable unit testing for Pulumi programs

This change enables rudimentary unit testing of your Pulumi programs, by introducing a `PULUMI_TEST_MODE` envvar that, when set, allows programs to run without a CLI. That includes

* Just being able to import your Pulumi modules, and test ordinary functions -- which otherwise would have often accidentally triggered the "Not Running in a CLI" error message
* Being able to verify a subset of resource properties and shapes, with the caveat that outputs are not included, due to the fact that this is a perpetual "dry run" without any engine operations occurring

In principle, this also means you can attach a debugger and step through your code.

* Finish the unit testing features

This change

1) Incorporates CR feedback, namely requiring that test mode be
   explicitly enabled for any of this to work.

2) Implements Python support for the same capabilities.

3) Includes tests for both JavaScript and Python SDKs.

* Add a note on unit testing to the CHANGELOG

* Use Node 8 friendly assert API

* Embellish the CHANGELOG entry a bit
2019-04-16 22:20:01 -07:00
Sean Gillespie 47a2acaa7b
Protobuf changes for provider versioning (#2642)
In pursuit of pulumi/pulumi#2389, this commit adds the necessary changes
to the resource monitor protocol so that language hosts can communicate
exactly what version of a provider should be used when servicing an
Invoke, ReadResource, or RegisterResource. The expectation here is that,
if a language host provides a version, the engine MUST use EXACTLY that
version of a provider plugin in order to service the request.
2019-04-16 10:06:43 -07:00
CyrusNajmabadi 42812f9b28
Work around a legal code pattern that previous versions of TypeScript complain about. (#2631) 2019-04-08 11:21:01 -07:00
CyrusNajmabadi 02f46811db
Add a SxS test for @pulumi/pulumi to help catch when we make breaking changes to core types. (#2610) 2019-03-29 12:27:42 -07:00
CyrusNajmabadi 1f51ec00fc
Revert 'Simplify API for passing providers to a ComponentResource (#2602)' (#2606) 2019-03-28 18:31:03 -07:00
CyrusNajmabadi 49a8e73aa7
Ensure that the values in 'dependsOn' are actually Resources. (#2605) 2019-03-28 17:27:51 -07:00
CyrusNajmabadi 7193622183
Simplify API for passing providers to a ComponentResource (#2602) 2019-03-28 15:04:07 -07:00
CyrusNajmabadi 44150b1fe5
Be resilient to 3rd party libraries placing an __awaiter function on the global object. (#2599) 2019-03-28 11:22:34 -07:00
CyrusNajmabadi fd6ae9cb7e
Suppress further errors at LangHost level if we know the nodejs process reported the errors to the user. (#2596) 2019-03-27 14:40:29 -07:00
CyrusNajmabadi ec05610f2d
Print an unhandled exception as a single error, not multiple errors (#2595) 2019-03-27 12:17:38 -07:00
CyrusNajmabadi 992952b54f
Revert "Better present interpolated strings during preview. (#2564)" (#2593) 2019-03-26 16:36:43 -07:00
Matt Ellis 3621c01f4b Fix spurious warnings when using dynamic provider
When using a dynamic provider, the following messages are printed,
because we did not update the dynamic provider when we added these new
RPCs:

```
Method handler checkConfig for /pulumirpc.ResourceProvider/CheckConfig expected but not provided
Method handler diffConfig for /pulumirpc.ResourceProvider/DiffConfig expected but not provided
```

Given that we don't do anything for the `configure` RPC today, we can
also just no-op these RPCs as well.
2019-03-26 12:04:15 -04:00
CyrusNajmabadi 906488c7d0
Fix issue where we could not serialize an arrow-function with a deconstructed parameter. (#2582) 2019-03-22 16:48:38 -07:00
CyrusNajmabadi be1c3eb05b
Add support for serializing bigints (#2581) 2019-03-22 15:33:37 -07:00
CyrusNajmabadi 02369f9d8a
Allows the nodejs launcher to recognize that certain types of errors were printed, ensuring we don't cascade less relevant messages. (#2554) 2019-03-20 11:54:32 -07:00
Aaron Friel c7eb608c63 Support string literal bounds and return types on Config#get and Config#require (#2570) 2019-03-20 11:52:44 -07:00
CyrusNajmabadi c6d87157d9
Use result.Result in more places. (#2568) 2019-03-19 16:21:50 -07:00
CyrusNajmabadi 718a0c293b
Better present interpolated strings during preview. (#2564) 2019-03-18 17:09:12 -07:00
CyrusNajmabadi aa7f493974
Add checks for common mistake of swapping component/custom resource options. (#2555) 2019-03-13 17:02:17 -07:00
CyrusNajmabadi e3f47308b1
Throw proper error (#2550) 2019-03-13 12:21:33 -07:00
CyrusNajmabadi 9e48fe3126
Add comment explaining structure of error handling code. (#2549) 2019-03-12 15:56:43 -07:00
CyrusNajmabadi 3ba4d1104e
Fix issue causing config errors to be printed twice. (#2547) 2019-03-12 13:35:30 -07:00
Pat Gavlin 7ebd70a3e6
Refresh inputs (#2531)
These changes take advantage of the newly-added support for returning
inputs from Read to update a resource's inputs as part of a refresh.
As a consequence, the Pulumi engine will now properly detect drift
between the actual state of a resource and the desired state described
by the program and generate appropriate update or replace steps.

As part of these changes, a resource's old inputs are now passed to the
provider when performing a refresh. The provider can take advantage of
this to maintain the accuracy of any additional data or metadata in the
resource's inputs that may need to be updated during the refresh.

This is required for the complete implementation of
https://github.com/pulumi/pulumi-terraform/pull/349. Without access to
the old inputs for a resource, TF-based providers would lose all
information about default population during a refresh.
2019-03-11 13:50:00 -07:00
CyrusNajmabadi 82c4df84e5
Make test resilient to different node loading orders (#2525) 2019-03-06 12:17:24 -08:00
CyrusNajmabadi d6d839608b
Tweak signature of .apply to help TS infer things better. (#2520) 2019-03-06 01:53:58 -08:00
CyrusNajmabadi 7f5e089f04
Update @pulumi/pulumi to version 0.17.0 (#2510)
This update includes several changes to core `@pulumi/pulumi` constructs that will not play nicely
in side-by-side applications that pull in prior versions of this package.  As such, we are rev'ing
the minor version of the package from 0.16 to 0.17.  Recent version of `pulumi` will now detect,
and warn, if different versions of `@pulumi/pulumi` are loaded into the same application.  If you
encounter this warning, it is recommended you move to versions of the `@pulumi/...` packages that
are compatible.  i.e. keep everything on 0.16.x until you are ready to move everything to 0.17.x.

### Improvements

- `Output<T>` now 'lifts' property members from the value it wraps, simplifying common coding patterns.  Note: this wrapping only happens for POJO values, not `Output<Resource>`s. 

- Depending on a **Component** Resource will now depend on all other Resources parented by that
  Resource. This will help out the programming model for Component Resources as your consumers can
  just depend on a Component and have that automatically depend on all the child Resources created
  by that Component.  Note: this does not apply to a **Custom** resource.  Depending on a
  CustomResource will still only wait on that single resource being created, not any other Resources
  that consider that CustomResource to be a parent.
2019-03-05 17:06:57 -08:00
Pat Gavlin 905e7353e4
Update the provider RPC interface (#2512)
These changes add two new methods to the provider interface and extend
the results of three others.

The new methods are `CheckConfig` and `DiffConfig`, which fill out the
set of methods required for a complete implementation of the
first-class provider design. Though these methods are optional for
backwards compatibility, they should be implemented by all future
providers for the best possible user experience.

The adjusted result types are `DiffResponse`, `ReadResponse`, and
`ErrorResourceInitFailed`. The first has been updated to include a list
of the properties that changed (if any). The latter two now include
an estimated set of inputs for the resource as well as the resource's
state. Together, these three changes enable the engine to determine the
set of inputs that should be specified by a user in order to match those
that describe the resource's current state.

This contributes to #2453, #1662, #1635, and #1718.
2019-03-05 10:49:24 -08:00
CyrusNajmabadi 0117c1c01d
Turn off warning for toString/toJSON on an Output (#2507) 2019-03-04 12:03:18 -08:00
CyrusNajmabadi 66ada50ccf
Do a version check and emit a warning if major/minor versions of @pulumi/pulumi do not match. (#2503) 2019-03-01 17:43:26 -08:00
CyrusNajmabadi 4cb6475dc4
Can't change this name as SxS versions of pulumi may expect the old name. (#2500) 2019-02-28 16:18:01 -08:00
CyrusNajmabadi df743178bd
Missed this case. (#2499) 2019-02-28 15:29:28 -08:00
CyrusNajmabadi 3bb8759b23
Implement rtti checks more consistently (#2498) 2019-02-28 14:56:35 -08:00
CyrusNajmabadi 3d1df982de
Incorrect closure serialization when object referenced through different functions. (#2497) 2019-02-28 11:11:43 -08:00
CyrusNajmabadi aa3c6d0ba6
Converting an Output to a string or JSON now produces a warning . (#2496) 2019-02-27 16:00:54 -08:00
CyrusNajmabadi 0d2d1eb61a
Rolling back toString/toJSON change (#2495)
* Revert "Make toString and toJSON internal (#2489)"

This reverts commit 7579b84f73.

* Revert "Update error message to point at docs. (#2488)"

This reverts commit 9156c26a2e.

* Revert "Throw on Output.toString and toJSON (#2486)"

This reverts commit c33b4505c0.
2019-02-27 14:53:56 -08:00
CyrusNajmabadi 93defd4b90
Rollback waiting on children of a component when waiting on the component. (#2492) 2019-02-27 12:41:44 -08:00
CyrusNajmabadi 7579b84f73
Make toString and toJSON internal (#2489) 2019-02-27 02:15:36 -08:00
CyrusNajmabadi 9156c26a2e
Update error message to point at docs. (#2488) 2019-02-27 01:45:26 -08:00
CyrusNajmabadi c33b4505c0
Throw on Output.toString and toJSON (#2486) 2019-02-26 19:24:21 -08:00
CyrusNajmabadi 0beab1bc37
test_all for the sdk should run test_fast tests. (#2485) 2019-02-26 14:12:43 -08:00
CyrusNajmabadi c53f697a6f
Fix deadlock when waiting for transitive dependencies (#2471) 2019-02-24 12:14:16 -08:00
CyrusNajmabadi 967c6407a0
Revert "Simplify how we export the .all operator (#2467)" (#2469)
This reverts commit 93c9464125.
2019-02-23 19:54:28 -08:00
CyrusNajmabadi 93c9464125
Simplify how we export the .all operator (#2467) 2019-02-22 12:02:52 -08:00
CyrusNajmabadi 27b04c4c62
Have child resources update their parent urn to include themselves in its dependencies. (#2299) 2019-02-21 20:18:29 -08:00