Commit graph

1348 commits

Author SHA1 Message Date
evanboyle
cc7cf7c476 Add Stack.Info 2020-08-21 15:26:58 -07:00
evanboyle
3531635294 Add NewStack helper methods and tests 2020-08-21 09:49:46 -07:00
evanboyle
7b58202938 Implement Stack based on Workspace interface 2020-08-20 19:37:39 -07:00
evanboyle
535d48ca72 Round out LocalWorkspace impl 2020-08-19 21:23:53 -07:00
evanboyle
93ff03a9d3 LocalWorkspace initial implementation 2020-08-19 11:13:42 -07:00
Justin Van Patten
cd9fae599d
Python SDK changes to support input/output classes (#5033)
Python SDK changes to support strongly-typed input/output "dataclasses".
2020-08-19 01:15:56 -07:00
evanboyle
4a44b27b40 add automation api workspace interface 2020-08-18 11:07:03 -07:00
Lee Briggs
3a01c0cde8
Merge pull request #5150 from pulumi/jar-extract
support extracting jar files
2020-08-12 09:58:26 -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
Lee Briggs
c325e4f53b
Merge branch 'justin/testresource' into jar-extract 2020-08-10 18:14:43 -07:00
Justin Van Patten
7a3ef12134 Work around TS compiler error 2020-08-10 14:57:09 -07:00
Lee Briggs
574a9151db
support jar files 2020-08-10 14:15:35 -07:00
Luke Hoban
5066ae3227
Fix support for CheckFailures in Python Dynamic Providers (#5139)
Fixes #5138.
2020-08-10 09:28:25 -07:00
Evan Boyle
996fd85e00
Add missing MapMap and ArrayArray types to Go SDK (#5092) 2020-08-03 11:37:28 -07:00
evanboyle
12d7216769 serve engine address via pulumi host command 2020-07-30 15:20:57 -07:00
evanboyle
9281e55e00 detect and throw errors for nested stacks 2020-07-29 19:01:51 -07:00
evanboyle
5d8aa34d09 run all commands in non-interactive mode 2020-07-29 11:22:46 -07:00
evanboyle
7e6a08dbe1 example update 2020-07-28 17:40:25 -07:00
evanboyle
34a86f54be godoc improvements 2020-07-28 17:32:38 -07:00
Justin Van Patten
b364296521
Python: Improved error message when virtualenv doesn't exist (#5069) 2020-07-28 13:28:14 -07:00
evanboyle
8a707e27e3 godoc pt. 1 2020-07-27 22:26:39 -07:00
evanboyle
4f653683ce validate project name 2020-07-27 18:51:29 -07:00
evanboyle
114e3c2aff provide defaults for pului.yaml for inline source 2020-07-27 18:22:01 -07:00
Lee Briggs
bad67d3242
switch os/user with luser
We make several calls to `os/user`, which uses CGO and means
cross-compilation is not possible. This replaces `os/user` with the
`luser` package, which is a drop-in replacement which does not use `CGO`
2020-07-27 14:44:08 -07:00
evanboyle
45ed471a7d handle and detect runtime errors for inline source 2020-07-26 13:43:33 -07:00
evanboyle
41d6767e32 host error handling, inline concurrent update detection 2020-07-26 12:52:59 -07:00
evanboyle
15b8f03dc3 enable e2e up/pre/ref/dest/rm test for inline source 2020-07-25 15:08:10 -07:00
evanboyle
ae76944b77 use ts seeds for random test names 2020-07-25 13:28:57 -07:00
evanboyle
b21f4e0f7b inline preview 2020-07-24 10:54:18 -07:00
evanboyle
b0468d4166 init inline prototype 2020-07-24 01:31:54 -07:00
Justin Van Patten
ce4badd488
Update pip/setuptools/wheel in virtual environment (#5042)
Update pip, setuptools, and wheel in the virtual environment before installing dependencies as recommended by the Python documentation. This should help avoid failures when only source distributions are available for a package and pip attempts to build a wheel locally.
2020-07-23 13:33:09 -07:00
evanboyle
0d3203c96d add ability to specify git URL instead of local source 2020-07-22 14:28:03 -07:00
evanboyle
6e7ce72db6 update error formatting 2020-07-21 18:44:53 -07:00
evanboyle
e789ae9700 update test 2020-07-21 18:41:36 -07:00
evanboyle
acc719e7c1 IsUnexpectedEngineError() 2020-07-21 18:39:35 -07:00
evanboyle
be42f75d2c add some comments based on findings 2020-07-21 18:27:31 -07:00
evanboyle
0500aae0e0 IsRuntimeError() 2020-07-21 18:17:38 -07:00
evanboyle
c360e4d3f1 Merge branch 'master' of https://github.com/pulumi/pulumi into evan/auto 2020-07-21 16:52:08 -07:00
evanboyle
ff81dd8961 IsCompilationError 2020-07-21 16:21:47 -07:00
Sean Fausett
a38bbaa221
Enable SourceLink with embedded PDB (#4967) 2020-07-21 16:55:08 +02:00
Mikhail Shilkov
fe66a0ba6d
Speed up .NET programs with large number of resources (#5015)
* Speed up .NET programs with large number of resources
2020-07-21 10:50:14 +02:00
evanboyle
f6bc545809 clean up test 2020-07-17 20:08:45 -07:00
evanboyle
cf4e02d517 init error strategy 2020-07-17 20:04:37 -07:00
evanboyle
99d769b903 typo 2020-07-17 11:15:58 -07:00
evanboyle
5faf54cedd lint 2020-07-17 10:59:13 -07:00
evanboyle
5b9f1b60d4 tighten up the interface 2020-07-17 10:14:30 -07:00
Paul Stack
6d09fe32df
Add the ability to copy configs between stacks (#4971) 2020-07-17 11:14:10 +01:00
Pat Gavlin
418e2291a2
Protect against engine event mutation. (#5003)
Certain operations in `engine/diff` mutate engine events during display.
This mutation can occur concurrently with the serialization of the event
for persistence, which causes a panic in the CLI. These changes fix the
offending code and add code that copies each engine event before
persisteing it in order to guard against future issues.
2020-07-16 23:52:31 -07:00
evanboyle
96b9c74bda refresh, e2e test 2020-07-16 19:17:07 -07:00
evanboyle
7ac704125e pulumi stack rm 2020-07-16 18:50:34 -07:00
evanboyle
102dbad5ea destroy 2020-07-16 08:47:04 -07:00
evanboyle
30f0962529 preview 2020-07-16 00:34:13 -07:00
evanboyle
c09a1cb351 capture last event from history for UpResult 2020-07-15 23:34:34 -07:00
evanboyle
13746f9c82 set config and secrets upon stack initialization 2020-07-14 23:35:26 -07:00
evanboyle
ea6cd84dce add utils to round trip pulumi.yaml and pulumi.stack.yaml 2020-07-14 23:13:45 -07:00
Komal
f364311064
Remove known_types decorators (#4980) 2020-07-13 12:27:00 -07: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
evanboyle
ae465a19c9 expose GetUser GetOutputs 2020-07-10 00:55:07 -07:00
evanboyle
e08e362a85 init/select stack, improvements 2020-07-09 22:30:52 -07:00
Komal
bdc86e002a
Change how submodules are imported to work with Intellisense (#4948) 2020-07-08 18:34:59 -07:00
Pat Gavlin
2119601023
Implement PropertyPath.Add. (#4976)
This function adds a property value to another property at a given path,
creating containing properties as required. If the property cannot be
added because of a mismatch between the value types required by the path
and the values present in the destination, the add will fail. If a value
already exists at the given path, the add will succeed.

Related to #1635.
2020-07-07 14:45:36 -07:00
evanboyle
2504db3cd2 prototype 2020-07-07 14:25:11 -07:00
Paul Stack
57b91d553e
Adding the ability to specify a version as a ResourceOption (#4945) 2020-07-07 20:20:01 +01:00
Pat Gavlin
a8a20ecb4b
[codegen/*] Add support for explicit secrets. (#4927)
- Add a new builtin function, secret, that marks its input value as
  secret
- Add support for this function to the various code generators

Fixes #4924.
2020-06-30 11:35:24 -07:00
Levi Blackstone
8961f5b0ca
Rename RetrieveTemplate function to RetrieveGitFolder (#4912)
The new name better reflects the functionality for external
consumers of this package.
2020-06-26 15:01:51 -06:00
Evan Boyle
2351fc66cf
Go SDK interfaces should declare impl of Ptr types where appropriate (#4911) 2020-06-26 11:25:53 -07:00
Komal
ed752bc384
[codegen/python] Don't use __all__ (#4873) 2020-06-24 11:41:03 -07:00
Justin Van Patten
6bad3a3620
Exclude grpcio v1.30.0, which breaks Pulumi Python programs (#4883) 2020-06-24 08:11:05 -07:00
Pat Gavlin
3e6e28af36
Fix lint errors. (#4856)
These errors appear when using golangci-lint 1.27.0.
2020-06-18 14:17:11 -07:00
Paul Stack
e20e6831a0
Merge pull request #4844 from pulumi/fix-package-refs
Ensuring references to v2 pulumi packages are up to date
2020-06-18 00:35:27 +01:00
Levi Blackstone
19a113de7a
Handle invalid UTF-8 characters before RPC calls (#4816)
Several users reported cases where error messages would
cause a panic if they contained accented characters. I wasn't
able to reproduce this failure locally, but tracked down the
panic to logging gRPC calls. The Message field is typed as
a string, which requires all of the characters to be valid UTF-8.

This change runs each log string through the strings.ToValidUTF8
function, which will replace any invalid characters with the
"unknown" character. This should prevent the the logger from
panicking.
2020-06-17 13:30:59 -06:00
stack72
9e33449245 Ensuring references to v2 pulumi packages are up to date 2020-06-17 14:54:05 +03:00
Praneet Loke
2513709089
Use the GH webhook payload to parse PR details when CI system is GH Actions (#4817)
* Read the file and parse it. Also use the PR Head SHA instead of the GITHUB_REF if the build type is pull_request.

* Update changelog
2020-06-15 12:49:09 -07:00
Evan Boyle
fa69a31c97
Set default namespace for go config for config-less get/try/require (#4802) 2020-06-12 16:35:06 -07:00
Justin Van Patten
9b0169be35
Fix pylint(no-member) when accessing resource.id (#4813)
Pylint currently reports `E1101: Instance of 'Bucket' has no 'id' member (no-member)` on lines in Pulumi Python programs like:

```python
pulumi.export('bucket_name', bucket.id)
```

Here's a description of this message from http://pylint-messages.wikidot.com/messages:e1101:

> Used when an object (variable, function, …) is accessed for a non-existent member.
>
> False positives: This message may report object members that are created dynamically, but exist at the time they are accessed.

This appears to be a false positive case: `id` isn't set in the constructor (it's set later in `register_resource`) and Pylint isn't able to figure this out statically. `urn` has the same problem. (Oddly, Pylint doesn't complain when accessing other resource output properties).

This change refactors `register_resource` so that `id` and `urn` can be assigned in the resource's constructor, so that Pylint can see it being assigned. The change also does the same with `read_resource`.
2020-06-12 12:41:56 -07:00
Evan Boyle
3d2df8992f
Use appropriate types for go config methods (#4800) 2020-06-10 18:24:05 -07:00
Justin Van Patten
b77ec919d4
Install and use dependencies automatically for new Python projects (#4775)
Automatically create a virtual environment and install dependencies in it with `pulumi new` and `pulumi policy new` for Python templates.

This will save a new `virtualenv` runtime option in `Pulumi.yaml` (`PulumiPolicy.yaml` for policy packs):

```yaml
runtime:
  name: python
  options:
    virtualenv: venv
```

`virtualenv` is the path to a virtual environment that Pulumi will use when running `python` commands.

Existing projects are unaffected and can opt-in to using this by setting `virtualenv`, otherwise, they'll continue to work as-is.
2020-06-09 16:42:53 -07:00
Praneet Loke
407896730c
Add GitHub Actions detection and update the Pulumi CI escape hatch with more CI vars (#4758)
* Add GitHub Actions detection. Update the Pulumi CI escape hatch with more CI vars.
2020-06-08 17:24:12 -07:00
Luke Hoban
678a5a6d3e
Export the CustomTimeouts class (#4747)
This class was available in the pulumi.resource module, but was not exported from the core `pulumi` module as intended for all public APIs at this level.
2020-06-03 15:36:44 -07:00
Lee Zen
0dac22c360
Escape the path to ensure we fetch plugins correctly (#4733) 2020-05-29 14:59:25 -07:00
Paul Stack
45e1917a30
Upgrade to Go 1.14.x (#4697) 2020-05-28 12:01:33 +01:00
Tomas Jansson
1bdfd3dd41
Add F# operators for InputUnion (#4699) 2020-05-26 14:18:56 +02:00
Chris Smith
f613b6917b
Download plugins from get.pulumi.com (#4692)
* Remove long-since deprecated --cloud-url flag

* Download plugins from get.pulumi.com

* Update CHANGELOG.md

* Use more straight forward TrimSuffix
2020-05-25 09:16:57 -07: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
Justin Van Patten
af3d4b890d
Allow pulumi.export calls from unit tests (#4670)
The previous attempt to allow this didn't actually allow it, so this is
take two. As part of the previous attempt, I thought after tweaking the
test I had observed the test failing, and then succeeding after making
the product changes, but I must have been mistaken.

It turns out that our existing mocks tests weren't running at all
because of a missing `__init__.py` file. Once the missing `__init__.py`
is added, the tests run, but other tests ("test mode" tests) fail
because the code that creates the mocks and resources will run during
test discovery, and setting the mocks modifies global state.

To address the test issue, I've moved the mocks tests into their own
`test_with_mocks` package that can be run separately from other tests.

And addressed the original issue, by creating a root Stack resource if
one isn't already present when the mocks are set.
2020-05-20 09:54:40 -07:00
Evan Boyle
20452b9cb5
fix dotnet error (#4668) 2020-05-19 12:06:24 -07:00
Mikhail Shilkov
5b0c4e162d
Fix NRE in C# mocks and include the stack to result again (#4656)
Fix NRE in C# mocks and include the stack to result again
2020-05-18 17:18:12 +02:00
Pat Gavlin
e677c7d6dc
[sdk/go] Add support for untagged outputs. (#4640)
With these changes, a resource struct may tag a field with the empty
string. If such a field is present, any resource outputs that were not
unmarshalled into other fields will be unmarshalled into this field,
which must be a `MapOutput`.

Fixes #4629.
2020-05-14 14:43:20 -06:00
Lee Briggs
8c314ec39a
Add brew make targets to sdk makefiles 2020-05-13 20:42:01 -07:00
Paul Stack
48f906e026
Allow pulumi stack export to decrypt secrets (#4046) 2020-05-11 19:16:30 +01:00
Luiz Ferraz
2bfef6f4d7
Allows conditional dependencies and Resources from apply (#4446) 2020-05-08 17:57:08 -07:00
solidDoWant
b7fb3bae22
Fixed ResourceOption deepcopy bug in stack_reference.py (#4553) 2020-05-08 12:01:59 -07:00
Levi Blackstone
b445206101
Add ResourceOutput type to Go SDK (#4575) 2020-05-05 21:13:58 -06:00
Justin Van Patten
1fe5b1cb26
Fix occasional .NET test failure (#4564)
This avoids the "NotSupportedException : Multiple executions of TestAsync must run serially" from calls to `Deployment.TestAsync` in the mocks test, which can happen if a stack test runs before the mock test (.NET unit tests are run in random order).
2020-05-05 15:09:50 -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
Justin Van Patten
c058443107
.NET: Disable parallel xUnit tests (#4547)
Despite having the `[assembly: CollectionBehavior(DisableTestParallelization = true)]` attribute, it appears `dotnet test` is still running tests in parallel. To address, use a configuration file to disable parallelization.
2020-05-01 11:42:32 -07:00
Yves Reynhout
f36a8b4ca0
Adds TPL based runTask to Deployment (#3858)
Add TPL based runTask to Deployment.
2020-05-01 16:21:37 +02:00
Luke Hoban
edf8bf5c30
Support map-typed inputs in Go SDK RegisterResource (#4521)
Adds support for RegisterResource to accept map-typed implementations if Input as well as the existing struct-typed implementations. Currently these must be fully untyped - but both map[string]pulumi.Input and map[string]interface{} are allowed. In the future, it's plausible that a mode where the data itself is a map, but the ElementType implementation returns a struct could be supported, with the struct used to provide type information over the untyped map.
2020-04-30 11:56:47 -07:00
Justin Van Patten
653dcf8f1f
Don't call IMocks.NewResourceAsync for the root stack resource (#4527) 2020-04-30 10:38:48 -07:00
Paul Stack
f06e48b414
Enable fish completions for pulumi cli (#4401) 2020-04-30 15:45:57 +01:00
Justin Van Patten
16926504c1
Allow pulumi.export calls from unit tests (#4518)
This change allows importing modules with calls to `pulumi.export` in unit tests. Previously, you'd have to structure the Python program in a way that avoids the `pulumi.export` from being called from unit tests.
2020-04-29 10:03:20 -07:00
Levi Blackstone
d1ba572e1d
Fix infinite recursion bug for Go SDK (#4516)
gatherDependencySet was not checking for Resources
in the dependency set, which could lead to infinite
recursion.
2020-04-28 18:10:07 -06:00
komal
b555286042 Updating .NET references 2020-04-27 12:42:11 -07:00
Komal
c7866108e1
Merge branch 'master' into komalali/increase-grpc-message-size 2020-04-24 17:54:32 -07:00
Luke Hoban
cfa57914a1
[sdk/python] Improve ResourceOptions.merge type (#4484)
* [sdk/python] Improve `ResoruceOptions.merge` type

The implementation correctly handles `None` inputs, so the type should allow these as well.

* Add CHANGELOG
2020-04-24 17:45:11 -07:00
Komal
6f49d990f7
Remove preview language from dotnet readme. 2020-04-24 13:54:41 -07:00
komal
2776a80a14 remove unneeded types 2020-04-23 17:58:17 -07:00
komal
6a869fa0f3 fix c# channel option 2020-04-23 17:30:23 -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
de41fecfdc fix python server options 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
Justin Van Patten
7f27618e2d
Avoid replace on second update with import applied (#4403)
After importing some resources, and running a second update with the
import still applied, an unexpected replace would occur. This wouldn't
happen for the vast majority of resources, but for some it would.

It turns out that the resources that trigger this are ones that use a
different format of identifier for the import input than they do for the
ID property.

Before this change, we would trigger an import-replacement when an
existing resource's ID property didn't match the import property, which
would be the case for the small set of resources where the input
identifier is different than the ID property.

To avoid this, we now store the `importID` in the statefile, and
compare that to the import property instead of comparing the ID.
2020-04-15 18:52:40 -07:00
Mikhail Shilkov
3e7b3667ee
Bump to .NET Core 3.1 (#4400)
Bump to .NET Core 3.1
2020-04-15 16:31:18 +02:00
Justin Van Patten
33119659e0
Treat config values that start with '0' as strings (#4393)
When setting structured config values using `--path`, we automatically
treat values that can be converted into an integer via `strconv.Atoi` as
an integer, rather than as a string.

However, this ends up converting values like "0123456" into the integer
123456, stripping the leading 0, which isn't desirable for values like
commit SHAs, etc., where you want to keep the 0 (and keep it a string).

This change makes it so that values starting with 0 are not implicitly
converted to an integer; instead such values will remain a string.
2020-04-14 12:40:22 -07:00
stack72
b721aefe27 Adding an empty PublicAPI.Unshipped.txt file 2020-04-14 11:17:39 +01:00
stack72
0af34619bb Mark .NET API as shipped 2020-04-14 10:59:44 +01:00
stack72
d1c76808af Small linting error after merging feature 2.0 branch 2020-04-14 09:55:18 +01:00
stack72
74df34be75 Re-enabling dockerfile latest, docs and homebrew publishing
These had previously been disabled due to the beta releases. Also
fixes an import path for finding an executable
2020-04-14 09:40:11 +01: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
Evan Boyle
4261b27a5e
fix propagation of secrets for resource inputs/outputs in go sdk (#4387) 2020-04-13 22:48:36 -07:00
Evan Boyle
9d2f40b686
fix unknown status for secrets wrapping unknowns (#4377)
* fix unknown status for secrets wrapping unknowns

* changelog

* add test for secret computed values
2020-04-13 22:47:08 +01:00
Evan Boyle
4bbddafe6c
update remote path for policy pack template tests (#4381) 2020-04-13 14:02:17 -07:00
Mikhail Shilkov
d3e7041c0d
Support the binary option for .NET (#4355)
Support the binary option for .NET
2020-04-12 21:34:50 +02:00
Evan Boyle
fe7877177c
fix stack reference helpers to handle nil values (#4370) 2020-04-12 08:44:08 -07:00
Evan Boyle
779c4144f9
Properly propagate unknowns in go SDK marshaling operations (#4369) 2020-04-11 22:20:03 -07:00
Evan Boyle
c3b2439094
Automate execution of go mod download for pulumi new Go templates (#4353) 2020-04-09 16:16:10 -07:00
Justin Van Patten
8c065b34ff
Remove unnecessary import (#4350) 2020-04-09 14:13:16 -07:00
Evan Boyle
cfea357cda
Add runtime.options.binary to Pulumi.yaml to make prebuilt go binaries opt-in (#4338) 2020-04-09 12:21:26 -07:00
Evan Boyle
7382de6b5f
Add Go SDK stack output helpers for String and ID (#4341) 2020-04-09 07:52:34 -07:00
Mikhail Shilkov
46dababc28
Add additional RunAsync overloads (#4286) 2020-04-09 16:43:43 +02:00
Evan Boyle
f50fd69c10
Define merge behavior for go resource options (#4316) 2020-04-07 14:19:33 -07:00
Mikhail Shilkov
1d171dbb74
Add Output.All overloads (#4321)
Add Output.All overloads
2020-04-07 20:51:05 +02: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
Evan Boyle
ab659aa0c1
Reimplement getRequiredPlugins for go sdk (#4297) 2020-04-06 12:30:40 -07:00
Mikhail Shilkov
6d32d575e0
Enable features in mock monitor (#4272) 2020-04-03 08:33:40 +02:00
Mikhail Shilkov
0bce094dc1
Fix python mock's call (#4274)
Fix python mock's call
2020-04-03 07:28:52 +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
9e37741916
[Go] Ensure Apply handles nil output values (#4268)
Fixes #4247.
2020-04-01 17:39:01 -07:00
Luke Hoban
a0f615ad09
Add package details and atttribution to schema (#4256) 2020-04-01 17:22:23 -07:00
Evan Boyle
8a8f424628
disable go plugin acquisition (#4257) 2020-03-31 23:00:35 -07:00
Luke Hoban
dd9ed3c938
Support grpc-js plugin servers (#4253)
In order to support grpc-js gRPC servers, we need to slightly loosen
our checks on plugin readiness.  This change was already in the 2.x
branch, but porting back so that 1.x CLIs can also be compatible.

Fixes #4252.
2020-03-31 14:18:09 -07:00
Justin Van Patten
a5ca20bbf2
Specify StringComparison.Ordinal to StartsWith (#4244)
StartsWith does a culture-sensitive comparison by default, and in this case, we really just want an ordinal comparison.
2020-03-31 08:24:58 -07:00
stack72
a1af9289c3 Move BuildUtil class to sdk
This was still in pkg and wasn't accessible from the scripts location.
This code should be in the go/common location of sdk so that it can be
accessed from within our build scripts

Without this change, we were not able to get access to the Version number
for Python and none of our Python builds have been publishing binaries
2020-03-31 12:07:24 +01: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
stack72
947e52b194 Merge branch 'master' into tasiah/4204/go-logging-bug 2020-03-27 18:29:23 +00:00
Tasia Halim
4afaf37b3a fixed bug 2020-03-27 10:25:06 -07:00
Mikhail Shilkov
6e15c83e1a
Remove legacy .NET attributes (#4190)
Remove legacy .NET attributes
2020-03-27 10:51:42 +01:00
Matthieu Berthomé
7c75d4fe5b
ephemeral kwargs for log methods (#4197)
Co-authored-by: rienafairefr <rienafairefr@gmail.com>
2020-03-26 14:23:43 -07:00
Evan Boyle
80f1989600
Removing the need for vendoring (#4167) 2020-03-25 15:57:46 -07:00
Luke Hoban
215f5af505
Clarify documentation on Output.from_input (#4178) 2020-03-25 15:28:22 -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
Evan Boyle
2408d34c71
Add missing builtin MapArray to the Go SDK (#4144) 2020-03-20 16:51:33 -07:00
Evan Boyle
c28c602247
capture std err when getting required plugins for go (#4141)
* capture std err when getting required plugins for go
2020-03-20 14:59:12 -07:00
evanboyle
5e1f597ea9 make distinction between python VERSION and PYPIVERSION for install vs release 2020-03-19 17:02:10 -07:00
evanboyle
163444bce6 disable logging test 2020-03-19 14:45:03 -07:00
evanboyle
fa47d867fd fix go sdk makefile to run tests 2020-03-19 14:10:48 -07:00
evanboyle
a2b368827f fix internal logging usage 2020-03-19 11:45:10 -07:00
evanboyle
31d8f79f35 fix klog initialization 2020-03-19 10:01:10 -07:00
evanboyle
4e44854308 replace glog with klog 2020-03-19 08:56:44 -07:00
evanboyle
ec686bbaf6 Merge branch 'master' of https://github.com/pulumi/pulumi into evan/gomod 2020-03-18 17:57:58 -07:00
evanboyle
29dfd65632 fix resource test data path 2020-03-18 17:36:28 -07:00
evanboyle
bc4e5bf31c run common tests as a part of go sdk make 2020-03-18 17:32:27 -07:00
evanboyle
d3f5bbce48 go fmt 2020-03-18 17:27:02 -07:00
evanboyle
1fa50398e2 update go.mods to pin to correct version of pb 2020-03-18 17:25:42 -07:00
evanboyle
71926f1af8 update go.mod after moving the language hosts back to /sdk 2020-03-18 17:16:16 -07:00
evanboyle
67f6b72caa Revert "move sdk/go/pulumi-language-go -> pkg/cmd/pulumi-language-go"
This reverts commit 7ea547a14d.
2020-03-18 17:14:41 -07:00
evanboyle
56c1dd7012 Revert "move sdk/dotnet/cmd/pulumi-language-dotnet -> pkg/cmd/pulumi-language-dotnet"
This reverts commit b7ea8198de.
2020-03-18 17:13:46 -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
48250176a1 Revert "move sdk/python/cmd/pulumi-language-python -> pkg/cmd/pulumi-language-python"
This reverts commit e2ee46fb23.
2020-03-18 17:11:56 -07:00
evanboyle
be4b523e55 create go.mod for top level packages pkg sdk examples tests 2020-03-18 16:30:44 -07:00
Justin Van Patten
24e804bbe8
Support for running Python policy packs (#4057)
These changes enable running policy packs written in Python.
2020-03-18 16:15:57 -07:00
evanboyle
6933745342 move pkg/tools -> sdk/go/common/tools 2020-03-18 15:56:58 -07:00
evanboyle
a4ec3ec81b move pkg/testing -> sdk/go/common/testing, leave behind pkg/testing/integration 2020-03-18 15:55:41 -07:00
evanboyle
0e9c5989bb move pkg/util/gitutil -> sdk/go/common/util/gitutil 2020-03-18 15:52:09 -07:00
evanboyle
df722e974a move pkg/util/archive -> sdk/go/common/util/archive 2020-03-18 15:50:04 -07:00
evanboyle
30e1a5917e move pkg/util/fsutil -> sdk/go/common/util/fsutil 2020-03-18 15:48:38 -07:00
evanboyle
33e23bdf0c move pkg/util/retry -> sdk/go/common/util/retry 2020-03-18 15:47:01 -07:00
evanboyle
c1440e48d4 move pkg/util/result -> sdk/go/common/util 2020-03-18 15:45:42 -07:00
evanboyle
fa348ceb1b move pkg/util/ciutil -> sdk/go/common/util/ciutil 2020-03-18 15:43:31 -07:00
evanboyle
c1d3a8524b move pkg/util/cmdutil -> sdk/go/common/util/cmdutil 2020-03-18 15:39:00 -07:00
evanboyle
7ff46cb4fa move pkg/util/rpcutil -> sdk/go/common/util/rpcutil 2020-03-18 15:37:13 -07:00
evanboyle
c3f6ae2451 move pkg/util/logging -> sdk/go/common/util/logging 2020-03-18 15:34:58 -07:00
evanboyle
cdfb8608c9 move pkg/encoding -> sdk/go/common/encoding 2020-03-18 15:28:19 -07:00
evanboyle
30df499838 move pkg/version -> sdk/go/common/version 2020-03-18 15:25:25 -07:00
evanboyle
8df534a71e move pkg/diag -> sdk/go/common/diag 2020-03-18 15:09:29 -07:00
evanboyle
f754b486b8 move pkg/resource/config -> sdk/go/common/resource/config 2020-03-18 15:03:37 -07:00
evanboyle
67cb405c93 move pkg/apitype -> sdk/common/apitype 2020-03-18 15:00:30 -07:00
evanboyle
70f386a967 move pkg/tokens -> sdk/go/common/tokens 2020-03-18 14:49:56 -07:00
evanboyle
4fe4d48ec5 move pkg/util/mapper -> sdk/go/common/util/mapper 2020-03-18 14:47:37 -07:00
evanboyle
8a87090068 move pkg/util/httputil -> sdk/go/common/util/httputil 2020-03-18 14:45:00 -07:00
evanboyle
fccf301d14 move pkg/util/contract -> sdk/go/common/util/contract 2020-03-18 14:40:07 -07:00
evanboyle
8fb3f428b0 move pkg/workspace -> sdk/go/common/workspace 2020-03-18 14:35:53 -07:00
evanboyle
dfab571aac move pkg/resource/plugin -> sdk/go/common/resource/plugin 2020-03-18 14:26:24 -07:00
evanboyle
fba783caf9 move pkg/resource -> sdk/go/common/resource, but leave nested resource packages 2020-03-18 13:36:19 -07:00
evanboyle
7ea547a14d move sdk/go/pulumi-language-go -> pkg/cmd/pulumi-language-go 2020-03-18 12:49:56 -07:00
evanboyle
b7ea8198de move sdk/dotnet/cmd/pulumi-language-dotnet -> pkg/cmd/pulumi-language-dotnet 2020-03-18 12:45:33 -07:00
Evan Boyle
8b46e71887
Go plugin acquisition (#4060)
These changes implement `GetRequiredPlugins` for Go using a registry
mechanism and an alternate entry point for `pulumi.Run`. Packages that
require plugins are expected to register themselves with the Pulumi SDK.
When `pulumi.Run` is used and the `PULUMI_PLUGINS` envvar is truthy, the
program will dump a JSON-encoded description of its required plugins to
stdout. The language host then uses this description to respond to
2020-03-18 12:41:45 -07:00
evanboyle
6552df7139 fix python sdk Makefile, use common pkg/version.go 2020-03-18 12:33:18 -07:00
evanboyle
a73044247e move sdk/nodejs/cmd/pulumi-language-nodejs -> pkg/cmd/pulumi-language-nodejs 2020-03-18 12:25:07 -07:00
evanboyle
e2ee46fb23 move sdk/python/cmd/pulumi-language-python -> pkg/cmd/pulumi-language-python 2020-03-18 10:19:22 -07:00
Levi Blackstone
ee62f38ab9
Add ArrayMap builtin types to Go SDK (#4086)
Add support for maps of arrays of builtin types.
These types are of the form map[string][]builtin.
2020-03-16 20:41:08 -06:00
Levi Blackstone
ad1c884aad
Fix lint issue (#4088)
Linter was complaining about possibly nil dereferences,
but these are already checked with an assertion.
2020-03-16 16:45:02 -06:00
Mikhail Shilkov
dbe365376d
Add Stack Transformations to .NET SDK (#4008)
Stack transformations and integration tests
2020-03-16 17:40:52 +01: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
Tasia Halim
b6e5d2737d
Update Go logging to use LogArgs (#4078) 2020-03-13 13:30:05 -07:00
Luke Hoban
9da774e180
Fix Python mocks (#4074)
The original version of this code caused inconsistencies in the event
loop associated with a given thread. These changes elimintate the event
loop shenanigans the mocks were trying to play by updating _sync_await
to create an event loop if none exists in the current thread.

It's possible that this will cause problems if the tests run on a
different thread than the original program, as the tests are likely to
end up waiting on outputs created by the program, which is not supported
in Python.

Also adds test coverage of the mocking/testing support in Python.
2020-03-12 21:09:47 -07:00
Tasia Halim
ef6f0d4de4
Expose engine logging to Go SDK (#4069)
* expose engine logging to Go SDK

* added comments
2020-03-12 16:00:59 -07:00
Mikhail Shilkov
a95a4d1195
Unit testing in .NET (#3696)
Mock-based testing in .NET
2020-03-11 23:10:01 +01:00
Paul Stack
2a24470135
Merge pull request #4030 from pulumi/stack72/allow-go-run-windows
Windows requires applications to have exe extension
2020-03-09 17:36:10 +02: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
Evan Boyle
81b6afa3c7
Revert "GetRequiredPlugins for Go (#3830)" (#4034)
This reverts commit 3a2890c0cd.
2020-03-06 17:50:18 -08:00
Pat Gavlin
3a2890c0cd
GetRequiredPlugins for Go (#3830)
These changes implement `GetRequiredPlugins` for Go using a registry
mechanism and an alternate entry point for `pulumi.Run`. Packages that
require plugins are expected to register themselves with the Pulumi SDK.
When `pulumi.Run` is used and the `PULUMI_PLUGINS` envvar is truthy, the
program will dump a JSON-encoded description of its required plugins to
stdout. The language host then uses this description to respond to
`GetRequiredPlugins`.
2020-03-06 14:30:43 -08:00
Evan Boyle
e75dca1207
fix reflect panic (#4027) 2020-03-06 11:01:21 -08:00
stack72
7f86842c68 Windows requires applications to have exe extension
We need to ensure that if the pulumi application is prebuild on
Windows then it will have the exe extension otherwise it's not
a valid windows program

https://github.com/golang/go/wiki/WindowsCrossCompiling
2020-03-06 19:58:57 +02:00
Mikhail Shilkov
8e87b2b893
Relax the type check to accomodate what YAML parser returns (#4023)
Relax the type check to accomodate what YAML parser returns
2020-03-05 16:41:31 +01:00
Charly Román
560f1f130e Python SDK fix type annotations for Output.all and Output.concat 2020-03-03 22:00:37 -06:00
Evan Boyle
3b8ffd5731
Go SDK fix panic when dest is struct and input is ptr (#3986) 2020-03-03 09:07:06 -08:00
Tasia Halim
c96271b7a3
Support transformations in Go (#3978)
* started transformations for go sdk

* added first basic test

* added second test with child

* added RegisterStackTransformation

* added a couple tests to lifecycle_test

* update CHANGELOG and test

* included TODO for #3846
2020-03-02 13:59:11 -08:00
Evan Boyle
cd0025edb5
properly check for nil input or nil input pointer (#4010) 2020-03-02 12:48:30 -08: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
Evan Boyle
3627f4ce70
ignore internal properties when unmarshaling (#3996) 2020-02-28 10:01:35 -08:00
James Nugent
a1b55192dd Regenerate protocol buffers code 2020-02-28 11:53:47 +00:00
James Nugent
652bc7ab75 Upgrade Go gRPC library in go.mod 2020-02-28 11:52:22 +00:00
James Nugent
a291c44a0f Update protogen script to use build container
This updates the protocol buffers generation script in the SDK to use
the main Pulumi Build Container instead of a custom Docker image.

Note there are some path differences owing to the manner in which the
tools are installed in the Build Container, however the actual tool
instantiations are very similar.
2020-02-28 11:52:22 +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
Levi Blackstone
0931c0d419
Fix missing module import on Windows platform (#3983)
#3895 added a module import that apparently doesn't
exist on Windows. Check the platform before importing,
and skip this import for Windows.
2020-02-26 16:08:49 -07:00
James Nugent
666c5d5cdc Remove use of github.com/pkg/errors from Go SDK
In preparation for publishing a separate module of the Go SDK for Pulumi
on which providers can depend, we should reduce the dependency footprint
so as to cause end users as few issues as possible with transitive
dependency versioning.

This commit removes all use of `github.com/pkg/errors` from the Go SDK
to that end, replacing it with the standard `errors` package and `fmt`
for error formatting where appropriate. We use the new (as of Go 1.13)
"%w" syntax for wrapping errors, so this code is no longer compatible
with Go 1.12.
2020-02-26 16:27:07 +00:00
Evan Boyle
930adc0504
Add support for secrets in Go SDK (#3938) 2020-02-25 17:45:36 -08:00
Pat Gavlin
0aa208a306
Add comments to Go output resolution (#3975) 2020-02-25 13:26:43 -08:00
Erin Krengel
e660937bab
use version tag (#3961) 2020-02-24 17:11:56 -08:00
Lee Zen
33b232adc4
Fix a regression for CustomTimeouts in Python SDK (#3964)
* Fix a regression for CustomTimeouts in Python SDK
* Accept dict as well as CustomTimeouts object
2020-02-22 19:32:06 -08:00
Mikhail Shilkov
42d1a606a4
Simplify resource options (#3943)
Simplify resource options, making the base class abstract
2020-02-21 09:24:52 +01:00
Lee Zen
54d344f7c1
Serialize CustomTimeouts in Python SDK (#3920)
* Translate CustomTimeouts properly for RPC serialization
* Include integration test for custom timeouts
2020-02-13 10:40:56 -08:00
Mikhail Shilkov
f1cdce9488
Move .NET serialization attributes to Pulumi namespace (#3902)
Move .NET serialization attributes to Pulumi namespace, deprecate the ones in Pulumi.Serialization
2020-02-11 11:40:14 +01:00
Lee Zen
d68d22a541
Run dotnet test with version parameters so that it doesn't generate a differently versioned .nupkg file (#3888) 2020-02-10 14:43:43 -08:00
Levi Blackstone
7efb88de3e
Allow oversize protocol buffers (#3895)
Set an option to increase the memory limit on protobuf
parsing so that we can handle larger gRPC payloads.

Co-authored-by: Evan Boyle <EvanBoyle@users.noreply.github.com>
2020-02-10 15:30:42 -07: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
4a201a7dfd
Do not busy wait in Python. (#3892)
Instead, keep a stack of outstanding RPCs and await each in turn. This
allows the main loop to block instead of spin.

Fixes #3759.
2020-02-07 12:10:59 -08:00
CyrusNajmabadi
ee6b545358
Be resilient to duplicate tasks in our inflight task list. (#3887) 2020-02-06 15:29:41 -08:00
Evan Boyle
cea807a244
Go aliases (#3853) 2020-02-06 12:02:13 -08:00
Luke Hoban
5bf490228a
Use \n for provider protocol even on Windows (#3855)
The provider plugin protocol is to write a port number followed by `\n`.  We must guarantee we do that even on Windows, so must avoid Python `print` statements which implicitly rewrite newlines to platform specific character sequences.

Fixes #3807.
2020-02-06 11:34:05 -08:00
Evan Boyle
411f1a179a
Support stack references in Go SDK (#3829) 2020-02-06 10:00:46 -08:00
Mikhail Shilkov
169a1e6a70
Dictionary resource in .NET (#3828)
Dictionary resource for Kubernetes YAML support
2020-02-05 21:22:30 +01: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
Mikhail Shilkov
d46a1d1abb
Output watcher (#3836) 2020-01-30 08:05:47 +01: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
Pat Gavlin
a64616a0f9 Fix three bugs in the Go SDK
- Do not set top-level properties that were not provided
- Check for nil after awaiting inputs
- Check for interface-typed values, which can be produced by `Any`
- Pass a settable value to `awaitInputs` in `Any`
2020-01-27 09:14:23 -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
Pat Gavlin
47b7eaf484
Make primitive input types implement pointer types (#3806)
For example, pulumi.String also implements pulumi.StringPtr. This is
consistent with the output of the code generator, and makes optional
inputs much more ergonomic.
2020-01-25 12:19:00 -08:00
Evan Boyle
106154f1fc
fix python sdk stack ref regression (#3798) 2020-01-24 09:36:47 -08:00
Pat Gavlin
2f554d5cdc
Fix an assert in the Go SDK. (#3794)
This assert is not correct in the case of pointer input types, in
particular `pulumi.stringPtr`. Though these types are not assignable,
they are convertible.
2020-01-23 13:07:47 -08:00
Pat Gavlin
f9548b3095
Add coverage for pulumi.Fprintf. (#3782)
Just what it says on the tin.
2020-01-21 13:27:46 -08:00
Pat Gavlin
4611cbe645
Add more test coverage for builtins. (#3775)
- Test builtin Apply methods
- Test type-specific ToOutput methods
- Test pointer, array, and map indexers
2020-01-21 09:52:57 -08:00
Pat Gavlin
f168bdc1c2
Redesign the Go SDK resource/input/output system. (#3506)
The redesign is focused around providing better static typings and
improved ease-of-use for the Go SDK. Most of the redesign revolves
around three pivots:
- Strongly-typed inputs, especially for nested types
- Struct-based resource and invoke APIs
- Ease-of-use of Apply

1. Strongly-typed inputs

Input is the type of a generic input value for a Pulumi resource.
This type is used in conjunction with Output to provide polymorphism
over strongly-typed input values.

The intended pattern for nested Pulumi value types is to define an
input interface and a plain, input, and output variant of the value
type that implement the input interface.

For example, given a nested Pulumi value type with the following shape:

```
type Nested struct {
    Foo int
    Bar string
}
```

We would define the following:

```
var nestedType = reflect.TypeOf((*Nested)(nil)).Elem()

type NestedInput interface {
    pulumi.Input

    ToNestedOutput() NestedOutput
    ToNestedOutputWithContext(context.Context) NestedOutput
}

type Nested struct {
    Foo int `pulumi:"foo"`
    Bar string `pulumi:"bar"`
}

type NestedInputValue struct {
    Foo pulumi.IntInput `pulumi:"foo"`
    Bar pulumi.StringInput `pulumi:"bar"`
}

func (NestedInputValue) ElementType() reflect.Type {
    return nestedType
}

func (v NestedInputValue) ToNestedOutput() NestedOutput {
    return pulumi.ToOutput(v).(NestedOutput)
}

func (v NestedInputValue) ToNestedOutputWithContext(ctx context.Context) NestedOutput {
    return pulumi.ToOutputWithContext(ctx, v).(NestedOutput)
}

type NestedOutput struct { *pulumi.OutputState }

func (NestedOutput) ElementType() reflect.Type {
    return nestedType
}

func (o NestedOutput) ToNestedOutput() NestedOutput {
    return o
}

func (o NestedOutput) ToNestedOutputWithContext(ctx context.Context) NestedOutput {
    return o
}

func (o NestedOutput) Foo() pulumi.IntOutput {
    return o.Apply(func (v Nested) int {
        return v.Foo
    }).(pulumi.IntOutput)
}

func (o NestedOutput) Bar() pulumi.StringOutput {
    return o.Apply(func (v Nested) string {
        return v.Bar
    }).(pulumi.StringOutput)
}
```

The SDK provides input and output types for primitives, arrays, and
maps.

2. Struct-based APIs

Instead of providing expected output properties in the input map passed
to {Read,Register}Resource and returning the outputs as a map, the user
now passes a pointer to a struct that implements one of the Resource
interfaces and has appropriately typed and tagged fields that represent
its output properties.

For example, given a custom resource with an int-typed output "foo" and
a string-typed output "bar", we would define the following
CustomResource type:

```
type MyResource struct {
    pulumi.CustomResourceState

    Foo pulumi.IntOutput    `pulumi:"foo"`
    Bar pulumi.StringOutput `pulumi:"bar"`
}
```

And invoke RegisterResource like so:

```
var resource MyResource
err := ctx.RegisterResource(tok, name, props, &resource, opts...)
```

Invoke arguments and results are also provided via structs, but use
plain-old Go types for their fields:

```
type MyInvokeArgs struct {
    Foo int `pulumi:"foo"`
}

type MyInvokeResult struct {
    Bar string `pulumi:"bar"`
}

var result MyInvokeResult
err := ctx.Invoke(tok, MyInvokeArgs{Foo: 42}, &result, opts...)
```

3. Ease-of-use of Apply

All `Apply` methods now accept an interface{} as the callback type.
The provided callback value must have one of the following signatures:

	func (v T) U
	func (v T) (U, error)
	func (ctx context.Context, v T) U
	func (ctx context.Context, v T) (U, error)

T must be assignable from the ElementType of the Output. If U is a type
that has a registered Output type, the result of the Apply will be the
corresponding Output type. Otherwise, the result of the Apply will be
AnyOutput.

Fixes https://github.com/pulumi/pulumi/issues/2149.
Fixes https://github.com/pulumi/pulumi/issues/3488.
Fixes https://github.com/pulumi/pulumi/issues/3487.
Fixes https://github.com/pulumi/pulumi-aws/issues/248.
Fixes https://github.com/pulumi/pulumi/issues/3492.
Fixes https://github.com/pulumi/pulumi/issues/3491.
Fixes https://github.com/pulumi/pulumi/issues/3562.
2020-01-18 10:08:37 -05:00
James Forcier
bf84a3482b Add py.typed to Python package for PEP 561 compliance (#3704)
PEP 561 specifies that packages which contain either inline type hints
or type stubs should indicate their support for type hints via
including a file named `py.typed` in the root of the package. Since
Pulumi already includes inline type hints, adding `py.typed` to the
Python SDK simply allows these hints to be used by mypy.
2020-01-17 15:01:36 -08:00
Evan Boyle
972fc44dd7
Enable mypy (#3758) 2020-01-17 14:45:08 -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
Mikhail Shilkov
66de4a48b7
First-class Stack component for .NET (#3618)
First-class Stack component for .NET
2019-12-23 08:31:12 +01:00
Luke Hoban
95daaa8cec Fix broken test 2019-12-21 06:51:42 -08:00
Luke Hoban
265acaefe5
Fallback to looking for python when launching Python language host (#3692)
Fixes #3398.
2019-12-20 17:09:00 -08: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
Justin Van Patten
c6dea8c82f
Fix golangci-lint warning (#3651)
Fix the following lint warning:

```
WARN [runner/nolint] Found unknown linters in //nolint directives: intentionally running dynamic program name.
```
2019-12-12 22:25:56 +00:00
Justin Van Patten
a83a5d9605
.NET: Treat warnings as errors (#3650)
Fix the following warning and turn on "treat warnings as errors" for our .NET projects.

```
Deployment/InvokeOptions.cs(6,60): warning CS1574: XML comment has cref attribute 'InvokeAsync{T}(string,
```
2019-12-12 17:13:26 +00:00
Mikhail Shilkov
83a2fc2442
Fix serialization of InvokeArgs (#3614)
Fix serialization of InvokeArgs
2019-12-10 12:20:14 +01: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
Mikhail Shilkov
7b3ec744f4
Stack References in .NET (#3511)
Stack References in .NET
2019-12-05 13:16:39 +01:00
Mikhail Shilkov
84c2426f0b
Helper method to log an exception in .NET (#3602) 2019-12-04 11:02:03 +01:00
Justin Van Patten
eec14527b1
Use TypeScript's built-in Omit (#3597) 2019-12-02 22:50:18 +00:00
Evan Boyle
1ca50d4b89
Propagate parent and providers for go SDK calls (#3563) 2019-11-26 13:23:34 -08:00
CyrusNajmabadi
669b80af96
Support json values in the .net sdk (#3573) 2019-11-25 23:50:05 -05:00
Evan Boyle
c83e4f9ca6
Fix go SDK ReadResource (#3581) 2019-11-25 15:31:12 -08:00
Evan Boyle
a47103b49d
fix go sdk delete before replace implementation (#3572) 2019-11-25 14:10:06 -08:00
CyrusNajmabadi
048400b97e
Fix stackoverflow when checking conversion types. (#3559) 2019-11-21 18:36:01 -05:00
CyrusNajmabadi
d7e93472b3
Filter out internal properties when deserializing data (#3560) 2019-11-21 17:05:39 -05:00
CyrusNajmabadi
eedd277cd7 Update copyrights (#3557) 2019-11-21 22:46:14 +01: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
CyrusNajmabadi
b28a44063f
Add the concept of a Union type to use for apis that accept disparate types. (#3548) 2019-11-21 14:51:45 -05:00
CyrusNajmabadi
57421c1ab3
Allow arguments to Invokes to be non-inputs. (#3544) 2019-11-21 00:40:38 -05:00
Mikhail Shilkov
6f55e1a82a
Tests for .NET aliases (#3420)
Tests for .NET aliases
2019-11-20 22:07:56 +03:00