Commit graph

728 commits

Author SHA1 Message Date
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