Commit graph

839 commits

Author SHA1 Message Date
Mike Chen 256e8284d0
[automation] - Add diff to up and preview in automation API (#6413)
Co-authored-by: Mike Chen <mikechen@ip-192-168-1-8.ec2.internal>
2021-02-23 17:38:28 -08:00
Komal 8b665f7131
[automation] - Remove summary from PreviewResult (#6405) 2021-02-23 17:07:16 -08:00
Komal 5f4e687a1d
[automation] - Consume config set-all and rm-all commands (#6388) 2021-02-19 22:59:18 -08:00
Luke Hoban f7397bb798
[sdk/nodejs] Skip re-registrations of same package+version (#6387)
It is possible for the same version of the same provider SDK to be loaded multiple times in Node.js.  In this case, we might legitimately get mutliple registrations of the same resource.  It should not matter which we use, so we can just skip re-registering.  De-serialized resources will always be instances of classes from the first registered package.

Example layout this addresses.  Registrations of resources in `package3` at the same verrsion.

`node_modules`
  `@pulumi/pulumi`
  `package1`
    `node_modules`
      `package3`
  `package2`
    `node_modules`
      `package3`

Fixes #6258.
2021-02-20 10:06:32 +11:00
Komal a6b6437b49
[Automation] Fix python nested config parsing (#6349) 2021-02-17 10:16:35 -08:00
Justin Van Patten 0fe4978a7a
[sdk/nodejs] Update @grpc/grpc-js dependency (#6341) 2021-02-16 08:46:32 -08:00
Evan Boyle 8e58f5d682
Add pagination to pulumi stack history (#6292)
replaces the unreleased `--limit` flag with `--page` and `--page-size` to support full pagination
2021-02-09 16:20:01 -08:00
Evan Boyle eefc104c2b
Add --limit flag to pulumi stack history and consume from automation api (#6257)
Adds a `--limit` flag to `pulumi stack history. This allows limiting to the last few entries rather than fetching the entirety of a stack's update history (which can be quite slow for stacks with lots of updates). Example: `pulumi stack history --limit 1` fetches the last history entry only. 

`stack.up` and related operations in the Automation API have been updated to consume this change, drastically reducing overhead.
2021-02-08 10:49:57 -08:00
Evan Boyle decfed0679
Improve nodejs automation api inline error handling (#6237) 2021-02-02 14:37:03 -08:00
Evan Boyle 8c6865af29
Always read and write nodejs runtime options from/to the environment (#6076) 2021-01-26 14:59:32 -08:00
Luke Hoban 6a598bd704
Avoid toStringing Output in debuggablePromise (#6174)
Promise leak debugging was accidentally toStringing an Output, leading to a red herring for several users trying to understand what was causing promise leaks.

Related to #6153 and #5853.
2021-01-27 05:52:09 +11:00
Paul Stack ae9a6db36e
Add the ability to pulumi.unsecret an existing output (#6086)
Related: #5653

This will take an existing output and then unwrap the secret, and
return a new output

```
import * as pulumi from "@pulumi/pulumi";

const x = pulumi.secret("test")
export const xVal = x;

const y = pulumi.unsecret(x);
export const yVal = y;
```

```
▶ pulumi stack output
Current stack outputs (3):
    OUTPUT         VALUE
    xVal           [secret]
    yVal           test
```

Also adds the ability to check if an output is as secret:

```
import * as pulumi from "@pulumi/pulumi";

const x = pulumi.secret("test")
const isSecret = x.isSecret;

export const isSecretDeets = isSecret;
```
2021-01-14 20:36:52 +00:00
Komal 059402483b
[Automation API] Python Implementation (#5979)
Co-authored-by: evanboyle <evan@pulumi.com>
2021-01-12 16:55:59 -08:00
Roderik van der Veer f5c65c18e8
fix: typo to get the outputs while registering them in a mock (#6040)
Resolves: #6039
2021-01-12 10:49:39 -08:00
Komal 8e8129012e
[automation-api/nodejs] - Support recovery workflow (#6038) 2021-01-04 16:45:57 -08:00
Komal 1ef22c375d
Revert bulk config ops in nodejs auto-api (#6051) 2021-01-04 14:38:55 -08:00
Paul Stack ee776b3c33
Update PulumiStackType comments in dotnet and nodejs (#6028) 2020-12-30 23:02:18 +00:00
Luke Hoban 1ef2f10543
Allow serializeFunction to capture secrets (#6013)
Adds an opt-in `allowSecrets` flag to `serializeFunction` to allow it to capture secrets.  If passed, `serializeFunction` will now report back whether it captured any secrets.  This information can be used by callers to wrap the resulting text in a Secret value.

Fixes #2718.
2020-12-31 09:37:25 +11:00
Komal bc76068ae4
[auto/nodejs] - Parallelize config operations (#6022) 2020-12-29 15:40:22 -08:00
Pat Gavlin 23927e4bb1
Use beforeEach in NodeJS tests. (#5975)
Call `runtime._reset` prior to each test to ensure that the runtime is
in a consistent state.

Co-authored-by: Lee-Ming Zen <lee@pulumi.com>
2020-12-18 16:27:27 -08:00
Pat Gavlin 05a922b431
Add NodeJS resource ref unit tests. (#5969)
These tests cover the same scenarios that are coverted in the engine's
unit tests, but exercise the Node SDK's marshalling paths.

These changes include a few enhancements to the Node SDK's test APIs
that make it easier to more precisely control its behavior, and extend
the `Mocks` interface to allow the registration of component resources
to work properly.

Contributes to #5943.
2020-12-17 10:49:22 -08:00
Evan Boyle 268abea53b
bump nodejs test timeout for automation api (#5966) 2020-12-16 12:47:15 -08:00
Levi Blackstone 4d48ee0517
Enable resource reference feature by default (#5905)
* Enable resource reference feature by default

Unless the PULUMI_DISABLE_RESOURCE_REFERENCES flag
is explicitly set to a truthy value, the resource reference feature is now
enabled by default.

* Set AcceptResources in the language SDKs

This can be disabled by setting the `PULUMI_DISABLE_RESOURCE_REFERENCES` environment variable to a truthy value.

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2020-12-10 11:21:05 -07:00
Justin Van Patten 918615f072
[sdk/nodejs] Implement getResource in the mock monitor (#5914)
Otherwise, unit tests for programs that reference resources that have been registered with `registerResourceModule` fail with unhandled exceptions.
2020-12-10 09:30:34 -08:00
Justin Van Patten 4747be7b9f
[sdk/nodejs] Use log.error to log uncaught errors (#5910)
`log.error` will call the engine's `log` gRPC endpoint (if the engine is available; otherwise it will write to `console.error`) with `LogSeverity.ERROR`, which tell the engine to stop processing further resource operations.

Without this, any uncaught errors (such as input validation errors done inside `apply`) would be written to stderr, but wouldn't actually result in an update error.
2020-12-10 08:53:25 -08:00
Justin Van Patten 5ab051cd97
Implement GetRequiredPlugins for Python (#5787)
Implement GetRequiredPlugins for Python, which determines the plugins
required by the program.

Also, if the `virtualenv` runtime option is set, and the specified
virtual directory is missing or empty, automatically create it and
install dependencies into it.
2020-12-03 19:22:16 -08:00
Justin Van Patten c27d2921c1
Remove console.log call (#5845)
Remove console.log call that's adding unnecessary diagnostic messages to programs that use multi-lang components.
2020-12-01 16:35:30 -08:00
Justin Van Patten edc79325fe
Add support for getResource to Node.js SDK (#5837)
And update Node's resource ref deserialization to match Python.

Also, fixed a bug in Python resource ref deserialization that I noticed.
2020-12-01 10:58:15 -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
Justin Van Patten 4aab74afc7
Fix bug calling Provider.read (#5716)
The call to `read` wasn't passing the URN. Also delete a comment that doesn't apply here.
2020-11-09 08:48:19 -08:00
Pat Gavlin 44376738f6
Add resource modules. (#5645)
This is necessary due to the way we've factored the libraries imported
by users into modules. The primary alternative is to ensure that each
child module imports the root module for a package and registers itself
with that package where necessary to prevent circular dependencies. This
simplifies the core SDKs slightly at the cost of greater complications
in the generated SDKs; the approach taken by these changes seems like a
more maintainable option.

Contributes to #2430.

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2020-11-04 10:24:41 -08:00
Lee Briggs 4d96994fd1
switch uuid packages (#5608)
Co-authored-by: Pat Gavlin <pat@pulumi.com>
2020-11-04 03:13:04 +00: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
Komal ec9c02f578
Add tests for ts enums (#5605) 2020-10-22 10:53:29 -07:00
Komal 6949101428
Replace equal and deepEqual with strictEqual and deepStrictEqual (#5607) 2020-10-21 10:21:47 -07:00
Pat Gavlin 89c71bb49e
[cli] Add an import command. (#4765)
Co-authored-by: stack72 <public@paulstack.co.uk>
2020-10-14 12:51:53 +01:00
Pat Gavlin 249140242e
Add support for provider-side preview. (#5443)
These changes add support for provider-side previews of create and
update operations, which allows resource providers to supply output
property values for resources that are being created or updated during a
preview.

If a plugin supports provider-side preview, its create/update methods
will be invoked during previews with the `preview` property set to true.
It is the responsibility of the provider to fill in any output
properties that are known before returning. It is a best practice for
providers to only fill in property values that are guaranteed to be
identical if the preview were instead an update (i.e. only those output
properties whose values can be conclusively determined without
actually performing the create/update operation should be populated).
Providers that support previews must accept unknown values in their
create and update methods.

If a plugin does not support provider-side preview, the inputs to a
create or update operation will be propagated to the outputs as they are
today.

Fixes #4992.
2020-10-09 13:13:55 -07:00
Evan Boyle b86e6ae93e
add plugin management utils to node Automation API (#5536) 2020-10-09 09:03:03 -07:00
evanboyle 42f301ac0f bump node test timeout 2020-10-08 12:19:01 -07:00
evanboyle 39297cb9dd make public declarations implicit 2020-10-08 12:19:01 -07:00
evanboyle 7b766924ec update error strategy to be more idiomatic 2020-10-08 12:19:01 -07:00
evanboyle 97e1d25802 update doc formatting 2020-10-08 12:19:01 -07:00
evanboyle 73a5516958 prefer interfaces over types for object-like specs 2020-10-08 12:19:01 -07:00
evanboyle 9f4461db37 Node Automation API tsdoc 2020-10-08 12:19:01 -07:00
evanboyle 84136e2271 mark exports as internal where appropriate 2020-10-08 12:19:01 -07:00
evanboyle 99574ff555 node automation api structured error design 2020-10-08 12:19:01 -07:00
evanboyle 631e6cbaf1 improve typing for UpdateSummary timestamps, WhoAmI results 2020-10-08 12:19:01 -07:00
evanboyle 2d49cabf68 simplify project and stack settings impl 2020-10-08 12:19:01 -07:00
evanboyle cf194bff4b remove parallelism from node automation api operations 2020-10-08 12:19:01 -07:00
evanboyle 848086fa26 remove stack property getters 2020-10-08 12:19:01 -07:00
evanboyle e77fc0a961 only expose static create methods (and overloads) for Stack and LocalWorkspace 2020-10-08 12:19:01 -07:00
evanboyle 6f622bc9e1 fix test mode, test mode tests 2020-10-08 12:19:01 -07:00
evanboyle 66a71f2bab cleanup automation api host runtime settings post-run, fix tests 2020-10-08 12:19:01 -07:00
evanboyle 7d171917ea support inline programs for nodejs automation api 2020-10-08 12:19:01 -07:00
evanboyle b902472a03 add static LocalWorkspace methods for New/Select/Upsert Stack w/ local and inline programs 2020-10-08 12:19:01 -07:00
evanboyle 5380223c28 bump test timeout 2020-10-08 12:19:01 -07:00
evanboyle 234f6a1707 up/preview/refresh/destroy 2020-10-08 12:19:01 -07:00
evanboyle 435018676e Stack status methods 2020-10-08 12:19:01 -07:00
evanboyle 87e5b6f5eb Stack.runPulumiCmd 2020-10-08 12:19:01 -07:00
evanboyle 6a29404db2 LocalWorkspace list stacks and current stack 2020-10-08 12:19:01 -07:00
evanboyle 0420d38354 LocalWorkspace and Stack config 2020-10-08 12:19:01 -07:00
evanboyle d7ea6a089b Stack Create/Select/Upsert 2020-10-08 12:19:01 -07:00
evanboyle 0062292e3b complete LocalWorkspace stub 2020-10-08 12:19:01 -07:00
evanboyle 5c220c192a LocalWorkspace create/select/remove stack 2020-10-08 12:19:01 -07:00
evanboyle 112720702a LocalWorkspace.stackSettings() tests 2020-10-08 12:19:01 -07:00
evanboyle 946c12c891 continue LocalWorkspace impl, add runPulumiCmd 2020-10-08 12:19:01 -07:00
evanboyle 06b89e6151 LocalWorkspace.StackSettings() 2020-10-08 12:19:01 -07:00
evanboyle 2ace0b0234 StackSettings 2020-10-08 12:19:01 -07:00
evanboyle faafb6b157 LocalWorkspace.saveProjectSettings() 2020-10-08 12:19:01 -07:00
evanboyle fa388380c4 LocalWorkspace.projectSettings() 2020-10-08 12:19:01 -07:00
evanboyle ebdd3c1053 project settings 2020-10-08 12:19:01 -07:00
evanboyle 36d10773cc Workspace interface 2020-10-08 12:19:01 -07:00
Justin Van Patten 9bcf02e7ed
Support remote components in Python (#5375) 2020-09-30 14:09:20 -07:00
Lee Briggs 95bc138b41
add master branch workflow (#5386) 2020-09-21 16:20:05 -07:00
Justin Van Patten 11752af5d7
Fix typo in Node.js dynamic provider GRPC service (#5365) 2020-09-15 05:45:06 -07:00
Justin Van Patten 46c7c327dd
Install plugin dependencies (#5353)
When installing a plugin, if it contains a `PulumiPlugin.yaml` file with a `runtime` value of `nodejs` or `python`, install dependencies for the plugin.

For Node.js, `npm install` is run (or `yarn install` if `PULUMI_PREFER_YARN` is set).

For Python, a virtual environment is created and deps installed into it.
2020-09-14 13:54:26 -07:00
Justin Van Patten 80a52d383e
Simplify type assertion in unwrap.spec.ts (#5311) 2020-09-09 14:22:54 -07:00
Lee Briggs 0ac075ef8f
add initial pull-request workflow (#5276)
* add initial pull-request workflow

* run SDK test all

* add SDK tests

* fixup make targets

* add dist target

* revert back to 5 updates

* disable test

* add issue for test disabling
2020-09-09 13:37:03 -07:00
Pat Gavlin 2585b86aa4
Initial support for remote component construction. (#5280)
These changes add initial support for the construction of remote
components. For now, this support is limited to the NodeJS SDK;
follow-up changes will implement support for the other SDKs.

Remote components are component resources that are constructed and
managed by plugins rather than by Pulumi programs. In this sense, they
are a bit like cloud resources, and are supported by the same
distribution and plugin loading mechanisms and described by the same
schema system.

The construction of a remote component is initiated by a
`RegisterResourceRequest` with the new `remote` field set to `true`.
When the resource monitor receives such a request, it loads the plugin
that implements the component resource and calls the `Construct`
method added to the resource provider interface as part of these
changes. This method accepts the information necessary to construct the
component and its children: the component's name, type, resource
options, inputs, and input dependencies. It is responsible for
dispatching to the appropriate component factory to create the
component, then returning its URN, resolved output properties, and
output property dependencies. The dependency information is necessary to
support features such as delete-before-replace, which rely on precise
dependency information for custom resources.

These changes also add initial support for more conveniently
implementing resource providers in NodeJS. The interface used to
implement such a provider is similar to the dynamic provider interface
(and may be unified with that interface in the future).

An example of a NodeJS program constructing a remote component resource
also implemented in NodeJS can be found in
`tests/construct_component/nodejs`.

This is the core of #2430.
2020-09-07 19:33:55 -07:00
Justin Van Patten 3601d710cc
Work around TS compiler error (#5148) 2020-08-11 06:35:12 -07:00
Trung Lê 4362744a7d
Fix typo (#5153) 2020-08-11 12:12:24 +01:00
Levi Blackstone 736019f7ce
Add support for streamInvoke during update (#4990)
Previously, streamInvoke was only supported by
the query command. Copied the implementation
into the resource monitor, which will allow
streaming invoke commands to run during updates.

Also fixed a bug with cancellation of streaming
invokes. The check was comparing against a
hardcoded string, which did not match the actual
error string. Instead, we can rely on the error code.
2020-07-10 10:56:35 -06:00
stack72 9e33449245 Ensuring references to v2 pulumi packages are up to date 2020-06-17 14:54:05 +03:00
Justin Van Patten 6b0a845cc1
Support publishing Python policy packs (#4644)
Adds support for publishing Python policy packs to the service, and downloading/using such policy packs when applied to stacks in an organization.
2020-05-22 15:01:15 -07:00
Lee Briggs 8c314ec39a
Add brew make targets to sdk makefiles 2020-05-13 20:42:01 -07:00
Luiz Ferraz 2bfef6f4d7
Allows conditional dependencies and Resources from apply (#4446) 2020-05-08 17:57:08 -07:00
Justin Van Patten c501709317
Avoid TS compiler error (#4572) 2020-05-05 14:22:29 -07:00
Pat Gavlin 9b1b9cca24
Makefile: properly encode dependencies (#4541)
This allows for the use of `make -j`, which speeds up a full build
dramatically at the cost of rather incomprehensible logs.
2020-05-04 14:26:52 -07:00
komal 2776a80a14 remove unneeded types 2020-04-23 17:58:17 -07:00
komal 28d69e963e add tests for node and python 2020-04-23 11:16:36 -07:00
Komal Ali 066e27766c add explanation of constant 2020-04-23 11:16:36 -07:00
Komal Ali 9cf635ad5a pr changes 2020-04-23 11:16:36 -07:00
Komal Ali cc96df7485 update channel options in go 2020-04-23 11:16:36 -07:00
Komal Ali 64f3c4a02a update sdks with new max message size 2020-04-23 11:16:36 -07:00
CyrusNajmabadi 66bd3f4aa8
Breaking changes due to Feature 2.0 work
* Make `async:true` the default for `invoke` calls (#3750)

* Switch away from native grpc impl. (#3728)

* Remove usage of the 'deasync' library from @pulumi/pulumi. (#3752)

* Only retry as long as we get unavailable back.  Anything else continues. (#3769)

* Handle all errors for now. (#3781)


* Do not assume --yes was present when using pulumi in non-interactive mode (#3793)

* Upgrade all paths for sdk and pkg to v2

* Backport C# invoke classes and other recent gen changes (#4288)

Adjust C# generation

* Replace IDeployment with a sealed class (#4318)

Replace IDeployment with a sealed class

* .NET: default to args subtype rather than Args.Empty (#4320)

* Adding system namespace for Dotnet code gen

This is required for using Obsolute attributes for deprecations

```
Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'ObsoleteAttribute' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj]
Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'Obsolete' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj]
```

* Fix the nullability of config type properties in C# codegen (#4379)
2020-04-14 09:30:25 +01:00
Justin Van Patten 8c065b34ff
Remove unnecessary import (#4350) 2020-04-09 14:13:16 -07:00
Pat Gavlin 2f22c1c59c
HCL2 updates (#4309)
Pulumi HCL2 IR:
- Add support for invokes
- Add support for resource options, incl. ranged resources
- Allow the apply rewriter to ignore promise-typed values
- Add tests for the binder
- Add support functions for TF: entries and range

NodeJS codegen:
- Simplify for expression codegen
- Add support for invoke codegen
- Add support for entries and range functions
- Add tests

Python codegen:
- Implement codegen for most expression types
- Add support for invoke codegen
- Add tests
2020-04-06 19:43:16 -07:00
Levi Blackstone d363be9de0
Propagate additionalSecretOutputs opt to Read in NodeJS (#4307) 2020-04-06 15:50:52 -06:00
Mikhail Shilkov 6d32d575e0
Enable features in mock monitor (#4272) 2020-04-03 08:33:40 +02:00
Justin Van Patten dd104a00a7
Propagate secretness correctly in Python apply (#4273)
* Propagate secretness correctly in Python `apply`

* Improve `apply` test coverage

* Update CHANGELOG.md
2020-04-02 13:01:29 -07:00
Luke Hoban 8826fe4857
Fix Node.js SxS checks for 1.x and 1.y (#4235)
Fixes #4234
2020-03-30 15:10:42 -07:00
Justin Van Patten e6be38e285
PaC: Add initial config support for policy packs (#4233)
The initial config represents any config that was specified programmatically to the Policy Pack, for Policy Packs that support programmatic configuration like AWSGuard.
2020-03-30 12:52:05 -07:00
Luke Hoban 738c6eac5b
Allow pulumi/pulumi 1.x and 2.x to be used SxS (#4161)
Fixes #4079.
2020-03-24 21:59:25 -07:00
evanboyle d93017dbde Revert "move sdk/nodejs/cmd/pulumi-language-nodejs -> pkg/cmd/pulumi-language-nodejs"
This reverts commit a73044247e.
2020-03-18 17:12:55 -07:00
evanboyle 30df499838 move pkg/version -> sdk/go/common/version 2020-03-18 15:25:25 -07:00
evanboyle a73044247e move sdk/nodejs/cmd/pulumi-language-nodejs -> pkg/cmd/pulumi-language-nodejs 2020-03-18 12:25:07 -07:00
Luke Hoban fdd9a57ff8
Implement GetSchema in dynamic providers (#4083)
It's not entirely clear why gRPC doesn't already report these cleanly as unimplemented, but for now we'll explicitly implement them to avoid any spurious warnings.

Fixes #4028.
2020-03-15 15:36:08 -07:00
Mikhail Shilkov 8f1534c895
Mention mocks in the missing project error (#4041) 2020-03-09 16:23:49 +01:00
Justin Van Patten 80f6c61310
Initial support for configuring policies (#4015) 2020-03-08 14:11:55 -07:00
Luke Hoban d9a18f0aa8
Revert back to ts-node ^7.0.0 (#4007)
We upgraded to `ts-node@^8.0.0`  2.5 months ago as part of https://github.com/pulumi/pulumi/pull/3627, though it seems it wasn't really necessary to make that update for the purposes of the PR - updating the default TypeScript version.

The `8.0.0` series of `ts-node` unfortunately dropped all of it's caching support, due to what appear to be some corner-case correctness issues with the cache.  We have not seen reports of those issues for Pulumi, and have much more experience with the `7.0.0` series overall (2 years vs. 2 months).  The performance difference between `7.0.0` and `8.0.0` of ts-node for Pulumi is massive - it adds 4-4.5s to each of `pulumi preview` and `pulumi up` even on a trivial program.

As a result, for now we will revert back to `ts-node@^7.0.0`.  In the future, we may want to look into our own caching layer or alternative to `ts-node` to ensure we get the behaviour and performance we expect.

Part of #3671.
2020-03-02 08:33:01 -08:00
James Nugent 60eeff3265
Merge pull request #3990 from pulumi/jen20/main-dockerfile-for-proto
Update gRPC library used in Go SDKs and regenerate code with latest tools
2020-02-29 12:46:46 +00:00
Pat Gavlin 682dced40b
Mock resource monitor (#3738)
These changes add support for mocking the resource monitor to the NodeJS
and Python SDKs. The proposed mock interface is a simplified version of
the standard resource monitor that allows an end-user to replace the
usual implementations of ReadResource/RegisterResource and Invoke with
their own. This can be used in unit tests to allow for precise control
of resource outputs and invoke results.
2020-02-28 17:22:50 -08:00
James Nugent a1b55192dd Regenerate protocol buffers code 2020-02-28 11:53:47 +00:00
Pat Gavlin ccde31b713
Add support for extracting schemas from providers. (#3984)
These changes add a new method to the resource provider gRPC interface,
`GetSchema`, that allows consumers of these providers to extract
JSON-serialized schema information for the provider's types, resources,
and functions.
2020-02-27 16:10:47 -08:00
Erin Krengel e660937bab
use version tag (#3961) 2020-02-24 17:11:56 -08:00
Justin Van Patten 3bf9067bac
Expose options, parent, deps, and provider config to policies (#3862) 2020-02-07 16:11:34 -08:00
Pat Gavlin 7fff99d346
Do not allocate outputs for nested prompt values. (#3851)
* Do not allocate outputs for nested prompt values.

Currently, `outupt`/`all` in the NodeJS SDK work recursively, allocating
outputs for every value at every depth, then collecting the component
promises into a top-level output. In the case of prompt values, these
nested outputs are not necessary, and allocating them can create massive
amounts of garbage. This appears to be the cause of
https://github.com/pulumi/pulumi-kubernetes/issues/963.
2020-02-04 19:21:37 -08:00
Justin Van Patten a5fea292a3
Fix doc comment to filter internal API (#3814)
I noticed `_setQueryMode` wasn't being filtered out of API docs, and it was due to the comment not being a _doc_ comment.
2020-01-27 10:22:32 -08:00
Justin Van Patten 9abcca345a
Mark internal APIs @internal to filter from API docs (#3809)
Also:

 - Cleaned up existing tags so they're consistently at the bottom of doc comments where they should be
 - Cleaned up some unused imports while I was taking a pass over the files
 - Marked one function `@deprecated` that should be deprecated
2020-01-26 09:06:35 -08:00
clstokes 0a3191905c Fixed 'transacational' misspelling. 2020-01-13 10:45:07 -08:00
Mike Metral 1f192d024e Lock dep ts-node to v8.5.4 2020-01-10 12:18:46 -05:00
CyrusNajmabadi 30bacfd8da
Make property internal (#3682) 2019-12-18 01:46:29 -08:00
CyrusNajmabadi 35bc41c5d3
Support sxs with old outputs with sync resources only. (#3680) 2019-12-17 19:04:09 -08:00
CyrusNajmabadi 342b80b768
Add a supported api for components to indicate that they are asynchronously constructed. (#3676) 2019-12-17 15:34:30 -08:00
CyrusNajmabadi f4fc00ad0e
Output.apply should lift resources from inner Outputs to the top level output. (#3663) 2019-12-17 14:11:45 -08:00
CyrusNajmabadi 7cbdf58105
Update to TypeScript 3.7 (#3627) 2019-12-17 11:00:45 -08:00
CyrusNajmabadi ef69915864
Produce a slightly better error message when a user throws a non-Error object in JS. (#3670) 2019-12-16 17:27:36 -08:00
Justin Van Patten 10a960ea4b
PaC: Support Config/getProject/getStack/isDryRun (#3612)
Add support for using `Config`, `getProject()`, `getStack()`, and
`isDryRun()` from Policy Packs.
2019-12-16 22:51:02 +00:00
CyrusNajmabadi 9151d48ee3
Fix typing for 'Lifted<T>' to work better across versions of TS (#3658) 2019-12-13 11:18:19 -08:00
CyrusNajmabadi 714e5628cc
Add test to validate that lifted properties on output-wrapped Resources. (#3628) 2019-12-10 00:40:28 -08:00
CyrusNajmabadi ad4da29cbd
Expose lifted resource properties (#3625) 2019-12-09 17:42:13 -08:00
Justin Van Patten 4545b4a9de
Export NumberConfigOptions and StringConfigOptions (#3615) 2019-12-09 22:48:54 +00:00
CyrusNajmabadi 048acc24f7
Allow users to export a top-level function to serve as the entrypoint to their pulumi app. (#3321) 2019-12-09 11:28:20 -08:00
Justin Van Patten eec14527b1
Use TypeScript's built-in Omit (#3597) 2019-12-02 22:50:18 +00:00
Justin Van Patten 6c84b008d8
Send resource URN and name to analyzer (#3554)
More information we want to make available to policy packs.
2019-11-21 21:01:15 +00:00
Pat Gavlin 91ff3d9434
Skip tests that hang on Node 12.11.x+ (#3534)
Fixes #3484.
2019-11-19 18:48:27 -08:00
Justin Van Patten 7278a7429c
Don't remove tests from @pulumi/pulumi npm package (#3532)
The test files are currently included in the npm package, and we have packages that depend on the test files currently, so when installing the linkable `@pulumi/pulumi` package locally, don't delete the tests.
2019-11-19 21:29:53 +00:00
CyrusNajmabadi d4aa5fe20d Switch to 'console.log' for our hang warning. Add warning to synchronous StackReference calls. (#3456)
Codepaths which could result in a hang will print a message to the console indicating the problem, along with a link to documentation on how to restructure code to best address it.

`StackReference.getOutputSync` and `requireOutputSync` have been deprecated as they may cause hangs on some combinations of Node and certain OS platforms. `StackReference.getOutput` and `requireOutput` should be used instead.
2019-11-19 12:51:14 -08:00
Maciej Lisiewski bcdd27e092 Updates grpc package to 1.24.2 for js sdk (#3512)
Fixes building grpc package with gcc8 and newer
Fixes building grpc package for node 13.x
Matches minor grpc release (1.24.x) to version used by dotnet sdk
2019-11-19 11:56:26 -08:00
Alex Clemmer b06805ded3 Add StreamInvoke to dynamic provider 2019-11-12 13:51:19 -08:00
Alex Clemmer a40008db41 StreamInvoke should return AsyncIterable that completes
A user who calls `StreamInvoke` probably expects the `AsyncIterable`
that is returned to gracefully terminate. This is currently not the
case.

Where does something like this go wrong? A better question might be
where any of this went right, because several days later, after
wandering into civilization from the great Wilderness of Bugs, I must
confess that I've forgotten if any of it had.

`AsyncIterable` is a pull-based API. `for await (...)` will continuously
call `next` ("pull") on the underlying `AsyncIterator` until the
iterable is exhausted. But, gRPC's streaming-return API is _push_ based.
That is to say, when a streaming RPC is called, data is provided by
callback on the stream object, like:

    call.on("data", (thing: any) => {... do thing ...});

Our goal in `StreamInvoke` is to convert the push-based gRPC routines
into the pull-based `AsyncIterable` retrun type. You may remember your
CS theory this is one of those annoying "fundamental mismatches" in
abstraction. So we're off to a good start.

Until this point, we've depended on a library,
`callback-to-async-iterator` to handle the details of being this bridge.
Our trusting nature and innocent charm has mislead us. This library is
not worthy of our trust. Instead of doing what we'd like it to do, it
returns (in our case) an `AsyncIterable` that will never complete.
Yes,, this `AsyncIterable` will patiently wait for eternity, which
honestly is kind of poetic when you sit down in a nice bath and think
about that fun time you considered eating your computer instead of
finishing this idiotic bug.

Indeed, this is the sort of bug that you wonder where it even comes
from. Our query libraries? Why aren't these `finally` blocks executing?
Is our language host terminating early? Is gRPC angry at me, and just
passive-aggrssively not servicing some of my requests? Oh god I've been
up for 48 hours, why is that wallpaper starting to move? And by the way,
a fun interlude to take in an otherwise very productive week is to try
to understand the gRPC streaming node client, which is code-gen'd, but
which also takes the liberty of generating itself at runtime, so that
gRPC is code-gen'ing a code-gen routine, which makes the whole thing
un-introspectable, un-debuggable, and un-knowable. That's fine, I didn't
need to understand any of this anyway, thanks friends.

But we've come out the other side knowing that the weak link in this
very sorry chain of incredibly weak links, is this dependency.

This commit removes this dependency for a better monster: the one we
know.

It is at this time that I'd like to announce that I am quitting my job
at Pulumi. I thank you all for the good times, but mostly, for taking
this code over for me.
2019-11-12 13:51:19 -08:00
Pat Gavlin 137fd54f1c
Propagate inputs to outputs during preview. (#3327)
These changes restore a more-correct version of the behavior that was
disabled with #3014. The original implementation of this behavior was
done in the SDKs, which do not have access to the complete inputs for a
resource (in particular, default values filled in by the provider during
`Check` are not exposed to the SDK). This lack of information meant that
the resolved output values could disagree with the typings present in
a provider SDK. Exacerbating this problem was the fact that unknown
values were dropped entirely, causing `undefined` values to appear in
unexpected places.

By doing this in the engine and allowing unknown values to be
represented in a first-class manner in the SDK, we can attack both of
these issues.

Although this behavior is not _strictly_ consistent with respect to the
resource model--in an update, a resource's output properties will come
from its provider and may differ from its input properties--this
behavior was present in the product for a fairly long time without
significant issues. In the future, we may be able to improve the
accuracy of resource outputs during a preview by allowing the provider
to dry-run CRUD operations and return partially-known values where
possible.

These changes also introduce new APIs in the Node and Python SDKs
that work with unknown values in a first-class fashion:
- A new parameter to the `apply` function that indicates that the
  callback should be run even if the result of the apply contains
  unknown values
- `containsUnknowns` and `isUnknown`, which return true if a value
  either contains nested unknown values or is exactly an unknown value
- The `Unknown` type, which represents unknown values

The primary use case for these APIs is to allow nested, properties with
known values to be accessed via the lifted property accessor even when
the containing property is not fully know. A common example of this
pattern is the `metadata.name` property of a Kubernetes `Namespace`
object: while other properties of the `metadata` bag may be unknown,
`name` is often known. These APIs allow `ns.metadata.name` to return a
known value in this case.

In order to avoid exposing downlevel SDKs to unknown values--a change
which could break user code by exposing it to unexpected values--a
language SDK must indicate whether or not it supports first-class
unknown values as part of each `RegisterResourceRequest`.

These changes also allow us to avoid breaking user code with the new
behavior introduced by the prior commit.

Fixes #3190.
2019-11-11 12:09:34 -08:00
Alex Clemmer e37d23d52d Don't attempt to deserialize empty invoke responses 2019-11-07 10:16:39 -08:00
CyrusNajmabadi b39b5500c5
Lock to 3.6.3 version of TS as 3.7.x releases contain changes that break our version of typedoc. (#3462) 2019-11-06 17:36:32 -08:00
Evan Boyle 7353b18a30
Merge pull request #3449 from pulumi/evan/fixIstanbul
Fixing Istanbul usage
2019-11-05 12:58:05 -08:00
evanboyle 9e7d8a6ed6 Fixing Istanbul usage 2019-11-05 11:17:07 -08:00
Alex Clemmer 038f920dc3 Make streamInvoke gracefully-cancellable from SDKs
The @pulumi/pulumi TypScript SDK exposes `streamInvoke`, which returns a
(potentially infinite) stream of responses. This currently is _assumed_
to be infinite, in that there is no way to signal cancellation, and
prevents Pulumi from being able to clean up when we're finished using
the results of the `streamInvoke`.

This commit will introduce a `StreamInvokeResult` type, which is an
`AsyncIterable` that also exposes a `cancel` function, whih does just
this.

Use it like this:

    // `streamInvoke` to retrieve all updates to any `Deployment`, enumerate 0
    // updates from the stream, then `cancel` giving the Kubernetes provider to
    // clean up and close gracefully.
    const deployments = await streamInvoke("kubernetes:kubernetes:watch", {
        group: "apps", version: "v1", kind: "Deployment",
        break;
    });
    deployments.cancel();
2019-11-05 10:47:48 -08:00
Alex Clemmer f195cc0d4d Implement StreamInvoke 2019-11-05 10:47:48 -08:00
Alex Clemmer 25d27d09f9 Add StreamInvoke to Provider gRPC interface 2019-11-05 10:47:48 -08:00
Evan Boyle 105eb210ce temporarily disable gosec G204 linting rule (#3446) 2019-11-05 09:52:48 -08:00