Commit graph

113 commits

Author SHA1 Message Date
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
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 164a2ec818
Enable output marshaling in .NET (#8316) 2021-11-12 14:58:34 -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
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
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
Anton Tayanovskyy 32695f7022
Minimally extend .NET SDK to support 5758 (#8142)
* Minimally extend .NET SDK to support 5758

* Retract CodegenUtilities

* Add CHANGELOG_PENDING
2021-10-07 09:51:24 -04:00
Ian Wahbe 054b3f9edc
Iwahbe/7881/thread replace on chages through sdks (#7967)
* Thread replaceOnChanges through the Go SDK

* Add replaceOnChanges to the .NET SDK

* Update CHANGELOG_PENDING.md

* Fix null error

* Update CHANGELOG_PENDING.md

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2021-09-15 14:29:13 -07:00
Anton Tayanovskyy 6270f925d6
Add CodegenUtilities to C# SDK in prep for 5758 (#7934) 2021-09-09 17:18:39 -04:00
Justin Van Patten 8112872b61
[sdk/dotnet] Support for calling methods (#7582) 2021-08-24 20:17:05 -07:00
Anton Tayanovskyy 2223c6b8b9
Fix null exceptions when reading unknown outputs (#7762)
* Fix null exceptions when reading unknown outputs

* Fix test compilation

* Add a test reproducing the actual problem

* Revert the change in behavior that was not clearny an improvement

* Unique resource UUID

* Add a CHANGELOG entry
2021-08-17 09:30:54 -04:00
Justin Van Patten a05c3a4e9b
Set the package on DependencyProviderResource (#7630)
When initializing `DependencyProviderResource`, pass the package to the base constructor instead of an empty string s.t. the provider is usable when its package is read.
2021-07-27 06:50:24 -07:00
Anton Tayanovskyy b0f51a6b2c
Fixes for C# concurrency bugs in 7492 (#7529)
* Reproduce the issue in a failing test

* Fix

* Tentative fix

* Update sdk/dotnet/Pulumi/Deployment/TaskMonitoringHelper.cs

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

* Update sdk/dotnet/Pulumi/Deployment/TaskMonitoringHelper.cs

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

* Update sdk/dotnet/Pulumi/Deployment/TaskMonitoringHelper.cs

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

* Update sdk/dotnet/Pulumi/Deployment/Deployment.Runner.cs

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

* Do not allocate TaskCompletionSource when not needed

* Update sdk/dotnet/Pulumi/Deployment/Deployment.Runner.cs

Co-authored-by: Josh Studt <32800478+orionstudt@users.noreply.github.com>

* Fix warning

* Cache delegate

* Simplify with named tuples

* Test early exception termination

* Test logging

* Remove the smelly method of suppressing engine exceptions

* Update sdk/dotnet/Pulumi/Deployment/TaskMonitoringHelper.cs

Co-authored-by: Josh Studt <32800478+orionstudt@users.noreply.github.com>

* Fix typo; check in xml docs

* Try CI again

* Add CHANGELOG entry

* Dedup exceptions before reporting

* Lock access to _exceptions list

* Fix typos

* Version of HandleExceptionsAsync that accepts N exceptions

* Do not aggregate exceptions prematurely

* Rename private members

* Formatting

* Summary markers

* Short-circuit return

* Stylistic fixes

* Strengthen test

* Check that we have only 1 exception

* Remove defensive clause about AggregateException from the test

* Simplify TerminatesEarly test

* Remove EmptyStack

* Notes on the regression nature of the WorksUnderStress test

* Remove race condition repro as it is a poor repro, impossible to trigger from user code

* Brace style

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
Co-authored-by: Josh Studt <32800478+orionstudt@users.noreply.github.com>
2021-07-22 12:49:14 -04:00
Sean Fausett 12217bd0dc
Fix async await warnings (#7537)
* Revert remove redundant async await
* Fix resharper code issues
* Update changelog
2021-07-21 18:44:10 -04:00
Pat Gavlin ece9f2fb30
[sdk/{go,dotnet] Unmarshal invalid assets. (#7579)
The two more strongly-typed Pulumi SDKs curently fail with an error
during unmarshaling when attempting to marshal a value that is not an
asset into an asset-typed location (e.g. an asset-typed resource
output property). While this behavior is reasonable on its face, it
gives rise to practical challenges when dealing with TF-provider-backed
resources that have asset-typed properties. When such a resource is
refreshed, the values of its asset-typed properties are replaced with
non-asset values, as the TF bridge can't currently create a resonable
stand-in asset value.

For example, consider an S3 bucket object:

```
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const bucket = new aws.s3.Bucket("my-bucket");
new aws.s3.BucketObject("my-object", {
    source: new pulumi.FileAsset("some/file"),
});
```

Upon creation, the value of the input property `source` will be a file
asset backed by the path `some/file`. The bridge will propagate this
value to the `source` output property; this propagation is safe because
the resource was just created and so the output property must have the
value that was passed by the program.

Now, let some actor apply out-of-band changes to the contents of the
bucket object s.t. the `source` property changes when the object is
refreshed. In that case, the `source` property will be a string value
which the bridge is unable to interpret as an asset. The next time the
Pulumi program is run, the Go or .NET SDK will attempt to deserialize
the string into an asset-typed property and will fail.

With these changes, the deserialization would not fail, and would
instead create an asset or archive value that will fail to marshal if
passed to another resource. Users can avoid these errors by not passing
asset or archive outputs to other resources/stack outputs.

These changes unblock users who are hitting
https://github.com/pulumi/pulumi-aws/issues/1521.
2021-07-21 13:40:36 -07:00
Luke Hoban 0bcca3883e
[sdk] Wait on remote component dependencies (#7541)
When a resource `dependsOn` a remote component, we were not correctly waiting on it, because we were skipping over waiting on comoponents, and only waiting on their custom resource children.  For remote components, we do not know the children, but waiting on the remote component will always wait on all children.

Co-authored-by: Mike Metral <1112768+metral@users.noreply.github.com>
2021-07-16 16:11:34 -07:00
Luke Hoban eb32039013
Add replaceOnChanges resource option (#7226)
Adds a new resource option to force replacement when certain properties report changes, even if the resource provider itself does not require a replacement.

Fixes #6753.

Co-authored-by: Levi Blackstone <levi@pulumi.com>
2021-07-01 13:32:08 -06:00
Josh Studt 22669d70fc
[sdk/dotnet] - Fix swallowed nested exceptions with inline program so they correctly bubble to consumer (#7323)
* resolve issue with exit code not bubbling up and inflight tasks swallowing exceptions

* update changelog

* refacter to reduce and centralize inline program exception flow complexity

* quick comments on new pulumi function return type
2021-06-21 15:45:26 -04:00
Sean Fausett 7820d2c17b
Support microsoft logging extensions with inline programs (#7117)
* Demystify serilog logger messages
https://github.com/benaadams/Ben.Demystifier

* Update changelog
2021-06-10 23:06:57 -04:00
Sean Fausett c4e55a7107
[dotnet/sdk] Add create unknown to output utilities (#7173)
* Add create unknown to output utilities

* Update changelog

* Tweaks based on review

Co-authored-by: Anton Tayanovskyy <anton@pulumi.com>
2021-06-10 10:54:16 -04:00
Sean Fausett 3530ba3205
[dotnet] Fix Resharper code issues (#7178)
* Fix resharper code issues for language usage opportunities

* Fix resharper code issues for common practices and code improvements

* Fix resharper code issues for potential code quality issues

* Fix resharper code issues for redundancies in code

* Fix xunit test output

* Update changelog

* Fix resharper code issues for compiler warnings

* Fix resharper code issues for inconsistent naming

* Add resharper solution settings file

* Fix resharper code issues for potential code quality issues

* Fix resharper code issues for redundancies in code

* Fix resharper code issues for redundancies in symbol declarations
2021-06-10 10:32:33 -04:00
Anton Tayanovskyy add5ea1d53
Edit doc comment (#7215)
* Edit doc comment

* Fix invalid XML
2021-06-07 13:02:16 -04:00
Sean Fausett dc994deabd
[dotnet/sdk] Add get value async to output utilities (#7170)
* Add get value async to output utilities

asdasd

* Update changelog

* Move public apis from unshipped to shipped

Co-authored-by: Anton Tayanovskyy <anton@pulumi.com>
2021-06-04 18:22:00 -04:00
Justin Van Patten d6b7762102
Temporarily disable config secrets warning (#7129)
Temporarily disable the new config secret warning to avoid unactionable warnings from provider `config` modules. We'll re-enable the warning when we've addressed that issue.
2021-05-24 16:06:27 -07:00
Sean Fausett cc8459b2d9
[dotnet/sdk] Use source context with serilog (#7095)
* Use source context with serilog

* Update changelog

* Remove framework reference

* Remove unavailable directives

Requires dotnet 5 or later.

* Use null-forgiving initialization
2021-05-21 18:20:46 -04:00
Mikhail Shilkov 0fa94784ab
Allow outputs in dictionary resource args (#7084)
Co-authored-by: Levi Blackstone <levi@pulumi.com>
2021-05-19 12:10:11 -06:00
Justin Van Patten 34a40d2b10
[sdk/dotnet] Warn when a secret config is read as a non-secret (#7079) 2021-05-18 15:01:57 -07:00
Pat Gavlin bd18384038
Await outstanding async work in .NET. (#6993)
The Pulumi .NET SDK does not currently await all outstanding asynchronous
work associated with a Pulumi program. Because all relevant asynchronous
work is created via the Pulumi SDK, we can track this asynchronous work
and ensure that it has all completed prior to returning from
`Deployment.RunAsync`.

The implementation here is simpler than that in #6983, and re-uses the
existing support for tracking outstanding RPCs. If this proves to
negatively impact performance (which is a very real possibility for
programs that create many `Output` instances), we can simplify this
using a semaphore and a counter (essentially Go's `sync.WaitGroup`).

This fixes the .NET portion of #3991.
2021-05-12 13:23:47 -07:00
Sean Fausett 276d3570ed Enable deterministic builds 2021-04-29 14:24:43 +12:00
Sean Fausett 44cc1684fc Bump Grpc NuGet packages to 2.37.0
https://github.com/grpc/grpc/releases/tag/v1.37.0
2021-04-25 16:57:17 +12:00
Levi Blackstone f11e8603a2
[sdk/dotnet] Handle providers for RegisterResourceRequest (#6786)
Resolve providers references and include the resulting refs in the
providers field of RegisterResourceRequest that was added in
d297db3.

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2021-04-16 16:12:53 -06:00
Paul Stack e955a6b06a Refactor Mock newResource and call to accept property bag rather than individual args (#6672) 2021-04-14 19:32:18 +01:00
pulumi-bot 73a66f48ea [breaking] Changing the version of go.mod in sdk / pkg to be v3 2021-04-14 19:32:18 +01:00
Justin Van Patten f7cc19f89d
[sdk/nodejs] Keep prompt values prompt in construct (#6522)
In order to support prompt values in multi-lang components, if an input value is prompt, keep it as-is instead of wrapping it in an Output.
2021-04-09 14:36:22 -07:00
Josh Studt ef9a1e4e40
[sdk/dotnet] - Thread-safe concurrency-friendly global state (#6139)
* changes necessary for concurrent thread safe global deployment state

* update changelog

* backtrack resource package changes, enable test parallelization

* cleanup comment

* add copyright to new file

* resolve paralellization differences after merging automation api preview

* no longer need to null deployment instance

* Update CHANGELOG.md

* whoops - switch to CHANGELOG_PENDING

* Update CHANGELOG_PENDING.md

move note down to improvements

* attempt to exclude dynami assemblies

Co-authored-by: Anton Tayanovskyy <anton.tayanovskyy@gmail.com>
2021-04-09 15:55:34 -04:00
Anton Tayanovskyy 0b626126c0
Avoid scanning types from some assemblies (#6688) 2021-04-02 12:11:59 -04:00
Anton Tayanovskyy 980c50c602
Remove MaybeNull from Output/Input.Create to avoid spurious warnings (#6600)
* Remove MaybeNull attr from read-only params on Input/Output constructors

* Update changelog
2021-03-23 19:34:30 -04:00
Anton Tayanovskyy 22f332e094
Fix docstring on node log.error and other SDK equivalents (#6573)
* Fix docstring of log.error across SDKs to explain non-termination

* Accept PR feedback, briefer docstrings.
2021-03-18 13:57:10 -04:00
Josh Studt 963b5ab710
[Automation API] - C# Implementation (#5761)
* Init Workspace interface for C# Automation API

* fleshing out workspace interface and beginning of local workspace implementation

* initial run pulumi cmd implementation

* resolve issue with pulumi cmd cleanup wrapper task after testing

* flesh out local workspace implementation, flesh out stack implementation, cleanup run pulumi cmd implementation and make it an instance so it is mockable/testable, separate serialization in prep for custom converters

* project settings json serialization implemented

* Initial commit of language server

* Add deployment from language server

* Cleanup

* finish json serialization

* project runtime yaml serialization completed. just need stack config value yaml serialization

* Remove typed argument

* Limit concurrency

* Rename file for consistency

* final commit of a semi-working project settings & stack settings serialization so that it is in the commit history

* modify workspace API so that settings accessors aren't fully exposed since we are defering a complete serialization implementation until a later date

* yaml converters wrap any outgoing exceptions so resolve that

* getting the beginning of inline program GRPC communication set up

* stack lifecycle operations implemented, and switched to newtonsoft for JSON serialization

* change back to system.text.json with a custom object converter

* local workspace tests written, working on getting them passing

* fix the encoding on the GO files used for testing

* all tests passing except inline program, pulumi engine not available with inline

* inline program engine is now running as expecting, but inline program is not recognizing local stack config

* All tests passing, but no concurrency capability because of the singleton DeploymentInstance.

* cleanup unnecessary usings

* minor cleanup / changes after a quick review. Make sure ConfigureAwait is used where needed. Remove newtonsoft dependency from testing. Update workspace API to use existing PluginKind enum. Modify LanguageRuntimeService so that its semaphore operates process-wide.

* support for parallel execution of inline program, test included

* Update LocalWorkspaceTests.cs

remove some redundancy from the inline program parallel execution text

* flesh out some comments and make asynclocal instance readonly

* Strip out instance locking since it is no longer necessary with AsyncLocal wrapping the Deployment.Instance. Modify CreateRunner method such that we are ensuring there isn't a chance of delayed synchronous execution polluting the value of Deployment.Instance across calls to Deployment.RunAsync

* resolve conflicts with changes made to Deployment.TestAsync entrypoints

* update changelog

* write a test that fails if the CreateRunnerAndRunAsync method on Deployment is not marked async and fix test project data file ref

* make resource package state share the lifetime of the deployment so that their isn't cross deployment issues with resource packages, add support and tests for external resource packages (resource packages that aren't referenced by the executing assembly)

* enable parallel test collection execution in test suite, add some additional tests for deployment instance protection and ensuring that our first class stack exceptions are thrown when expected

* minor inline project name arg change, and re-add xunit json to build output (whoops)

* strip out concurrency changes since they are now in #6139, split automation into separate assembly, split automation tests into separate assembly

* add copyright to the top of each new file

* resolve some PR remarks

* inline program exception is now properly propagated to the caller on UpAsync and PreviewAsync

* modify PulumiFn to allow TStack and other delegate overloads without needing multiple first class delegates.

* whoops missing a copyright

* resolve getting TStack into IRunner so that outputs are registered correctly and so that there isn't 2 instances of Pulumi.Stack instantiated.

* resolve issue with propagation of TStack exceptions and add a test

* add support for a TStack PulumiFn resolved via IServiceProvider

* update automation API description

* fix comment and remove unnecessary TODOs

* disable packaging of automation api assembly

* re-name automation api documentation file appropriately

* add --limit support to dotnet automation api for stack history per #6257

* re-name XStack as WorkspaceStack

* replace --limit usage with --page-size and --page in dotnet automation api per #6292

Co-authored-by: evanboyle <evan@pulumi.com>
Co-authored-by: Josh Studt <josh.studt@figmarketing.com>
Co-authored-by: Dan Friedman <dan@thefriedmans.org>
Co-authored-by: David Ferretti <David.Ferretti@figmarketing.com>
Co-authored-by: Mikhail Shilkov <github@mikhail.io>
2021-02-18 11:36:21 +01:00
Justin Van Patten dab47e9b40
[sdk/dotnet] RegisterResourceOutputs: Check for resource ref support (#6172)
.NET's implementation of RegisterResourceOutputs was always serializing resources as resource references, regardless of the monitor's reported support. This change fixes .NET to check if the monitor supports resource references, which is consistent with all the other languages, and with serialization code elsewhere in the .NET SDK.
2021-01-21 17:04:21 -08:00
Pat Gavlin 683b4de2f0
Add .NET resource ref unit tests. (#6104)
- Add tests that serialize custom and component resources for targets
  that support resource references
- Add tests that serialize custom and component resources for downlevel
  targets
- Add tests that deserialize known custom and component resources
- Add tests that deserialize missing custom and component resources

These changes also fix a few bugs that were encountered during testing:
- Component resource construction was not supported
- Resources with missing packages could not be deserialized

In the latter case, a missing resource is deserialized as a generic
DependencyResource.

These changes also update the signature of IMocks.NewResourceAsync to
allow the returned ID to be null. This is technically a C# breaking change
with respect to nullability.

Contributes to #5943.

Co-authored-by: Mikhail Shilkov <github@mikhail.io>
2021-01-14 12:24:41 -08:00
Justin Van Patten 74580168c2
Fix looking up empty version in ResourcePackages.TryGetResourceType (#6084)
When a resource reference is deserialized, it may not have a version in which case `version` will be an empty string. This change fixes `TryGetResourceType` to work correctly when an empty version is passed.
2021-01-12 08:53:52 -08:00
Mikhail Shilkov 710f385447
[dotnet] Unsecret and IsSecret implementation for .NET (#6092) 2021-01-12 14:54:08 +00:00
Nicolas Fløysvik 9fbdc51fcd
[sdk/dotnet] Moved urn value retrieval into if statement (#6081) 2021-01-11 06:39:17 -08:00
Paul Stack ee776b3c33
Update PulumiStackType comments in dotnet and nodejs (#6028) 2020-12-30 23:02:18 +00:00
Mikhail Shilkov 356fe195af
Extensions to support input collection initializers with union types (#5938) 2020-12-14 20:33:53 +01:00
Justin Van Patten 160220bc4a
[sdk/dotnet] Fix deserializing resources (#5921)
This change implements getResource in the mock monitor. This uncovered some issues deserializing resources, which this change also addresses.
2020-12-10 22:58:08 -08:00
Levi Blackstone 4d48ee0517
Enable resource reference feature by default (#5905)
* Enable resource reference feature by default

Unless the PULUMI_DISABLE_RESOURCE_REFERENCES flag
is explicitly set to a truthy value, the resource reference feature is now
enabled by default.

* Set AcceptResources in the language SDKs

This can be disabled by setting the `PULUMI_DISABLE_RESOURCE_REFERENCES` environment variable to a truthy value.

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2020-12-10 11:21:05 -07:00
Mikhail Shilkov cab39dcfa0
[dotnet] Resource package registration in .NET (attributes) (#5875)
* Resource package registration in .NET
* Refactor to attribute-based discovery
* Refactor to derived attributes
2020-12-09 23:28:58 +01:00
Sean Fausett 15941d58d9
Bump Grpc NuGet packages to 2.34.0 (#5862)
* Bump Grpc NuGet packages to 2.34.0

https://github.com/grpc/grpc/releases/tag/v1.34.0

* Remove redundant package reference

Transitive via project reference.
2020-12-04 16:58:18 +01:00