Commit graph

6140 commits

Author SHA1 Message Date
Justin Van Patten e8bd8e5e1f
Rehydrate provider resources in Construct (#7624)
Previously, any provider resource passed to multi-lang components would be instantiated as a `DependencyProviderResource` inside `Construct`, which prevents the component from being able to easily access the provider's state as an instance of of the provider (e.g. `*aws.Provider`).

This change attempts to rehydrate the provider resource in the same way that resource references are rehydrated, if it's been registered, s.t. the specific provider resource type is instantiated with its state. Otherwise falling back to returning `DependencyProviderResource`.
2021-07-23 14:10:06 -07:00
Emiliza Gutierrez 13a606d54e
Actually close the issue after being marked as stale (#7626) 2021-07-23 13:44:13 -07:00
Alex Mullans 6c59644bf6
Add issue management Actions (#7476)
* Create issue-management.yml

* Update issue-management.yml
2021-07-23 14:07:06 +03:00
Anton Tayanovskyy 697cf3161e
Timeout of 1min for the slow task (#7619) 2021-07-22 19:11:39 -04:00
Chae SeungWoo bd208df180
[sdk/go] Add stack output helpers for numeric types (#7410) 2021-07-22 15:48:47 -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 0b1a985bbf
Release cleanup (#7614) 2021-07-22 12:34:11 -07:00
Komal 8afccf60ab
Prep for 3.8.0 release (#7613) 2021-07-22 12:27:04 -07:00
Evan Boyle a659b3565c
reenable concurrent update test (#7609) 2021-07-22 10:06:44 -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
Justin Van Patten 30311405ca
[sdk/go] Fix methods panic when marshaling self (#7604) 2021-07-22 05:28:46 -07: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
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
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
Sean St. Quentin 81f87b0c6a
Fix the Go Automation API's Target and Replace CLI options (#7426)
* Add missing Sprintf calls

* Fix target and replace options change

Co-authored-by: Komal <komal@pulumi.com>
2021-07-20 17:43:01 -07:00
Hossam Barakat 3fabf45542
Set PULUMI_CONFIG_PASSPHRASE for Automation Tests (#7502) 2021-07-20 17:18:30 -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
Justin Van Patten 68458bfab3
[sdk/python] Support for implementing methods in provider (#7555) 2021-07-19 14:58:55 -07:00
Justin Van Patten 8c4a56acb7
[sdk/dotnet] Clean obj & bin dirs when building (#7562) 2021-07-19 11:22:08 -07:00
stack72 a710c98437 Cleanup after v3.7.1 release 2021-07-19 18:09:30 +01:00
stack72 4e4fe65b36 Prepare for v3.7.1 release 2021-07-19 11:35:50 +01:00
Luke Hoban 9b17afe350
Fix CHANGELOG for 7541 (#7563) 2021-07-18 09:00:41 +01: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
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
Nikhil Benesch c782a298a1
Make Output[T] covariant in Python SDK (#7483)
In short, this allows subtyping to correctly "propagate" through an Output;
if Cow is a subtype of Animal, this commit makes it so Output[Cow] is
treated as a subtype of Output[Animal].

Without this change, users of the Python SDK occasionally contend with a
confusing error message that is resolved by adding a call to
`.apply(lambda x: x)` to satisfy mypy.

Touches #3767.
Fix #6843.
2021-07-16 12:30:04 -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
PND c6062ea1d5
[sdk/nodejs] Fix a bug in closure serialization. (#6999)
Co-authored-by: Komal <komal@pulumi.com>
Co-authored-by: Luke Hoban <luke@pulumi.com>
2021-07-15 18:20:09 -07:00
Justin Van Patten cb564608b1
[codegen/nodejs] Fix missing args param (#7539) 2021-07-15 16:33:32 -07:00
Mikhail Shilkov 042e0061d4
Merge pull request #7533 from pulumi/mikhailshilkov/ref-doc-azure-classic
Rename Azure to Azure Classic in reference docs
2021-07-15 17:22:21 +02:00
stack72 eff9e6239f [build] temp revert master builds from triggering examples smoke tests due to command dispatch issue 2021-07-15 13:35:41 +01: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
Paul Stack eb8e1585c3
Trigger examples tests on merge to master (#7398) 2021-07-14 14:18:52 +03:00
Matt Stratton f28fb26cf7
Add GitHub Discussions links to the README (#7393) 2021-07-14 14:15:55 +03: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 5afc4ac54e
Post-release cleanup (#7514) 2021-07-13 14:30:59 -07:00