Commit graph

3127 commits

Author SHA1 Message Date
Emiliza Gutierrez 083ea657c1
Updating version of pulumi sdk used to v3.14.0 (#8150) 2021-10-06 11:30:24 -07:00
Liam White f545f56f1b
Turn off grpc info log in Provider (#7891)
Resolves https://github.com/pulumi/pulumi/issues/7156

Signed-off-by: Liam White <liam@tetrate.io>
2021-10-06 09:10:00 -07:00
Anton Tayanovskyy 5f9f38c9c9
Do not share maps so tests can run in parallel (#8136)
* Do not share maps so tests can run in parallel

* Fix comment

* Try not to break dependencies

* Address PR feedback

* Fix downstream compilation failure

* Fix lint

* Address PR feedback
2021-10-06 11:03:21 -04:00
Praneet Loke 13a0c8b2c5
[codegen/docs] Add Nomad to the docs gen title lookup (#8128) 2021-10-04 23:10:49 -07:00
Anton Tayanovskyy 1ee85d8d2f
Fix 8110 (#8116)
* Add a test demonstrating the problem

* Fix the bug

* Accept changes over the example set

* Accept go changes

* Accept python codegen; avoid nil lang info panic

* Accept .NET changes, compile

* Accept docs changes

* Add changelog notes

* Fix lint

* Add parens sparingly

* Flatten unions

* PR feedback
2021-10-04 17:26:49 -04:00
Alex Mullans d31c769267
Update gen.go 2021-10-01 14:46:46 -07:00
Justin Van Patten 230f4ee006
Support "lifting" single-valued method returns to their return type (#8111)
This change allows lifting single valued method returns rather than using an output structure.
2021-10-01 11:33:02 -07:00
Praneet Loke 8f89ab6e3a
[codegen/docs] Generate a package tree that can be serialized as JSON (#8102)
* Add an initialize func. Add a new func that generates the package tree
2021-09-30 17:35:44 -07:00
Anton Tayanovskyy 98ef06ecb8
Go codegen flag to disable fnOutput generation to save space (#8106) 2021-09-30 14:56:42 -04:00
Pat Gavlin f21eda521f
[codegen] Rename the PCL package. (#8103)
It's just confusing that PCL lives in a package named `hcl2`.
2021-09-29 20:11:56 -07:00
Vivek Lakshmanan 664f6eddbb
Merge pull request #8101 from pulumi/vl/Updatedocalias
Update doc alias
2021-09-29 17:06:54 -07:00
Pat Gavlin e6d95a8aa9
[engine/test] Add a repro for #7786. (#8097)
This test is derived from a user-reported issue rooted in dependencies
on remote comoponents.
2021-09-29 16:05:45 -07:00
Vivek Lakshmanan 4a3e00b86a Update doc alias 2021-09-29 13:33:27 -07:00
Ian Wahbe 9f6589ed8c
iwahbe/7802/compile program generator test output (#8036)
* Move program tests into folders

* update package schema

* Enabled tests pass

* Fix lints and begin to update test cases

* Re-enable tests

* Update aws version to v4

* Refactor language specific parts

* Hook up dotnet and nodejs

* Update tests from master

* SSOT for schema/version

* Name blocking errors. Leave tests in valid state

* Give each language its own folder

* Remove SkipCompile for azure-sa (bug was fixed)

* Fix nits + changes asserts to require

* Remove unused import

* One last assert => require
2021-09-29 11:33:57 -07:00
Paul Stack 09a8cc7079
[cli] Add the ability to control auto-refresh of stacks by Pulumi.yaml (#8071)
Co-authored-by: Komal Ali <komal@pulumi.com>
2021-09-29 12:43:48 +03:00
Ian Wahbe 9df8d3a028
Bold in-progress diffs diffrently (#7918)
* Initial take on coloring in-progress diffs

* Update CHANGELOG_PENDING.md

* Add high and low color levels

* Don't print functions

* Change colorprogress to bold

* Fix @komalali's nits.

* Restore background colors comment
2021-09-28 15:16:09 -07:00
Pat Gavlin 0a45f8d3ab
[codegen/go] Rewrite cyclic types. (#8049)
When computing the type name for a field of an object type, we must
ensure that we do not generate invalid recursive struct types. A struct
type T contains invalid recursion if the closure of its fields and its
struct-typed fields' fields includes a field of type T. A few examples:

Directly invalid:

    type T struct { Invalid T }

Indirectly invalid:

    type T struct { Invalid S }

    type S struct { Invalid T }

In order to avoid generating invalid struct types, we replace all
references to types involved in a cyclical definition with *T. The
examples above therefore become:

(1) type T struct { Valid *T }

(2) type T struct { Valid *S }

    type S struct { Valid *T }

We do this using a rewriter that turns all fields involved in reference
cycles into optional fields.

These changes also include an enhancement to the SDK codegen test
driver in the interest of making iterating and debugging more convenient:  if the -sdk.no-checks flag is passed, the driver will not run post-generation checks.
2021-09-28 07:33:14 -07:00
Justin Van Patten a182f103cf
Update pkg -> sdk dependency (#8088) 2021-09-27 23:05:36 -07:00
Justin Van Patten 472f14c992
Tidy pkg/go.sum (#8086) 2021-09-27 22:46:12 -07:00
Justin Van Patten 6f33762c32 Update pkg -> sdk dependency 2021-09-27 20:32:06 -07:00
Komal 74dfa83de5
[codegen/nodejs] - Fix provider enum with env var (#8051)
* Add failing test

* Fix

* PR feedback
2021-09-24 15:02:56 -07:00
Anton Tayanovskyy e14f74fbe7
Do report stdout and stderr in case of failure (#8055)
* Do report stdout and stderr in case of failure

* PR feedback
2021-09-24 15:25:30 -04:00
Justin Van Patten 3027d01f25
Enable output values by default (#8014)
* Enable output values by default

Enable output values by default in the resource monitor and change the polarity of the envvar from `PULUMI_ENABLE_OUTPUT_VALUES` to `PULUMI_DISABLE_OUTPUT_VALUES`.

* Marshal unknown as unknown string when `!KeepOutputValues`

Marshal all unknown output values as `resource.MakeComputed(resource.NewStringProperty(""))` when not keeping output values, which is consistent with what the SDKs do.

Otherwise, when `v.OutputValue().Element` is nil, `resource.MakeComputed(v.OutputValue().Element)` will be marshaled as a null value rather than as an unknown sentinel.

* Add MarshalOptions.DontSkipOutputs and use where needed

Before we expanded the meaning of `resource.Output`, `MarshalProperties` always skipped output values:

```go
if v.IsOutput() {
    logging.V(9).Infof("Skipping output property for RPC[%s]: %v", opts.Label, key)
}
```

As part of expanding the meaning of `resource.Output`, I'd adjusted `MarshalProperties` to only skip output values when the value was unknown and when not keeping output values:

```go
if v.IsOutput() && !v.OutputValue().Known && !opts.KeepOutputValues {
    logging.V(9).Infof("Skipping output property for RPC[%s]: %v", opts.Label, key)
}
```

However, this doesn't work the way we want when marshaling properties that include unknown output values to a provider that does not accept outputs. In that case, `opts.KeepOutputValues` will be `false` because we want the marshaler to fall back to returning non-output-values (e.g. unknown sentinel value for unknown output values), but instead of getting the intended fallback values, the unknown output values are skipped (not what we want).

I suspect we may be able to delete the output value skipping in `MarshalProperties` altogether (it's odd that it is skipping `resource.Output` but not `resource.Computed`), but to avoid any unintended side effects of doing that, instead, this commit introduces a new `MarshalOptions.DontSkipOutputs` option that can be set to `true` to opt-in to not skipping output values when marshaling. The check in `MarshalProperties` now looks like this:

```go
if !opts.DontSkipOutputs && v.IsOutput() && !v.OutputValue().Known {
    logging.V(9).Infof("Skipping output property for RPC[%s]: %v", opts.Label, key)
}
```

`opts.DontSkipOutputs` is set to `true` when marshaling properties for calls to a provider's `Construct` and `Call`.

* [sdk/nodejs] Deserialize output values

This commit adds support for deserializing output values, which is needed in some cases when serialized inputs are returned as outputs in the SDK.

* [sdk/python] Deserialize output values

This commit adds support for deserializing output values, which is needed in some cases when serialized inputs are returned as outputs in the SDK.
2021-09-24 08:57:04 -07:00
Komal b8b6f3dd70
[codegen/go] - Resolve type name collisions (#7985) 2021-09-23 15:42:48 -07:00
Ian Wahbe d43b8984fd
iwahbe/turn on dotnet compile checks (#8044)
* Add dotnet tests back in

* Merge in new test results from master

* re-enable output-funcs code
2021-09-23 14:31:17 -07:00
Anton Tayanovskyy 3f6f9bc398
Fix build by accepting nodejs codegen output (#8045) 2021-09-23 15:59:48 -04:00
Anton Tayanovskyy 49ccd9ac97
Simplify output-funcs codegen test (#8039)
* Consolidate output-funcs into a single normal schema.json

* Accept nodejs codegen output

* Accept dotnet output-funcs output; does not compile yet

* Accept docs output-funcs output

* Permit parallel test runs

* Accept nodejs codegen

* Fix and speed up Python codegen tests

* Dedup dash-named-schema

* Make dotnet tests pass

* Satisfy go lint
2021-09-23 13:42:20 -04:00
Komal 41b8882fe8
[codegen/nodejs] - Don't import types for functions if they don't exist (#8038)
* Add failing test

* Fix

* Update changelog

* Existing tests are sufficient
2021-09-23 10:12:27 -07:00
Ian Wahbe c9b719c6c0
Revert "Emit schema.Package.Version when possible (#7938)" (#8035)
* Revert "Emit schema.Package.Version when possible (#7938)"

This reverts commit 906dce73a1.

* Remove dotnet SDK compile checks

* Add to changelog
2021-09-22 19:39:07 -07:00
Komal 0bcf475573
Update SDK version in pulumi/pkg (#8027) 2021-09-22 13:16:08 -07:00
Anton Tayanovskyy 09aa2c677e
Fix master build (#8025)
* Fixing build failure

* Python manifest

* Dotnet manifest

* Node manifest

* Docs manifest

* Fix/restore test case running
2021-09-22 14:53:30 -04:00
Anton Tayanovskyy 49298fb433
Codegen testing upgrades (#7989)
* Multi-pass, in-place checks for SDK codegen tests; toward working Python checks

* Remove temp debug output

* Upgrade Node

* Update dotnet; need to follow up on version.txt quirks

* WIP

* Sounds like we can use non-github package names to ensure things are local

* Fix simple-enum-schema

* Fix dash-named-schema

* Fix nested-module

* Start building a test-running pass

* Infer skipping tests from skipping compiles

* Move tree schma tests to a proper place

* Address lint issues on Go code

* Build against local Go SDK

* Update pkg/codegen/internal/test/sdk_driver.go

Co-authored-by: Ian Wahbe <ian@wahbe.com>

* Make go tests work by copying them into the tree from go-extras

* Fix lint

* Fix bad merge

* Manifest-based file discovery

* Remove version-related TODO from dotnet codegen

* Add doc comment

* Do not overwrite go.mod if found from mixins

* Accept python codegen change

* Accept node codegen

* Ignore lint issue

* Accept docs changes

Co-authored-by: Ian Wahbe <ian@wahbe.com>
2021-09-22 13:55:20 -04:00
Pat Gavlin 134d7cb818
[apitype] Add a JSON schema for deployments. (#8002)
This schema can be used to validate the contents of a Pulumi deployment.
If a deployment validates against this schema, it should be considered
syntactically valid, though it may contain certain classes of semantic
errors (e.g. references to unknown resources in dependency lists,
dependency cycles, etc.).

This schema is not yet used for validation in practice and may not be
entirely accurate.

These changes also add this schema (and the schemas on which it depends)
to the developer documentation. jsonschema2md.go has been updated to
support multi-file schemas.
2021-09-21 21:37:06 -07:00
Evan Boyle adc0f2adeb
Use case insensitive checks when detecting duplicate type tokens (#8017) 2021-09-21 20:48:45 -07:00
Komal 3d42198991
Clean up diagnostic messages in event log (#7998)
* Don't escape characters in event log.

* Respect NO_COLOR
2021-09-21 17:22:39 -07:00
Pat Gavlin cbdecf2cd5
[testing] Add rapid generators for PropertyValues. (#8009)
And use those generators to test property value serialization and
deserialization paths.
2021-09-21 15:02:10 -07:00
Ian Wahbe 2e5fedff54
Switch from golint to revive (#8010) 2021-09-21 10:00:44 -07:00
Pat Gavlin 236ce54269
[schema] Add the Pulumi Package metaschema. (#7952)
The Pulumi Package metaschema is a JSON schema definition that describes
the format of a Pulumi Package schema. The metaschema can be used to
validate certain basic properties of a Pulumi Package schema, including
(but not limited to):

- data types (e.g. is this property a string?)
- data formats (e.g. is this string property a valid regex?)
- object shapes (e.g. is this object missing required properties?)

The schema binder has been updated to use the metaschema as its first
validation pass.

In addition to its use in the binder, the metaschema has its own page in
the developer documentation. This page is generated using a small tool,
jsonschema2md.go.
2021-09-20 12:00:42 -07:00
Ian Wahbe c338876b9f
iwahbe/7858/fix nodejs hypen imports (#7993)
* Add pascal name case

* Add test to prevent regressions

* Update CHANGELOG_PENDING.md

* Give node/tsc more memory

* Use camelcase instead of snake case

* Add clearer comments
2021-09-20 10:11:44 -07:00
Komal c7dbf4ad15
Rename PermaLink to Permalink (#7999) 2021-09-20 09:42:29 -07:00
Ian Wahbe 906dce73a1
Emit schema.Package.Version when possible (#7938)
* Emit schema.Package.Version when possible

* Update CHANGELOG_PENDING.md

* Correctly interpret python versions (I hope)

* Update PLUGIN_VERSION to the package version

* Modify tests to conform with master merge
2021-09-17 23:11:54 -07:00
Justin Van Patten d812d16329
[sdk/go] Unmarshal output values in component provider (#7975)
This adds support for unmarshaling output values in the CopyTo helper used when copying inputs to an args struct
2021-09-17 19:46:06 -07:00
Ian Wahbe 7f90e12886
Validate Name, Version and Enviroment (#7896)
* Validate Name, Version and Enviroment

For the full path:
Package.Name
Package.Version
Package.Property.Default

* Update tests

* Update CHANGELOG_PENDING.md

* Add more versions to tests

* Add another "Version" field

* Even more "version" tags

* One more "version" tag added

* Update test results from codegen

* Fix py codegen tests

* Fix doc test

* Remove `version` validation

* Unformat json files

* Fail only on errors
2021-09-17 12:12:22 -07:00
Justin Van Patten ed4b53d3ae
Add monitor feature for output values (#7870) 2021-09-15 14:16:00 -07:00
Ian Wahbe 67303e1b99
Run type checker against all languages (#7931)
We run the best static check we can on generated code, ensuring that it is valid. 

* Run type checker against all languages (not docs)

* Fix package location, add some deps for schemas

* More tests passing

* These tests finally work

* Make linter happy

* Fix tests for merge from master

* Opt out of input-collision(nodejs) test

* Get more visibility into testing nodejs

* Fix type assumption

* Specify ts-node version

* Retrofit typescript dependencies for node14

* Give each go instance it's own module

* Attempt to diagnose remote go mod init failure

* Provide root for go mod init

* Make linter happy
2021-09-15 09:49:36 -07:00
Ian Wahbe 3b7d78c126
Use json.Unmarshal instead of custom parser (#7954)
* Use json.Unmarshal instead of custom parser

* Update CHANGELOG_PENDING.md
2021-09-13 10:49:57 -07:00
Justin Van Patten 0c0684af5c
Initial support for (un)marshaling output values (#7861)
This change expands the definition of `resource.Output` in the Go SDK with additional information about the output, i.e. dependencies and secretness, and adds support in the core Go RPC code for (un)marshaling output values.

Output values are marshaled as special objects ala archives, assets, and resource refs and are unmarshaled as `resource.Output` values.

Subsequent PRs will add:
 - A monitor feature for output values, which will initially be disabled by default but available to turn on via an envvar
 - Support for (un)marshaling output values in each language SDKs
 - A way for providers to indicate support for receiving output values
 - E2E tests
 - Turn the monitor feature on by default (w/ env var to disable) (Note: the current plan is to initially scope this to only be used when marshaling inputs to a multi-language component)
2021-09-13 09:05:31 -07:00
T-Vova e696fb6c50
Implemented filebase64() support for Code Generator (#7863)
* Added filebase64 support for Golang

* Fixed function signature

* Added filebase64 support for Typescript

* Added filebase64 support for Python

* Added filebase64 support for Dotnet, fixed Sha1

* Fixed helper method list

Co-authored-by: Vova Ivanov <jetvova@gmail.com>
2021-09-10 23:09:28 +01:00
Ian Wahbe 5e65204463
Fixup for 7874 (#7921)
* Fix some nits from 7874

This was a premature merge

* Fix #7940

We don't surface recursion warnings if there is no child where `replaceOnChanges` is set.
2021-09-10 14:56:56 -07:00
T-Vova 87e4c92c66
Implemented sha1() support for Code Generator (#7834)
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
Co-authored-by: Vova Ivanov <jetvova@gmail.com>
2021-09-10 21:40:38 +03:00
T-Vova 913173a603
Revert "Fixed "unknown property '0'" error (#7912)" (#7939)
This reverts commit 8f40edc9e0.
2021-09-09 13:36:49 -10:00
T-Vova 8f40edc9e0
Fixed "unknown property '0'" error (#7912)
Co-authored-by: Pat Gavlin <pat@pulumi.com>
Co-authored-by: Vova Ivanov <jetvova@gmail.com>
2021-09-09 22:12:19 +03:00
T-Vova 90c0fa30af
Implemented file reading support for Go code generator (#7806)
Co-authored-by: Vova Ivanov <jetvova@gmail.com>
2021-09-09 22:10:25 +03:00
Anton Tayanovskyy 1647b2f021
Retry http downloads that intermittently fail builds (#7916)
* Retry http downloads that intermittently fail builds

* Address PR feedback
2021-09-08 17:37:57 -04:00
Anton Tayanovskyy c247f6e283
Fix 7913 Python codegen issue with double-quote inside docstrings (#7914)
* Introduce a test that showcases the invalid generated code

* Use shared printComment function

* Check for triple quote escaping

* Accept go

* Accept dotnet

* Accept nodejs

* Move codegen exampe into an existing schema

* Add CHANGELOG entry
2021-09-08 14:52:54 -04:00
Ian Wahbe 08b428ae96
Add replaceOnChange to schema (#7874)
* Add replaceOnChange to schema

* replaceOnChange at generate time for resources

* ReplaceOnChanges sees through optional types

* Correctly deal with map,array,object,resource type

This is responding to PR clarifications from @justinvp and @lblackstone.

* Update CHANGELOG_PENDING.md

* Detect recursively defined objects

* Display recursion warning

* Check which recursive structures fail

* Add internal logic tests for replaceOnChanges

* Add tests
2021-09-07 22:23:30 -07:00
Anton Tayanovskyy 27b1404d9e
Fix lint (#7915)
* Fix lint

* Fix lint of pkg folder
2021-09-07 16:41:17 -04:00
Evan Boyle 95aa47d3c6
[codegen/go] detect and avoid collisions in resource and type code generation (#7857) 2021-09-03 19:42:45 -07:00
Ian Wahbe 27fc39c00a Fix spelling of environment 2021-08-31 00:54:07 -07:00
Ian Wahbe 703104e412 Skip failing test on windows 2021-08-30 22:53:16 -07:00
Ian Wahbe 70833d3a3c Allow windows to find commands without .exe 2021-08-30 21:36:03 -07:00
Ian Wahbe a2250cc9ef
Merge branch 'master' into iwahbe/2715/add-pulumi-about-command 2021-08-30 22:50:51 -04:00
Pat Gavlin 76ee1b8ccf
[codegen/schema] Add a schema checker (#7865)
- Change the schema package to report semantic errors as diagnostics
  rather than Go errors
- Add a `pulumi schema check` command to the CLI for static checking of
  package schemas

The semantic checker can be extended in the future to add support for
target-specific checks.
2021-08-30 19:29:24 -07:00
Ian Wahbe 09c6a71b56 Fix typo 2021-08-30 19:02:07 -07:00
Ian Wahbe ea43fa2437
Merge branch 'master' into iwahbe/2715/add-pulumi-about-command 2021-08-30 21:57:20 -04:00
Ian Wahbe 43114007eb Whitespace and grammer 2021-08-30 18:56:02 -07:00
Anton Tayanovskyy 4380a63ad9
Implement 5758 {fn}_output codgen for Python (#7825)
* Implement 5758 {fn}_output codgen for Python

* Fix lint issues

* Accept codegen changes in expected examples

* Test and fix positional arg handling

* Add parameter descriptions to illustrate docstring codegen

* Generate docstrings

* Accept doc changes in expected go codegen file

* Use platform-agnostic API to drive Python tests
2021-08-30 16:52:58 -04:00
Ian Wahbe 1e0019340d Tolerate non semver version.Version 2021-08-28 16:01:19 -04:00
T-Vova 2c63e6fb77
Merge pull request #7792 from pulumi/t-vova/invalid-go-source-fix
Fixed invalid go source code issue
2021-08-27 19:49:30 -10:00
Ian Wahbe d82b560ae8 Fix nodejs direct dependencies 2021-08-27 15:42:05 -04:00
Ian Wahbe cdcabc34f3 Fix integration tests && found bug in nodejs -t 2021-08-27 14:25:10 -04:00
Ian Wahbe 878ab50044 Merge branch 'master' into iwahbe/2715/add-pulumi-about-command 2021-08-27 04:50:50 -04:00
Ian Wahbe 0d43d2c4a4 @jutinvp's improvements
These include:
1. Make transitive dependencies optional.
2. Use filepath instead of path.
3. Correctly consider the python virtual enviroments.
2021-08-27 04:37:09 -04:00
Ian Wahbe 6ac7798ea1 Check for no snapshot and no error 2021-08-25 11:55:28 -07:00
Ian Wahbe aece703e94 Respect linter and run yarn install for tests 2021-08-24 18:15:38 -07:00
Ian Wahbe bee803a970
Merge pull request #7824 from pulumi/iwahbe/7775/allow-hyphen-in-schema-path
Allow hyphen in schema path
2021-08-24 14:48:32 -07:00
Ian Wahbe d49a594093 Update tests and add integration test 2021-08-24 14:29:27 -07:00
Ian Wahbe 567ded6894 Directly compute dependencies 2021-08-24 12:37:35 -07:00
Ian Wahbe 61ef30cf82 Add tests for about 2021-08-23 15:24:33 -07:00
Ian Wahbe b30c57924a Move tests to correct location 2021-08-23 14:23:01 -07:00
Anton Tayanovskyy eef208633c
5758 for Go (#7784)
* Go support for 5758 - resurrect stale PR

* Fix listStorageAccountKeys test

* Check err so linter is satisfied

* Use all the examples

* Accept codegen results

* Regenerate with PULUMI_IGNORE_AMBIENT_PLUGINS=1

* Compile and test generated code as part of the test suite

* Add a CHANGELOG entry

* Remove temp test marker

* Shorten output type name

* Simplify code

* Add issue link

* Accept more codegen changes

* Use the suggested format for linking an issue
2021-08-23 16:46:09 -04:00
Ian Wahbe 9c02fe610f Allow hyphen in schema path
Fixes: https://github.com/pulumi/pulumi/issues/7775
2021-08-23 13:29:25 -07:00
Ian Wahbe 784c661c0c Make linter happy 2021-08-23 12:04:52 -07:00
Ian Wahbe b2090f636a Update go.sum and go.mod with go mod tidy 2021-08-23 10:59:40 -07:00
Ian Wahbe 2ccc8e2539 Merge branch 'master' of https://github.com/pulumi/pulumi into iwahbe/2715/add-pulumi-about-command 2021-08-23 10:36:58 -07:00
Ian Wahbe a00150900a Directly access the default logging dir 2021-08-23 10:05:00 -07:00
Justin Van Patten ac2ba6aadd
Avoid missing go.sum entry for module for new Go projects (#7808)
Change `pulumi new` to use `go mod tidy` rather than `go mod download` when installing Go project dependencies, to ensure the project is fully prepared to be used by `pulumi up`, avoiding `missing go.sum entry for module` errors.
2021-08-23 07:54:56 -07:00
Ian Wahbe cb3a267fd9 Cleanup error messages 2021-08-23 01:22:26 -07:00
Ian Wahbe 6c4f1814c7 Improve error messages 2021-08-23 01:09:50 -07:00
Ian Wahbe f75ddfc01d Refactor data into get and display components
This allows us to give the output in json.
2021-08-23 00:48:22 -07:00
Ian Wahbe d7ee074a68 Include package host version in about 2021-08-20 19:38:51 -07:00
Ian Wahbe e4e2b7c9d5 Limit plugins to project only + Nits
Change copywrite dates.
2021-08-20 16:53:14 -07:00
Ian Wahbe e52ceec0f3 Finish basic functionality for pulumi about
Now it's time for a design review.
2021-08-20 12:22:16 -07:00
Ian Wahbe 53eded1907 Get started on pulumi about command.
This will make it easier to submit debug information to those who work
on pulumi.
2021-08-19 18:49:28 -07:00
Roopak Venkatakrishnan da2bd2ab04
Update x/sys for sdk to support go 1.17 (#7781)
Co-authored-by: Levi Blackstone <levi@pulumi.com>
2021-08-19 17:11:26 -06:00
Anton Tayanovskyy 79931744b6
Fix order of go mod tidy (#7799) 2021-08-19 15:03:52 -04:00
Vova Ivanov 82c94b6bbd Fixed invalid go source code issue 2021-08-18 21:22:27 -10:00
Luke Hoban e0035a9cd2
Include transitive children in dependency list for deletes (#7788)
Fixes deletion order issues outlined in #7780 related to dependencies on multi language components not ensuring that all (transitive) children of the dependency are treated as dependencies.

Since the state file is not guaranteed to include all transitive dependencies explicitly specified (because dependencies on multi-langauge components will only include the dependency on the component itself, not all of it's transitive children), this PR enlightens the computation of dependencies for deletion ordering to expand the transitive dependency to include transitive children of direct dependencies.
2021-08-18 18:26:36 -07:00
Evan Boyle 68b4cd756d
stabilize go codegen for nested collection types (#7787) 2021-08-18 12:07:30 -07:00
Evan Boyle a0e402118f
[codegen/go] Fix generation of nested collection types and remove invalid args types (#7779) 2021-08-18 10:04:07 -07:00
T-Vova 065ae27b91
Fixed nil pointer error with BindExpressionText and typeExpr (#7766)
Co-authored-by: Vova Ivanov <jetvova@gmail.com>
2021-08-17 14:22:06 +03:00
Pat Gavlin 8f9a13a76f
[sdk/go] Fix a typo in marshaling. (#7768)
A few identically-typed variables got confused with the changes in #7737.
The confusion caused empty property values to be included in resources
that had any dependencies on other resources, which confused the
unmarshaling code for Go multi-language components. These changes fix
the typo and restore the original behavior, which is to omit empty
property values.

Co-authored-by: Emiliza Gutierrez <emiliza@pulumi.com>
2021-08-16 19:01:20 -05:00
Pat Gavlin e678b798fe
[backend/http] Better lease renewal diagnosability (#7761)
- Add context to the lease renewal failure error
- Spew to the -v=3 logs when lease renewal fails

Fixes #3055.
2021-08-13 15:14:07 -05:00
JasonWhall 93be963d6e
Stop printing value if it looks like a secret (#7327)
Stop printing secret value on `pulumi config set` if it thinks it may be a secret value. Instead, print the config key name.
2021-08-13 06:07:52 -07:00
Justin Van Patten 1094d66659
Fix lint error (#7757) 2021-08-12 17:20:13 -07:00
Justin Van Patten 2b97340133
[codegen/docs] Emit docs for methods (#7731) 2021-08-12 14:31:15 -07:00
Pat Gavlin 64696b42b8
[sdk/providers] Fix update previews (#7560)
Do not return the inputs as the state for update previews that use an
unconfigured provider. Returning the inputs as the state allows the
language SDKs to incorrectly treat unknown properties as known (because
we can't call `Update` on an unconfigured provider, we can't know which
properties are unknown). Users can re-enable the existing behavior by
setting the `PULUMI_LEGACY_PROVIDER_PREVIEW` environment variable to a
truthy value (e.g. `1`, `true`, etc.).

Most users will be unaffected by these changes. The most common programs
that may be affected are those that combine the creation of a managed
Kubernetes cluster with the deployment of applications to that cluster. These
programs generally need to configure a k8s provider instance by constructing
a kubeconfig from the output of the managed k8s cluster. Any changes to the
cluster that cause the kubeconfig to be unknown then cause the provider to
go unconfigured at runtime. Prior to these changes, resources managed by the
k8s provider would have some known outputs in this scenario, as the engine
would treat the resource's input values as its output values. After these changes,
the resource's outputs will be treated as unknown. The most frequent affect
that this has is that applies/stack outputs that depend on the outputs of
a k8s resource managed by a provider with an unknown kubeconfig will not
run/be displayed as `output`s during previews, respectively.

We might be able to improve on this by taking advantage of schema
information and filling in unknown values for properties that do not
exist in the inputs.

Fixes #7521.

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
Co-authored-by: Luke Hoban <luke@pulumi.com>
2021-08-10 19:44:15 -05:00
Mikhail Shilkov 9c501b5bed
Fix Go generation for top-level module resources in a provider with a dash in name (#7692)
* Fix Go generation for top-level module resources in a provider with a dash

* Add tests
2021-08-10 08:58:24 +03:00
Komal 24802142f2
[programgen] - Fix a panic in property binding (#7718) 2021-08-09 14:24:08 +03:00
Pat Gavlin 594fca76d2
[codegen/go] Unify some output type generation (#7662)
These changes take a step towards simplifying and unifying the
generation of output types in the Go SDKs, especially for pointer,
array, and map outputs. This code was previously duplicated amongst the
various specialized output type generators, which led to inconsistencies
between the various implementaitons.

This is prep work for fixing #7595.
2021-08-02 13:43:24 -07:00
Vivek Lakshmanan 3b009c1266
Assertion fix in config key generation (#6902) 2021-08-02 12:22:09 -07:00
Anton Tayanovskyy ab7d4263b4
Fix IDE completion issues for lazy imports (#7487)
* Improve codegen import code completion python experience

* Accept codegen changes
2021-07-30 16:35:02 -04:00
Chris Smith 883bb76a69
Paginate backend list operations (#7600)
* Paginate backend::List*

* Update filestate backend

* Update httpstate backend

* Update pulumi CLI commands

* Rebase with 'master', fix merge conflict in CHANGELOG_PENDING.md

* Resolve merge conflicts / errors
2021-07-29 13:37:17 -07:00
James Nugent 11fc7e7f2b
Add provider.MainWithOptions helper function (#7598)
This commit adds a new counterpart to `ComponentMain` which accepts
an options struct for specifying callback functions. Currently it
supports `construct` (for components) and `call` (for methods), but is
extensible in a non-breaking fashion in future to support all other
provider methods as they become useful to implement.

The original `ComponentMain` still exists, though it may be desirable to
deprecate it in future in favor of `MainWithOptions`.
2021-07-29 10:31:09 -07:00
Justin Van Patten 88305ba896
Update test data for docs template change (#7678) 2021-07-29 10:15:03 -07:00
Pat Gavlin 1409d88438
[codegen/*] Add join and toBase64 functions. (#5012)
Co-authored-by: Komal Ali <komal@pulumi.com>
2021-07-28 20:41:23 -07:00
David Wrede 878af7aecf
Updating doc links to align with changes in docs #4707 (#6157)
Co-authored-by: David Wrede <dave@pulumi.com>
2021-07-28 14:14:48 -07:00
Evan Boyle f4efb7564b
Respect provider aliases (#7166) 2021-07-28 12:12:53 -07:00
Komal ae87b86e25
Include children when targeting components. (#7605) 2021-07-27 19:17:54 -07:00
Luke Hoban fa6375999e
[backend/filestate] Allow pulumi stack ls to see all stacks regardless of passphrase (#7660)
* [backend/filestate] Allow `pulumi stack ls` to see all stacks regardless of passphrase

The information exposed via `pulumi stack ls` does not require being able to decrypt state files, but the existing logic for `pulumi stack ls` with the filestate backend was to fully decrypt the state file anyway, silently skipping any stacks that could not be decrypted.  This led to surprising results from `pulumi stack ls`.

After these changes, `pulumi stack ls` with the filestate backend will list *all* stacks that are available.  Notably, because there is no notion of "project" scoping in the fielstate backend (yet), `pulumi stack ls` will list all stacks independent of the project name.

Fixes #4798.
2021-07-27 18:37:25 -07:00
Komal fddeea8a88
[codegen] Unify program codegen testing (#7657)
* ProgramGen test driver

* Refactor to avoid exporting hcl2 entities
2021-07-27 18:00:39 -07:00
Justin Van Patten 1141dd4c98
[codegen/dotnet] Emit resource methods (#7606) 2021-07-27 16:42:17 -07:00
James Nugent 4a035c44aa
Allow setting plugin name and version for Node.js (#7631)
This commit adds two new fields to the Node package info struct to
permit setting the plugin name if it differs from the package name, and
the version if it differs from the package version. This was already
supported by the loader.
2021-07-27 11:34:22 -07:00
Justin Van Patten 42a1896bf9
[codegen/python] Delete dead code around casing tables (#7647)
Coincident with the release of Pulumi 3.0, we updated the provider SDK codegen for Python to no longer use casing tables for translating Python snake_case names to Pulumi camelCase names (and vice versa). Instead, the mapping is encoded in decorators applied on class properties.

Some of the code that was used to generate and use the casing tables has persisted. This commits removes this code, as it's no longer necessary, and will improve the quality of our generated examples.
2021-07-27 08:37:49 -07:00
Pat Gavlin 91683242d0
[codegen/go] Unify input method generation. (#7643)
The code for input method generation was duplicated. These changes
remove the duplicated code.

This is prep for fixing #7595.
2021-07-26 19:23:17 -07:00
Pat Gavlin a4ee050afc
[sdk/dotnet] Fix collections in input unions. (#7601)
Collection types nested inside of Input<Union<...>> types need to abide
by the usual rules for collection types nested inside of input types.
These changes replace the use of the generic SimplifyInputUnion with a
.NET-specific simplifyInputUnion that does not remove Input types
inside of a union if those Input types wrap collection types. Retaining
these Input types allows the usual logic for handling
Input<Collection<...> types in typeString to kick in.

Fixes #7569.
2021-07-22 13:11:33 -07:00
Komal 131ac1ba61
[cli] - Don't escape special characters when printing JSON (#7593)
Co-authored-by: Pat Gavlin <pat@pulumi.com>
2021-07-21 15:16:49 -07:00
Komal a1b7f64bdd
[docgen/go] - Fix go docgen links for pulumi types (#7558) 2021-07-20 15:57:48 -07:00
Komal 5de09409f6
[codegen/dotnet] - Dynamic provider config getters (#7549) 2021-07-20 10:22:45 -07:00
Mikhail Shilkov 6fbe6ad651
Set UseSharedCompilation to false (#7577) 2021-07-20 15:50:37 +02:00
Pat Gavlin 28b1a25629
[codegen/python] Improve program gen perf. (#7547)
- Only build casing tables once per package
- Right-size buffers in name generation

These changes lead to a significant speedup in example gen for
azure-native.
2021-07-16 15:45:00 -07:00
James Nugent e6981898eb
Update package import handling for Node.js (#7474)
* Allow non-pulumi imports for Node.js

Currently the code generator is assuming that Node.js dependencies are
following a naming scheme that is prefixed with `pulumi/`. If this is
not the case the generated import statement is incorrect.

This commit adds a map `ProviderNameToModuleName` to the language
definition that allows you to map the name of the extracted provider of
a dependency to a module name that the generator now uses to create the
import statement.

* Prepend "pulumi" to import names in Node.js SDK

It is common when writing multi-language components to have a module
name which conflicts with a provider name. This can produce unusable
code, since you cannot simultaneously import a package as `aws` and have
a namespace `aws`, for example.

This commit makes this situation much less likely, by renaming the
imported identifier for providers to `pulumiX` where it would
previously have been `x`.

This has an unfortunate side effect of making the examples in the
documentation slightly uglier, since import statements for third-party
packages are now of the form `import * as pulumiAws from "@pulumi/aws"`.
I don't see a way to discern whether code generation is for SDKs vs
examples however, and short of plumbing that through, I don't see a way
around this, so test expectations are updated accordingly.

Co-authored-by: Ben Schiborr <bschiborr@apple.com>
2021-07-16 10:27:20 -07:00
Pat Gavlin 9b23badedd
[codegen/hcl2] Improve ConversionFrom perf. (#7545)
- Lazily produce conversion failure diagnostics. This lowers the
  allocation volume and cuts down on execution time by avoiding the
  conversion of source and dest types to strings.
- Add a fast path for union conversions that checks if the source type
  is identical to any of the union's element types. Type equality
  checks are generally much faster than type conversion checks.

These changes lead to a significant speedup in codegen time in
azure-native.
2021-07-16 09:56:26 -07:00
Komal 490e9cf477
[codegen/nodejs] - Dynamic provider config getters (#7530) 2021-07-16 09:52:45 -07:00
Komal 01321187a9
[codegen/python] - Fix required vs default values in provider config (#7536) 2021-07-16 09:48:03 -07:00
Emiliza Gutierrez 55ed50f87a
Normalize cloud URL during login (#7544) 2021-07-16 09:45:57 -07:00
Pat Gavlin d5e6d2206b
[codegen/go] Improve codegen performance. (#7546)
- Track which languages have been imported for a package. If a language
  has already been imported, do not re-run its importers.
- Track which package contexts have been loaded in the Go code
  generator, and do not reload a context that already exists.

These changes shave a profound amount of time off of codegen in
azure-native, speeding things up by a factor of 5.
2021-07-16 07:50:35 -07:00
Pat Gavlin 80d35758d5
[codegen/pcl] Allocate fewer type instances. (#7548)
When converting a `schema.InputType` to a `model.Type`, calculate the
resolved form of the type in the schema type system rather than the
model type system. The results are semantically identical, but the
number of type objects that are allocated is much smaller b/c
`model.NewOutputType` no longer allocates.

This deserves a little more explanation.

In order to prevent nested outputs and/or promises, `model.NewOutputType`
calculates the resolved form of its argument prior to allocating a new
`OutputType` value. Calculating the resolved form of the argument is a
no-op if the argument is already fully resolved. Therefore, passing in a
fully-resolved schema type prevents `model.NewOutputType` from
calulating the resolved form, and `model.NewOutputType` will only
allocate the `OutputType` itself instead of the `OutputType` and the
resolved form of any eventuals present in its argument.

This has a _very important_ knock-on benefit: the schema -> model type
translator ensures that given a `schema.Type` instance `T` it will
always return the same `model.Type` instance `U`. This termendously
speeds up type equality checks for complex types, as they will now be
referentially identical.

This change alone gives a significant speedup in azure-native code
generation.
2021-07-16 07:49:24 -07:00
Justin Van Patten cb564608b1
[codegen/nodejs] Fix missing args param (#7539) 2021-07-15 16:33:32 -07:00
Mikhail Shilkov f2f918799d Rename Azure to Azure Classic in reference docs 2021-07-15 10:35:12 +02:00
Justin Van Patten df20cc551d
Fix codegen tests (#7531)
The PR for these codegen changes was opened before these tests were added.
2021-07-14 22:43:56 -07:00
James Nugent 257c176dc0
Use variable over placeholder for Python version (#7479)
This commit modifies the generation of `setup.py` to use Python
variables as the source for the package version and plugin version
instead of placeholder strings. This has the effect of making the
packages installable via the `-e` flag directly from their source
directory rather than requiring a build step, which is useful while
developing a plugin and examples in tandem.
2021-07-14 16:44:22 -07:00
James Nugent 59a320f050
Stop producing pointers for map and slice elements (#7472)
This commit modifies Go program generation to prevent producing array
and slice object elements as pointers in args structures, which fails at
runtime and does not make sense in any case. For example, in the case of
a type defined like this in schema:

```json
"statements": {
  "type": "array",
  "items": {
    "$ref": "/aws/v4.8.0/schema.json#/types/aws:iam/getPolicyDocumentStatement:getPolicyDocumentStatement"
  }
},

```

The following (which fails at runtime) was produced before this change:

```go
Statements []*iam.GetPolicyDocumentStatement `pulumi:"statements"`
```

And the following is produced after after this change:

```go
Statements []iam.GetPolicyDocumentStatement `pulumi:"statements"`
```

Test expectations are updated accordingly.
2021-07-14 15:12:25 -07:00
James Nugent c94f923774
Fix Node.js intermediate module import path generation (#7473)
This commit fixes code generation for intermediate module paths to
produce valid TypeScript identifiers.

Before this change, the following (non-compilable) import was produced
in `./jetstack/certmanager/acme`:

```
import * as jetstack/certmanager/acme/v1alpha2 from "./jetstack/certmanager/acme/v1alpha2";
```

After this change, the following import is produced:

```
import * as v1alpha2 from "./v1alpha2";
```

This example is repeated at each level of the module tree. Test
expectations are adjusted to reflect this change.
2021-07-14 15:12:15 -07:00
James Nugent 1b78e3dd63
Respect package import alias for top-level module (#7471)
This commit modifies the Go code generator to use configured aliases for
the root package name of a Go module. This is useful when a version 2
package is present, as it prevents generation of identifiers such as
"v2" which were produced by the old logic.
2021-07-14 15:12:07 -07:00
Komal 083fc64ff5
[codegen/python] - Implement dynamic config-getters (#7447) 2021-07-14 14:26:50 -07:00
Pat Gavlin 067b630366 [codegen] Update baselines.
Two PRs that touched codegen raced and left the baselines in a bad
state.
2021-07-13 19:30:28 -07:00
Pat Gavlin 4d1ca1596b
[codegen/schema] YAML {un,}marshaling support. (#7509)
These changes add support for unmarshaling and marshaling package
schemas using YAML instead of JSON. Language-specific data is
canonically JSON. Users of the `*Spec` types will need to update the
types of the the their `Language` values to use the new
`schema.RawMessage` type instead of `json.RawMessage`: the former has
support for YAML while the latter does not.
2021-07-13 16:41:40 -07:00
Komal 0e3665f9bd
Emit To[ElementType]PtrOutput methods for go enum output types (#7499) 2021-07-13 12:54:19 -07:00
Pat Gavlin 82c631bb2b
[codegen/nodejs] Fix required input annotations. (#7497)
Ensure that required input properties that are _not_ mentioned in the
NodeJS-specific required inputs metadata are made optional.
2021-07-13 09:39:58 -07:00