Commit graph

366 commits

Author SHA1 Message Date
Ian Wahbe 4b7985384c
[codegen/go] Call site defaults for Pulumi Object types (#8411)
* Add test case

* Fix tests

* Add test dependencies correctly

* Feed through error handling

* Include test output

* Get types to line up

* Add remaining test files

* Update changelog

* Correctly find type paths

* Handle transitive objects

* Handle required fields

* Add feature flag for go

* Add required+default test case

* Don't `<any>` cast known types.

* Add more flags.

I realize this should really wait for PR#8400 to merge.

* Add plain object to env-helper test

This test fails right now. My next problem is fixing it.

* Handle plain types

* Handle function inputs

* Fix the indentation

* Handle output types correctly

* Remove unnecessary `!`

* Add test case

* Fix tests

* Add test dependencies correctly

* Feed through error handling

* Include test output

* Get types to line up

* Add remaining test files

* Update changelog

* Correctly find type paths

* Handle transitive objects

* Handle required fields

* Add required+default test case

* Don't `<any>` cast known types.

* Add plain object to env-helper test

This test fails right now. My next problem is fixing it.

* Handle plain types

* Handle function inputs

* Fix the indentation

* Handle output types correctly

* Remove unnecessary `!`

* Start on `genPlainObjectDefaultFunc`

* Add missing change to fix test

* Run tests with merge

* Refactor out assign

* Merge in next _index.md diff

* Change method name to `Defaults`

* Handle enums correctly

* Another attempt at _index.md

* Make module generation deterministic

* Add checks for old values

* Insert defaults in resources

* Fix docs generation

Credit to @praneetloke

* Progress on adding defaults to Resource arguments

* Handle resource argument defaults

* Don't create defaults if disableObjectDefaults

* Rename test folder

* Add test for disable flag

* Fix disable test

* Update docs

* Abstract out nil comparisons

* Use reflection to test for empty values

* Simplify Ptr and pulumi.Any type handling

* Remove unused function

* Apply defaults to functions

* Update new test with master codegen

* Tests + nil check
2021-11-23 15:10:15 -08:00
Pat Gavlin 52d01bb915
[codegen/go] Remove ResourcePtr input/output types (#8449)
These changes remove the `Ptr` variants of input/ouptut types for
resources. A `TPtr` input or output is normally generated for `T` if `T`
is present in an `optional(input(T))` or `optional(output(T))` and if
the Go representation for `T` is not nilable. The generation of `Ptr`
variants for resource types breaks the latter rule: the canonical
representation of a resource type named `Foo` is a pointer to a struct
type named `Foo` (i.e. `*Foo`). `Foo` itself is not a resource, as it
does not implement the Go `Resource` interface. Because this
representation already accommodates `nil` to indicate the lack of a
value, we need not generate `FooPtr{Input,Output}` types.

Besides being unnecessary, the implementation of `Ptr` types for
resources was incorrect. Rather than using `**Foo` as their element
type, these types use `*Foo`--identical to the element type used for
the normal input/output types. Furthermore, the generated code for
at least `FooOutput.ToFooPtrOutputWithContext` and `FooPtrOutput.Elem`
was incorrect, making these types virtually unusable in practice.

Finally, these `Ptr` types should never appear on input/output
properties in practice, as the logic we use to generate input and output
type references never generates them for `optional({input,output}(T)).
Instead, it generates references to the standard input/output types.

Though this is _technically_ a breaking change--it changes the set of
exported types for any package that defines resources--I believe that in
practice it will be invisible to users for the reasons stated above.
These types are not usable, and were never referenced.

This is preparatory work for #7943.
2021-11-23 10:24:56 -08:00
Ian Wahbe e77d780370
Cleanup CHANGELOG_PENDING.md (#8482) 2021-11-22 16:59:22 -08:00
Ian Wahbe 4029a1c89b
iwahbe/8474/dont serialize unknown values (#8475)
* Don't serialize unknown values

* Add test

* Update CHANGELOG_PENDING.md
2021-11-22 12:40:17 -08:00
Ian Wahbe d9dd88c740
Add tsconfig option to specify tsconfig path (#8452)
* Add tsconfig option to specify tsconfig path

* Add CHANGELOG entry and fix lint

* Add a test

* Fix test
2021-11-22 11:42:39 -08:00
Ian Wahbe 87d8c7f074
[sdk/pthon] Version Check: Handle virtual env correctly (#8465)
* Handle virtual env correctly

* Add CHANGELOG entry

* Correctly display which version is EOL
2021-11-19 15:21:13 -08:00
Ian Wahbe 7222e5570a
[cli] check main after master (#8463)
* Allow specifying a branch with url#branch

* Probe for master and main

* Update CHANGELOG

* Fix linter errors

* Remove unnecessary feature

* Fix lint

* Update changelog to reflect new limited scope.

We only talk about the master -> main probing, because that is all the
PR does. It used to duplicate another feature.
2021-11-19 13:49:59 -08:00
Praneet Loke 2c25c3fbd0
[backend/filestate] Don't unwrap go-cloud errors (#8455)
* Don't unwrap go-cloud errors

* Remove unused func

* Add changelog entry

Co-authored-by: Ian Wahbe <ian@wahbe.com>
2021-11-19 12:21:37 -08:00
Anton Tayanovskyy e60d6bf248
Programgen support for F.Invoke forms in .NET (#7949) (#8432)
* Implement .NET codegen for F.Invoke forms

* Add tests for .NET Invoke

* Fixed conflict

* Accept changes reverting fargate example
2021-11-18 17:53:17 -05:00
Anton Tayanovskyy e846b3201f
Go implementation of fn.Output program gen (#7949) (#8431)
* Modify Go codegen for fn.Output overloads

* Fix go tests

* Fixed CHANGELOG conflict

* ACCEPT changes reverting Fargate example to master, file issue

* Link an issue
2021-11-18 17:50:51 -05:00
Anton Tayanovskyy 1cedb29193
Programgen support for fn_output forms in Python (#7949) (#8433)
* Update Python programgen to use fn_output forms

* Fix skips

* Fix CHANGELOG

* Accept changes, backing out Fargate change
2021-11-18 17:43:13 -05:00
Ian Wahbe 3e2f36548e
[codegen/typescript] Call site defaults for plain Pulumi Object types (#8400)
* Add test case

* Fix tests

* Add test dependencies correctly

* Feed through error handling

* Include test output

* Get types to line up

* Add remaining test files

* Update changelog

* Correctly find type paths

* Handle transitive objects

* Handle required fields

* Add required+default test case

* Don't `<any>` cast known types.

* Add plain object to env-helper test

This test fails right now. My next problem is fixing it.

* Handle plain types

* Handle function inputs

* Fix the indentation

* Handle output types correctly

* Remove unnecessary `!`

* Add missing change to fix test

* Run tests with merge

* Merge in next _index.md diff

* Another attempt at _index.md

* Make module generation deterministic

* Fix docs generation

Credit to @praneetloke
2021-11-18 12:23:30 -08:00
Ian Wahbe 013fcdec9d
Clean CHANGELOG_PENDING.md after v3.18.0 release (#8443) 2021-11-17 19:52:13 -08:00
Ian Wahbe 50308812c4
Prepare for v3.18.0 release (#8441) 2021-11-17 15:15:20 -08:00
Anton Tayanovskyy 06a19b53ed
Programgen support for fnOutput forms in node (#7949) (#8434)
* Teach PCL about fnOutput forms

* Teach PCL about fnOutput forms

* Teach Node program gen to emit fnOutput forms

* TypeCheck fix

* AWS package bump

* Add tests

* CHANGELOG

* Temporarily skip non-Node affected tests

* Address PR feedback: restrict new form to Output args only
2021-11-17 15:27:50 -05:00
Ian Wahbe 3329d81c1a
Update command respects --target-dependents (#8395)
* Update command respects `--target-dependents`

* Update CHANGELOG_PENDING.md

* Depend on parent and provider

* Add tests for new feature

* Separate predicate and mutation in code

* Remove `targetDependentsForUpdate`

* Refactor `isTargetedForUpdate`

* Add very important nil check
2021-11-16 17:12:36 -08:00
Pat Gavlin a1339277f0
[schema] Add enum overlay support. (#8425)
And update the metaschema to accommodate the `isOverlay` properties
added in #8338. Overlay enums, like other overlay members, are
implemented out-of-band by the declaring package. Code generators should
not generate declarations for overlay enums.
2021-11-16 15:53:28 -08:00
Justin Van Patten ba39ed9ad4
Add tests that return failures from Call (#8424)
- [sdk/nodejs] - Allow returning failures from Call in the provider without setting result outputs.
- [sdk/go] - Allow specifying Call failures from the provider.
- Add tests that return failures from Call.
2021-11-16 08:58:46 -08:00
Emiliza Gutierrez a7783f26de
Fixing broken lists in dotnet docs (#8178)
* Fixing broken lists in dotnet docs

* update changelog
2021-11-15 17:40:19 -08:00
Ian Wahbe 554660b23a
Implement the --exclude-protected feature (#8359)
* Implement the --exclude-protected feature

This piggybacks on the same machinery used by the --target flag. By
examining the stack, we find a list of all resources managed by
Pulumi (in that stack). We then form them into a DAG, and mark all
resources as either protected or unprotected.

A resource is protected it has the `Protect` flag set or is has a child
with the `protect` flag set. It is unprotected otherwise.

We then pass the urns of unprotected resources to the update options
passed to the destroy operation in the same way that `--target` does.

* Update changelog

* Handle providers correctly

* Add integration test

* Protect dependencies of protected resources

* Handle --exclude-protected in separate function

* Simplify implementation via DependencyGraph

* Add TransitiveDependenciesOf

* Cleanup unused functions

* Gate printed message behind !jsonDisplay

* Ensure provider is not `""`

* Clean up documentation (and some code)
2021-11-15 11:45:14 -08:00
Justin Van Patten 10ceee406e
[sdk/nodejs] Unmarshal output values in component provider (#8205)
This adds support for unmarshaling output values in the Node.js provider.
2021-11-15 11:22:44 -08:00
Ian Wahbe d3b2dedd1d
[sdk/python] Unmarshal output values in component providers (#8212) 2021-11-15 10:12:12 -08:00
Adam Wilczek a5f72ddbeb
Added a buildkite detector for detecting the correct env vars in CI (#7933)
* Added a buildkite detector for detecting the correct env vars in CI

* adding pending changelog entry

* fixed PR logic to actually match the Buildkite Docs and simplified if statement, Fixed a few typos in comments and added PR to CHANGELOG_PENDING.md

* made PR number fetch easier to read

* fixing typo in comment
2021-11-15 09:10:07 -08:00
Ian Wahbe 164a2ec818
Enable output marshaling in .NET (#8316) 2021-11-12 14:58:34 -08:00
Paul Stack 74ba28ad55
[CLI] Adding the ability to create a default org for backends that support orgs (#8352) 2021-11-12 20:44:51 +02:00
Joe Duffy 0a38bc295c
Fix issue with --target deletion dependent calculation (#8360)
* Fix issue with --target deletion dependant calculation

The code that computed --target deletion dependants was not correct.
It used parent/child component relationships, but did not respect actual
DAG dependencies. As a result, it could erroneously leave hanging
references to resources that no longer exist after performing a
`pulumi destroy --target X` operation. This manifested in bugs like
https://github.com/pulumi/pulumi/issues/6283, which is fixed by this
change. The solution is to compute the (transitive!) dependency graph
correctly, factoring in both parent/child, as well as explicit and
implicit, dependencies. The existing logic does the correct thing once
we do this. I've also added tests for this area, including regression
tests that cover transitive dependency relationships, as well as ones
that would cause an infinite loop given a naive implementation.

* Add a changelog entry

* Fix failing test to include all destroyed targets

Unless I'm missing something, the entire tree should be deleted
in this test case because A is the ancestor for the entire tree.

* Use DependencyGraph to compute dependents

Per code review feedback from @pgavlin.

Co-authored-by: Anton Tayanovskyy <anton@pulumi.com>
2021-11-12 10:02:51 -05:00
Levi Blackstone 0d4fb3e340
[schema] Add IsOverlay option to disable codegen for particular types (#8338)
Add a new `IsOverlay` option to schema types and functions that allows providers to document overlays in the schema. This makes it easier to generate API docs consistently, even for code that is generated outside of the typical codegen process.
2021-11-11 17:00:03 -07:00
Anton Tayanovskyy c6b8168423
Cleanup CHANGELOG_PENDING after 3.17.1 (#8392) 2021-11-11 14:39:56 -08:00
Anton Tayanovskyy afcbcd3a51
7947: docgen for $fnOutput forms (#8293)
* Toward doc gen of fn.Output version signatures

* Fixup Python docgen, and reorder forms so the direct form comes firs

* Respect go opt-out flag

* Fix tempalte bug with unbalanced HTML tags

* Edit CHANGELOG_PENDING.md

* Merge codeblocks in the function template

* Accept docs changes
2021-11-08 17:07:09 -05:00
Komal 9a30f36c93
[auto/python] - Fix deserialization of event (#8375)
Fixes the deserialization for the `metadata` property on `ResourcePreEvent`, `ResOutputsEvent` and `ResOpFailedEvent`.
2021-11-08 13:05:04 -08:00
Anton Tayanovskyy e37892ac4a
Fix 8322 (#8339)
* Fix 8322

* Untabify

* Untabify again

* Yet More untabify

* More untabify

* Final untabify

* Add CHANGELOG_PENDING

* Apply suggestions from code review

Co-authored-by: Justin Van Patten <jvp@justinvp.com>

* PR feedback

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2021-11-08 10:45:26 -05:00
Justin Van Patten 414ef7e9d0
[programgen/go] Don't change imported resource names (#8353)
When importing a resource in Go, we change resource names with hyphens to snake_case. This happens because we introduced a change that converts the resource name to a valid Go identifier so it can be used as a local variable. But we were also using this converted name as the string resource name, which causes problems with import: the imported resource in the state file has the original resource name, but the generated program uses the converted name, causing Pulumi to delete and recreate the resource when adopting the generated import code.

This change fixes the issue by maintaining the original resource name, and only using the converted name for variables.
2021-11-04 09:28:48 -07:00
Justin Van Patten 4043137c35
Clean CHANGELOG_PENDING.md after v3.17.0 release (#8350) 2021-11-03 13:55:43 -07:00
Justin Van Patten 5b10c99bab
Prepare for v3.17.0 release (#8345) 2021-11-03 11:01:03 -07:00
Emiliza Gutierrez d243efae19
Revert "[python/sdk] - Remove python 3.6 support (#8161)" (#8332)
This reverts commit 895ae970ac.
2021-11-02 10:19:01 -07:00
Ian Wahbe e629bc32d5
Expand dependencies when marshaling output values (#8301)
* Expand dependencies when marshaling output values

[sdk/python]

* Update CHANGELOG_PENDING.md

* Use existing code

* Fix lint
2021-11-01 11:10:27 -07:00
Anton Tayanovskyy 343b4a3501
Fix #8172 (#8320)
* Fix #8172

* Accept test baselines

* Update CHANGELOG_PENDING
2021-11-01 13:21:01 -04:00
Fraser Waters d39a14432f
Don't throw on type mismatches in the dotnet sdk (#8286)
* Don't throw on type mismatches in the dotnet sdk

Fixes #7329

The converter will no longer throw if resource providers return data
that does not match the expected type declared in the dotnet sdk.
Instead a warning will be logged for the resource and the value will be
set to `default(T)`.
2021-10-29 17:35:17 +01:00
Ian Wahbe e38876f7af
[sdk/go] Respect default parent in go aliases. (#8288)
* Respect default parent in go aliases.

* Update changelog

* Handle empty parrents correctly

* Allow specifying no parent

* clarify variable name

* Improve `Unparent` ergonomics

* Take t0yv0's suggestion

* Adopt @t0yv0's tests and doc comments.

* Make NoParent,Parent,ParentURN mutually exclusive
2021-10-28 17:25:31 -07:00
Komal 895ae970ac
[python/sdk] - Remove python 3.6 support (#8161) 2021-10-27 10:35:46 -07:00
Justin Van Patten fbf62399ca
[sdk/go] Fix regression marshaling assets/archives (#8290)
This change fixes a regression marshaling assets/archives that was introduced after adding support for marshaling output values.

For example, when setting an `Asset` on a field typed as `AssetOrAchiveInput`, in `marshalInput`, the input was being converted into an `AssetOrArchiveOutput` via the `ToAssetOrArchiveOutputWithContext`. Awaiting the output returns an `*asset` struct, which is itself an `AssetInput`, which causes infinite recursion when passed recursively to `marshalInput`.

The fix is to skip the `Input` checks in recursive calls, which is equivalent to the previous behavior before the regression was introduced.

Another issue was that when the input is converted to an output, this would result in `marshalInput` always returning an output value, even if the original passed-in value was not an output. To address this, if the output's value is known, not a secret, and has no dependencies, we can return the value itself rather than wrapping it as an output.
2021-10-27 08:44:42 -07:00
Ian Wahbe 530641576d
[codegen/go] allow plain default types (#8254)
* Respect `plain` when generating default values.

* Add new test

* Simplify test case

* Add indirection to allow taking references

* Reflect indirection problem in tests

* Remove Plain fields. Base off of primitive type

* Reenable docs

* Update changelog

* Implement always default solution

* Fix test by pulling in master

* Add enum test and cleanup

* Fix const handling

* Clarify the changelog
2021-10-26 17:18:48 -07:00
Komal 2f433d64b7
[cli] Emit JSON events for updates via --json flag (#8275) 2021-10-26 16:21:27 -07:00
Fraser Waters a199ba8bb5
Fix race condition in TaskMonitoringHelper (#8294)
* Fix race condition in TaskMonitoringHelper

Fixes #8163

TaskMonitoringHelper was using two seperate trackers for Idle and
FirstException and then calling WhenAny on both to see which state
happened first. This was racy as you could end up completing a task with
an exception but getting the idle tracker fire first, resulting in
TaskMonitoringHelper thinking no exception had happened.

I've combined the two trackers into TaskMonitoringHelper now. At each
task completion we check for exceptions and then idleness.

* Add changelog
2021-10-26 22:37:47 +01:00
Carlos Tadeu Panato Junior 1c0a7e4907
reformat error message string (#8284)
Signed-off-by: Carlos Panato <ctadeu@gmail.com>
2021-10-26 14:55:25 -06:00
Anton Tayanovskyy 979f8d5c85
Clean CHANGELOG_PENDING.md after v3.16.0 release (#8272) 2021-10-20 14:16:56 -04:00
Josh Studt caf5fcd525
[auto/dotnet] - pulumi state delete & unprotect functionality (#8202)
Co-authored-by: Komal <komal@pulumi.com>
2021-10-18 16:26:45 -07:00
Anton Tayanovskyy e710125885
5758 for C#/.NET (#7899)
* Rebase 5758 .NET work and make output-funcs pass

* Propagate changes to the other examples

* CHANGELOG

* Address PR feedback

* Add a test reproducing aws-native compilation failure

* Fix dangling type ref issue in the .NET backend for codegen

* Accept changes and unskip simple-methods-schema compile check

* Accept changes in node, python, go codegen

* SDK changes to enable a better implementation approach

* Switch approach to support functions like GetAmiIds; avoid name conflicts under tfbridge20

* Make all dotnet tests pass, mechanical fixes + accept test output

* Accept python changes

* Accept node output

* Accept docs changes

* Deepen the unit test to cover the interesting helper type

* Accept go changes and fixup tests

* Implement dep propagation through Invoke

* Fixup cyclic-types

* Accept codegen

* NOTE we now require .NET SDK 3.15 or higher
2021-10-18 18:18:15 -04:00
Anton Tayanovskyy 1bd2e7beb4
Clean CHANGELOG_PENDING.md after v3.15.0 (#8229) 2021-10-14 21:12:12 -04:00
Ian Wahbe dbc5979501
iwahbe/add aditional input registration types (#8204)
* Add registration for resources and enums

* Update tests

* Fix enum registration instances

* Update changelog

* Add the rest of the reference types

* Fix nit

* Remove reference from Map and Array types
2021-10-14 10:41:40 -07:00