Commit graph

4294 commits

Author SHA1 Message Date
Luke Hoban 74ffbfd9ba
Ensure new provider is registered when provider diff is unknown (#4051)
The changes in #4004 caused old provider configuration to be used even when a provider was different between inputs and outputs, in the case that the diff returned DiffUnkown.

To better handle that case, we compute a more accurate (but still conservative) DiffNone or DiffSome so that we can ensure we conservatively update to a new provider when needed, but retain the performance benefit of not creating and configuring a new provider as much as possible.

Part of https://github.com/pulumi/pulumi-aws/issues/814.
2020-03-10 19:40:25 -07:00
Paul Stack e229492d8f
Merge pull request #4005 from pulumi/dep-ensure-go-project
Run Dep Ensure when testing Go integration projects
2020-03-10 10:52:58 +02:00
stack72 f11b7129a0 Run Dep Ensure when testing Go integration projects
Fixes: #3939
2020-03-10 03:11:44 +02:00
Paul Stack 4ec9667a9f
Merge pull request #4043 from pulumi/fix-pygen-overlays
Ensure python overlays work as expected
2020-03-10 00:44:11 +02:00
stack72 b100f8494e Ensure python overlays work as expected
Fixes: https://github.com/pulumi/pulumi-terraform-bridge/issues/119

This allows us to specify an overlays block e.g.

```
Overlay: &tfbridge.OverlayInfo{
	DestFiles: []string{
		"pulumi_docker/docker.py",
		"pulumi_docker/image.py",
	},
},
```

The overlays files are treated differently to normal module files
as they are not generated. This structure means that we will emit
the correct entries in the __init__.py file

Without this structure (ie. pulumi_pkgname), the generator actually
copies the file (i.e. docker.py) to the root of the Python SDK. This
is because the structure of the Python SDK has a sub-folder than that
of the NodeJS SDK

I tested this using PR https://github.com/pulumi/pulumi-docker/pull/141
and this now works as expected and we can take advantage of the new
Python overlays for Docker
2020-03-10 00:03:41 +02:00
Praneet Loke edbb05dddd
Update schema-based docs generator (#4035)
* Update properties.tmpl to render property comment as-is. WIP splitting out properties to lang-specific tables.

* Generate the constructor dynamically from the resource per language.

* Add doc functions in each language generator package for getting doc links for types..and later other functions too.

* Render the constructor params in the Go code and inject into the template.

* Generate nodejs types using the nodejs lang generator.

* Add a templates bundler. Added a new Make target for autogenerating a static bundle for the resource docs generator.

* Generate type links for all languages based on their schema type. Render the property type with a link if the underlying elements have a supporting type. Fix word-breaks for Python type names.

* Various changes including the introduction of an interface type under the codegen package to help with generating some language-specific information for the resource docs generator.

* Add a function to explicitly generate links for input types of nested types. Fix the resource doc link generator for Go. Don't replace the module name from the nodejs language type.

* Fix bug with C# property type html encoding.

* Fix some template formatting. Pass the state inputs for Python to generate the lookup function for it.
* Do not generate the examples section if there are none.

* Generating the property types per language.

* Formatting. Rename function for readability.

* Add comments. Update README.

* Use relative URLs for doc links within the main site
2020-03-09 10:35:20 -07: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
Paul Stack d9acfc3190
Merge pull request #4022 from pulumi/stack72/gh-4013
Stop new projects starting with the word Pulumi
2020-03-05 18:22:17 +02:00
stack72 3863c6de1a Stop new projects starting with the word Pulumi
Fixes: #4013

Without this, we are in a situation where we have a cyclic import
2020-03-05 17:43:42 +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
Pat Gavlin dbb5b04d2f Update the CHANGELOG for v1.12.0 2020-03-04 13:35:45 -08:00
Luke Hoban 094df2b794
Merge pull request #4016 from Carlangueitor/fix-typehint-output
Python SDK fix type annotations for `Output.all` and `Output.concat`
2020-03-03 20:32:55 -08: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
Erin Krengel e9ea78cabb
remove UpdatePolicyPackConfig from UpdatePolicyGroupRequest (#4011) 2020-03-02 15:40:54 -08:00
Justin Van Patten acd6a5e753
Don't mark policy and watch commands as experimental (#4001) 2020-03-02 14:23:40 -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
Paul Stack dbb800834d
Merge pull request #3898 from pulumi/windows-builds-on-gha
Build the windows build on GHA rather than AppVeyor
2020-03-02 23:04:23 +02: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
Luke Hoban 2067e27ee6
Avoid configuring providers twice during preview (#4004)
In the very common case where provider configuration does not change, during preview we were calling `Configure` on the cloud provider twice - once for the "old" configuration, and once for the "new" configuration.

This is not necessary, and we can just avoid using the new provider when configuration has not changed, since we will have configured the old provider very early so if we can use that we should.

Note that this technically doesn't prevent the second call to `Configure` from being made, but it prevents us from ever waiting on it.  We may want to go further and avoid even calling `Configure` on the provider in this case.

Part of #3671.
2020-03-01 14:41:46 -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
Chris Smith 9d1edad65c
Improve error message for policy pack not found (#3967) 2020-02-28 12:48:53 -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 24b93e4c10 Address PR feedback from #3980. 2020-02-27 16:24:13 -08: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
Pat Gavlin f42d7e756a
Add an HCL2 syntax helper package. (#3980)
These changes add a helper package for parsing HCL2 syntax files. The
helpers are intended to provide direct access to syntax elements that
are abstracted away by the standard HCL2 parser. The bulk of the code
deals with mapping syntax nodes to their relevant tokens in order to
avoid losing information about the comments associated with syntax
nodes.
2020-02-27 12:49:15 -08:00
Justin Van Patten db559214e8
Initial schema-based docs gen (#3988)
Many TODOs and follow-ups remain, but this is the start of our
schema-based docs generation.
2020-02-27 10:04:34 -08:00
stack72 985084651c Trying to build the windows build on GHA rather than AppVeyor 2020-02-27 17:11:39 +02: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
Pat Gavlin 8a0987c892 Update the CHANGELOG for 1.11.1. 2020-02-26 10:42:45 -08:00
Erin Krengel 111c63fbe9
fix permalink (#3970) 2020-02-26 09:45:39 -08:00
James Nugent ec539bbb6c
Merge pull request #3977 from pulumi/jen20/remove-pkg-errors-from-sdk
Remove use of `github.com/pkg/errors` from Go SDK
2020-02-26 17:39:11 +00: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 1ce3d09a4b
add orgName as subdir to policies cache dir (#3971) 2020-02-25 09:38:58 -08:00
Erin Krengel e660937bab
use version tag (#3961) 2020-02-24 17:11:56 -08:00
Erin Krengel 5e31ac9f9c
Add disabled to enforcement level type (#3969) 2020-02-24 16:20:23 -08:00
Justin Van Patten e48a585b1a
Fix panic on failed stack policy (#3960)
Avoid panic during stack validations. This regressed recently when the PAC error output was modified.
2020-02-24 07:04:35 -08:00