Commit graph

3091 commits

Author SHA1 Message Date
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
Luke Hoban c3f5177f22
Fix rendering of diffs for resource without DetailedDiffs (#7500)
The diff rendering logic tests whether the DetailedDiff is nil to determine whether to use it for rendering or defer to older older supported approaches to computing diffs.

The new logic added in https://github.com/pulumi/pulumi/pull/7226 could lead to replacing a nil DetailedDiff with an empty DetailedDiff, whcih would make the rendering logic believe that a DetailedDiff was present but empty, instead of missing entirely.

This change ensures that we maintain nil-ness of the DetailedDiff when we transform it for handling of replaceOnChanges.

Also adds tests for this and other cases on applyReplaceOnChanges.

Fixes #7486.
2021-07-13 08:39:48 -06:00
Justin Van Patten 343bc4c778
Add methods lifecycle tests (#7488) 2021-07-12 15:51:11 -07:00
Emiliza Gutierrez 5acf002356
Fix typo: genrated->generated (#7478) 2021-07-12 13:44:09 -07:00
Anton Tayanovskyy 83a249cf2c
Relax errmsg check (#7482) 2021-07-12 09:05:06 -04:00
Justin Van Patten e169844652
Fix lint error (#7481) 2021-07-09 16:05:03 -07:00
James Nugent 1afb620706
Add newline to generated package.json files (#7480)
This commit adds a newline to the end of the package.json files
generated by Pulumi codegen, such that they can be installed in place
without modification.
2021-07-09 15:46:27 -07:00
Pat Gavlin 8cf588d408
[codegen] Add more type tests. (#7475)
- Add another regression test for #7454
- Add tests for singly-nested plain collections
- Fix a bug when binding {"type": "object"}.
2021-07-09 13:33:15 -07:00
Pat Gavlin 8fc47f01a5 Fix a test build break. 2021-07-09 10:41:35 -07:00
Pat Gavlin d07b325138
[codegen] Add type name generation tests. (#7470)
The inputs and expected outputs for the tests are encoded using a
schema. Each property present in the schema forms a testcase; the
expected outputs for each language are stored in each property's
`Language` field with the language name "test". Expected outputs can be
regenerated using `PULUMI_ACCEPT`.
2021-07-09 10:23:10 -07:00
Levi Blackstone 8f000c0ca1
[codegen] Refactor generateModuleContextMap (#7416)
Move ImportLanguages logic into generateModuleContextMap
rather than duplicating this work.
2021-07-09 09:52:30 -06:00
Pat Gavlin 843ce9943b
[query] Do not access config with a nil Target. (#7460)
Query mode does not fill out the Target field of EvalRunInfo before
booting its resource monitor. These changes fix a recent update to query
mode that attempts to dereference the nil Target.

Note that the missing target is by design, and other portions of the
query infrastructure have identical code to compensate.
2021-07-08 19:57:47 -07:00
Christian Nunciato bc7a88e7d3
Change resource-docs filenames to _index.md (#7450)
* Change resource-docs filenames to _index.md
* Rename test files
2021-07-08 18:07:05 -07:00
Pat Gavlin 8ec05580fd
[codegen] Fix SimplifyInputUnion. (#7459)
SimplifyInputUnion was dropping element types that were not inputs.
These changes fix that bug.

Fixes #7454.
2021-07-08 16:01:35 -07:00
Pat Gavlin 6887f76ff7
[codegen/test] Optionally skip testcases. (#7463)
Add support for skipping testcases when run against specific languages.
2021-07-08 13:54:03 -07:00
Justin Van Patten ccae7c80f8
[codegen/nodejs] Emit resource methods (#7378) 2021-07-07 20:16:42 -07:00
Justin Van Patten fd49c338f4
[codegen/go] Emit resource methods (#7438) 2021-07-07 20:11:40 -07:00
Pat Gavlin c7422228a5
[codegen/dotnet] Deeply unwrap collection element types. (#7451)
`Input{List,Map}` handle some of this themselves. This fixes a breaking
change in the .NET SDKs.

Fixes #7448.
2021-07-07 16:36:27 -07:00
Komal 8db30bdc14
[codegen/go] - Inputty Go enums (#7383) 2021-07-07 16:25:26 -07:00
Justin Van Patten 1c7cd99ecd
[codegen/python] Emit resource methods (#7364) 2021-07-07 06:57:18 -07:00
Pat Gavlin 46400d502b
[codegen] Unify SDK codegen testing (#7433)
Rather than duplicating the list of tests and codegen driver across each
SDK, move its definition into `pkg/codegen/internal/test`. This has a
few notable benefits:

- All SDK code generators will be tested against each test. Though some
  tests may exercise a particular code generator more than others, the
  extra coverage will be generally beneficial.
- Adding a new test is simpler, as only a single file needs to be
  changed.
- All SDKs now honor the `PULUMI_ACCEPT` environment variable for
  updating baselines.
- Codegen tests now validate all generated files instead of only a
  particular subset.
2021-07-06 15:40:53 -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
Justin Van Patten 84b574f0df
Initial support for resource methods (authoring from Node.js, calling from Python) (#7363)
Adds initial support for resource methods (via a new `Call` gRPC method similar to `Invoke`), with support for authoring methods from Node.js, and calling methods from Python.
2021-06-30 07:48:56 -07:00
Komal e0902d2489
[codegen/python] - Include python enum docstrings (#7374) 2021-06-28 15:06:50 -05:00
Evan Boyle 634e97cd55
Include config secret info in Construct calls (#7358) 2021-06-24 15:38:01 -07:00
James Nugent d525a8b331
Add complete third-party Python module and fix setup.py indentation (#7362)
Co-authored-by: Komal <komalsali@gmail.com>
2021-06-24 16:01:49 -05:00
Pat Gavlin 7b1d6ec1ac
Reify Input and Optional types in the schema type system. (#7059)
These changes support arbitrary combinations of input + plain types
within a schema. Handling plain types at the property level was not
sufficient to support such combinations. Reifying these types
required updating quite a bit of code. This is likely to have caused
some temporary complications, but should eventually lead to
substantial simplification in the SDK and program code generators.

With the new design, input and optional types are explicit in the schema
type system. Optionals will only appear at the outermost level of a type
(i.e. Input<Optional<>>, Array<Optional<>>, etc. will not occur). In
addition to explicit input types, each object type now has a "plain"
shape and an "input" shape. The former uses only plain types; the latter
uses input shapes wherever a plain type is not specified. Plain types
are indicated in the schema by setting the "plain" property of a type spec
to true.
2021-06-24 09:17:55 -07:00
Paul Stack 414367963f
[codegen/python] Update Python codegen to use a non-conflicting property name (#7239) 2021-06-23 14:55:23 +03:00
Komal 0f97a9bdfa
Fix python module nesting (#7353) 2021-06-22 15:43:21 -07:00
Pat Gavlin 2cc89defbc
Read passphrase from the terminal when rotating. (#7347)
Rotating a passphrase requires that the old passphrase is available via
one of the `PULUMI_CONFIG_PASSPHRASE` or `PULUMI_CONFIG_PASSPHRASE_FILE`
environment variables. This confuses `readPassphrase` when reading a new
passphrase, since that function checks the aforementioned environment
variables prior to reading from the console. The overall effect is that
it is impossible to rotate the passphrase for a stack using the
passphrase provider. These changes fix this by always reading from the
console when rotating a passphrase.
2021-06-22 11:13:57 -07:00
Komal a41ed75942
Fix watch command in macos arm64 builds (#7345) 2021-06-21 14:33:30 -07:00
Adrian Smijulj 98211718ad
Watch Command - Added --path Argument (#7247) 2021-06-21 17:34:21 +10:00
Pat Gavlin 4da051a799
Add a convert-trace command. (#7319)
This command converts an appdash trace into a pprof file for use with
`go tool pprof`. Spans are converted into stacks by sampling each root
span at a given rate and recording the stack of subspans at each sample.

These changes also replace the conditional addition of experimental and
debug commands with conditional visibility. Experimental and debug
commands will always be available, but will be hidden unless the
appropraite environment variables are set.

Co-authored-by: Levi Blackstone <levi@pulumi.com>
2021-06-17 14:46:05 -07:00
Justin Van Patten 258fb00bc2
[codegen/schema] Fix intermittent failing test (#7304)
The `bad-methods-2.json` test ensures there is an error when trying to use a function as a method twice.

The schema looks like:

```
"methods": {
    "bar": "xyz:index:Foo/bar",
    "baz": "xyz:index:Foo/bar"
}
```

And the expected error is:

> function xyz:index:Foo/bar for method baz is already a method

However, when the schema is unmarshalled into a map, the keys in the map are unordered (just as JSON keys in objects are unordered), so occaisonally we'd see an error mentioning method `bar` rather than `baz`:

> function xyz:index:Foo/bar for method bar is already a method

To address this, we'll fix the portion of the code that is generating the error to walk the map in a deterministic order, and we'll also return the list of methods in the same deterministic order as well.
2021-06-16 07:14:53 -07:00
Anton Tayanovskyy 30e999ff1a
Tracing enhancements for CLI perf metrics capture (#7279)
* Allow ProgramTest Tracing flag to expand {command}

* Fix comment typos

* Memory stats collection
2021-06-15 13:25:03 -04:00
Pat Gavlin af87128fb5
Add an option to skip resource typechecking. (#7305)
More testing has found further issues with incorrect attribute shapes
generated by tf2pulumi. This knob will allow us to continue to generate
examples until those bugs are fixed.
2021-06-15 10:22:57 -07:00
Pat Gavlin 5867fa84ce
[codegen/pcl] Allow missing object properties. (#7297)
Add an option to allow missing object properties. This will prevent us
from losing examples once resource typechecking is fixed (it is
currently unintentionally disabled because the resource inputs object
type has an unexpected shape).
2021-06-15 09:09:16 -07:00
Justin Van Patten 4156df31f7
[codegen/python] Cache the package version (#7293)
Every time a resource is created (without an explicit provider version specified), `_utilities.get_version()` is called to determine the package version. This call is expensive and can measurably impact performance, especially for programs with many resources. This change caches the value so it is only determined once.
2021-06-14 10:22:57 -07:00
Anton Tayanovskyy 7ff1491397
Add trace proxying to fix sub-process trace collection into files (#7248)
* Add trace proxying to fix sub-process trace collection when tracing to files

* Better func naming in test

* Avoid dealing with Windows path nightmare

* On Windows it is go.exe of course

* Rename operation to component to better align with existing trace output
2021-06-10 22:57:18 -04:00
Komal 470be8c2b8
[cli/import] - Handle panic during import codegen (#7265) 2021-06-10 19:24:15 -07:00
Justin Van Patten 4e9e017cd2
[codegen/python] Rename conflicting ResourceArgs classes (#7171)
Python resource constructor overloads were recently added that accept a
`<Resource>Args` class for input properties, as an alternative to the
other constructor overload that accepts keyword arguments. The name of
the new args class is the name of the resource concatenated with an
`Args` suffix.

Some providers (e.g. Kubernetes, Azure Native, and Google Native) have
input types with the same name as resources in the same module, which
results in two different `<Resource>Args` classes in the same module.

When you try to use the new args class with the constructor, e.g.:

```python
pulumi_kubernetes.storage.v1.StorageClass(
            resource_name='string',
            args=pulumi_kubernetes.storage.v1.StorageClassArgs(...),
            opts=pulumi.ResourceOptions(...),
)
```

You run into an error, because
`pulumi_kubernetes.storage.v1.StorageClassArgs` is actually referring to
the existing input type rather than the intended `StorageClassArgs`
class for the constructor arguments.

Having the duplicate classes hasn't broken existing usage of the input
type because we "export" all the input types for a module _after_ all
the resources and resource args classes are exported, so the input type
just ends up "overwriting" the duplicate resource args class.

Other languages don't have this problem because the input type is either
in it's own module/namespace (e.g. Node.js and .NET) or a different name
is used for the input type (Go). But with Python, the input types and
resources are all available in the same module.

To address this for Python, when there is an input type in the same
module with the same name as the resource, the args class for the
resource will be emitted as `<Resource>InitArgs` instead of
`<Resource>Args`.
2021-06-10 10:41:49 -07:00
Justin Van Patten de871cec8e
Add schema support for methods (#7141) 2021-06-10 09:47:25 -07:00
Mikhail Shilkov af0054093a Add helper methods to StringSet 2021-06-09 12:02:32 +02:00
James Nugent 601396c673
Include props which have underlying strings on Go SDK providers (#7230)
This commit modifies the work in #7058 to permit properties which do not
pass the test of being strings directly, but which have an underlying
type of string.

When applied to `pulumi-aws`, this results in the following diff:

```
diff --git a/sdk/go/aws/provider.go b/sdk/go/aws/provider.go
index c32ad2367..8b4c9fd0a 100644
--- a/sdk/go/aws/provider.go
+++ b/sdk/go/aws/provider.go
@@ -21,6 +21,8 @@ type Provider struct {
 	AccessKey pulumi.StringPtrOutput `pulumi:"accessKey"`
 	// The profile for API operations. If not set, the default profile created with `aws configure` will be used.
 	Profile pulumi.StringPtrOutput `pulumi:"profile"`
+	// The region where AWS operations will take place. Examples are us-east-1, us-west-2, etc.
+	Region pulumi.StringPtrOutput `pulumi:"region"`
 	// The secret key for API operations. You can retrieve this from the 'Security & Credentials' section of the AWS console.
 	SecretKey pulumi.StringPtrOutput `pulumi:"secretKey"`
 	// The path to the shared credentials file. If not set this defaults to ~/.aws/credentials.
```

The primary purpose this is desirable is to expose Region from instances
of the AWS provider.
2021-06-08 13:05:31 -07:00
Luke Hoban c5907962d6
Render logs consistently in watch and logs (#7235)
We were trimming trailing newlines from log messages in `pulumi logs` but not in `pulumi watch`.  The latter was seeing many empty lines in logs as a result of this.  This change consistently trims trailing newlines in all log rendering.
2021-06-08 11:20:59 +10:00
Justin Van Patten f1fa3a141d
[codegen/dotnet] Fix plain properties (#7180)
Fix the generated C# code for plain properties:

- Value types should not be initialized with `= null!`
- Arrays and maps should be `List<T>` and `Dictionary<string, TValue>`
2021-06-04 09:25:20 -07:00
Paul Stack 3f73230ec7
[cli] Protect against panic when using incorrect token type in pulumi import (#7202)
Fixes: #6990
2021-06-04 15:08:40 +03:00
Mike Metral 672feff428
Fix Go init.go codegen to be govet compliant (#7195)
Co-authored-by: Mike Metral <mmetral@apple.com>
2021-06-04 13:57:04 +03:00
Emiliza Gutierrez 8dda59d10f
Bumping version of go-cloud to v.0.23.0 (#7204)
* updating to go-cloud 0.23.0

* referencing go-cloud directly, remove fork reference

* updating dependencies from make ensure

* updating changelog
2021-06-03 15:28:33 -07:00
Praneet Loke dbea8058a2
Bump the Pulumi Service API version header to 7 (#7193)
* Version 7 indicates to the Pulumi Service that the CLI supports setting required headers for policy pack publishing

* Add bumping the Pulumi Service API version to the PR checklist
2021-06-02 11:32:52 -07:00
Evan Boyle 6ae6cc45b7
skip installing dev dependencies for nodejs plugin setup (#7188) 2021-06-02 11:09:03 -07:00
Evan Boyle e1576d13b3
make plugin metadata (size, install time) opt in for list operations (#7163)
This change is a simple perf optimization to speed up the process of listing plugins by excluding some metadata like size by default.

Our strategy for finding a plugin is to first look on the path, and then to iterate through all plugins in the plugin cache (a directory). We do this for each plugin that is loaded when NewProvider is called. Unfortunately, the codepath that gets all plugins is shared by pulumi plugin ls that needs to do things like display the total size of all plugins, the size of each plugin, and when the plugin was last installed/last used.

This means that any time a plugin is loaded, we are computing the size of all plugins by recursively enumerating all folder (including all of the node_modules directories of any installed node multi-lang plugins!). For my 5 gb of node plugins this translated to 10s of overhead each time a plugin was loaded.

This change is a very simple fix. pulumi plugin ls is the only code path that uses size, so we create a dedicated code path GetPluginsWithMetadata that populates that info, excluding from the result of GetPlugins by default.
2021-05-28 07:26:08 -07:00
Praneet Loke 734db8368e
Support using pre-signed URLs for Azure Storage issued by the Pulumi Service (#7137)
Add RequiredHeaders attribute to the CreatePolicyPackResponse
2021-05-27 21:45:35 -07:00
Justin Van Patten ed9124972c
[codegen/go] Fix emitted type of resources and types (#7158)
In Go, resource types are modeled as pointers, but there were cases where the type was not being emitted as a pointer, leading to panics and marshaling errors in programs. Additionally, array and map values that are external references were being emitted as pointers, but only resources should be pointers (not types), regardless of whether the resource type is external or local.
2021-05-27 16:02:19 -07:00
Levi Blackstone aeb6857f7f
[codegen] Encrypt input args for secret properties (#7128)
The output side was already handled using the
addionalSecretOutputs property. This change
ensures both inputs and outputs are encrypted
in the state.
2021-05-26 16:00:51 -06:00
Anton Tayanovskyy 85142462c7
Fix non-deterministic ordering of generated Python code (#7136)
* Fix non-deterministic ordering of generated Python code

* Repro the problem in a test and fix it; address comments

* Lint
2021-05-26 13:22:05 -04:00
Joe Duffy 7101046709
Send plugin install output to stderr (#7115)
* Send plugin install output to stderr

We currently send plugin install output to stdout. This interferes
with --json (#5747), automation API scenarios, and in general is bad
CLI hygiene. This change sends plugin output to stdout instead.

* Add a changelog entry
2021-05-25 19:02:09 -07:00
stack72 9a96d3c5e1 [deps] Ensuring pulumi/pulumi pkg references pulumi sdk v3.3.1 2021-05-25 09:35:31 +01:00
Paul Stack 3cf16b994d
Add RKE and SumoLogic to docs generation titles (#7108) 2021-05-21 18:48:25 +01:00
James Nugent 15004e88cd
Omit non-string provider properties from code-gen (#7058)
Following pulumi/pulumi-terraform-bridge#347, properties are generated
for all provider config matching the inputs. Unfortunately this does not
work for complex values and non-string primitives generally (not only in
bridged providers) since values are JSON serialized.

While a proper solution to this is designed, it's sufficient for now to
stop generating non-string properties, which this commit does.
2021-05-21 10:37:48 -07:00
James Nugent 64f4a22b67
Allow editable installs of dev Python packages (#7097)
This commit adds a fallback for the README definition in the generated
setup.py files for Python SDKs, thus allowing editable installs of
packages which not yet been built.

Co-authored-by: Luke Hoban <luke@pulumi.com>
2021-05-21 13:40:30 +10:00
stack72 71297a56b4 [deps] Ensuring pulumi/pulumi pkg references pulumi sdk v3.3.0 2021-05-20 13:25:06 +01:00
Justin Van Patten a61e79eb0d
[sdk/nodejs] Warn when a secret config is read as a non-secret (#6896) 2021-05-18 09:48:08 -07:00
Paul Stack 03e7601301
[cli] Provide user feedback when protected resources can't be deleted (#7055) 2021-05-18 00:43:43 +01:00
Luke Hoban 8587f5410e
Error instead of assert on invalid resource in state file (#7065)
* Error instead of assert on invalid resource in state file

Fixes #6955

* Add CHANGELOG
2021-05-17 09:47:28 +01:00
Anton Tayanovskyy 493bac4c18
Make virtualenv paths relative to root when main points elsewhere (#6966)
* Propagate workspace.Project metadata to plugin init

* Get to a working fix

* Propagate Root via plugin context

* Propagate root instead of yaml path

* Revert out unnecessary parameter propagation

* Root is now always absolute at this point; simplify code and docs

* Drop python conditional and propagate unused -root to all lang hosts

* Add tests that fail before and pass after

* Lint

* Add changelog entry
2021-05-14 13:41:55 -04:00
Anton Tayanovskyy 2288f8b7fb
Fix issue with lazy_import affecting pulumi-eks (#7024)
* Fix issue with lazy_import in presense of modules-as-attrs

* Temporary inline _lazy_import into generated code for smooth updates

* Add CHANGELOG entry

* Rename _lazy_import to lazy_import

* Comments on short-circuit behavior

* Comment fix
2021-05-11 22:48:08 -04:00
Evan Boyle b4323ea437
Relax readonly requirement for generated nodejs resource args (#6980) 2021-05-06 21:59:40 -07:00
James Nugent 73c8cc3ec5
Permit override of Python package naming (#6971)
This commit adds a new language option for Python generation to specify
the package name instead of using `pulumi_x` where x is the name defined
in the schema.

A new test is added, and this has also been shown to produce no diff
when run against `pulumi-eks`.
2021-05-06 11:18:14 -07:00
stack72 24875d810c [deps] Ensuring pulumi/pulumi pkg references pulumi sdk v3.2.1 2021-05-06 17:23:58 +01:00
Paul Stack 17120867d9
[cli] Prevent regression in loading passphrase secrets provider from state (#6976)
Fixes: #6974

Passphrase Environment variables were set before loading the
secrets provider from state

Unfortunately, it seems that some users are using empty passphrases
and thus this newly introduced logic has broken their usecases

We now check that the environment variables are set - it doesn't
matter if they are set as empty, but the existance of an empty
environment variabe still suggests that it is an intentional
empty passphrase
2021-05-06 14:40:44 +01:00
Christian Nunciato 3635dc28c3
Add a note to a README about regenerating test data (#6970) 2021-05-05 12:59:37 -07:00
stack72 46ec1aa9e2 [deps] Ensuring pulumi/pulumi pkg references pulumi sdk v3.2.0 2021-05-05 18:28:59 +01:00
Mikhail Shilkov 1378c45849 Discriminated unions in schema and programgen 2021-05-05 10:01:22 +02:00
Christian Nunciato 3b8a0dd3e3
Remove leading and trailing whitespace in resource properties (#6959)
* Remove leading and trailing whitespace in resource properties

* Make tests pass

* Add PULUMI_ACCEPT support to docs gen tests

* Handle a couple more places

Co-authored-by: Pat Gavlin <pat@pulumi.com>
2021-05-04 17:59:30 -07:00
Paul Stack f99b814f13
Ensure ResourceReference is included in printPropertyValue (#6962)
Fixes: #6934

With this snippet of code:

```
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Create an AWS resource (S3 Bucket)
		vpc, err := ec2.NewVpc(ctx, "main", &ec2.VpcArgs{
			CidrBlock: pulumi.String("10.0.0.0/16"),
		})
		if err != nil {
			return err
		}

		rt, err := ec2.NewRouteTable(ctx, "example", &ec2.RouteTableArgs{
			VpcId: vpc.ID(),
		})

		// Export the name of the bucket
		ctx.Export("rt", rt)
		return nil
	})
}
```

the CLI would panic on the diff as follows:

```
panic: fatal: An assertion has failed

goroutine 249 [running]:
github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.failfast(...)
	/private/tmp/pulumi-20210422-70582-1bpvlru/sdk/go/common/util/contract/failfast.go:23
github.com/pulumi/pulumi/sdk/v3/go/common/util/contract.Assert(...)
	/private/tmp/pulumi-20210422-70582-1bpvlru/sdk/go/common/util/contract/assert.go:26
github.com/pulumi/pulumi/pkg/v3/engine.printPropertyValue(0xc0005d41b0, 0x57cce00, 0xc001da9050, 0x0, 0x1, 0x5932853, 0x4, 0x0)
	/private/tmp/pulumi-20210422-70582-1bpvlru/pkg/engine/diff.go:511 +0x1485
```

This was due to the entire object being added to the output and
the property being a ResourceReference

On the changing of the code to use a switch statement, we can
now include the ResourceReference and ensure that we catch any
missing case statements with a panic as default

This means the same piece of code now outputs to the CLI as
follows:

```
Outputs:
    rt: {
        URN: "urn:pulumi:dev::testing-new-engine-diff::aws:ec2/routeTable:RouteTable::example"
        ID : "rtb-09b37608ec34f3b49"
        PackageVersion: ""
    }

Resources:
    3 unchanged

Duration: 2s
```
2021-05-04 19:34:28 +01:00
Evan Boyle c3dc2d54ab
Add user agent to the CLI, Go and Nodejs Automation API SDKs (#6935) 2021-04-30 07:26:23 -07:00
James Nugent 93d7057f80
[codegen/go] Respect baseImportPath in Go SDKs (#6866)
If `rootPackageName` is set, we can look for the version in the
baseImportPath rather than at a location based on the package name -
which currently fails if every component is not named `pulumi-*`. To err
on the side of caution, this method is only used for packages where
`rootPackageName` is set, meaning existing SDKs retain their current
behavior.

The new behavior is confirmed via the test added in #6862.
2021-04-29 17:09:05 -06:00
Anton Tayanovskyy 6f1ea08993
Import subpackages lazily (#6827)
* Import subpackages lazily

* Tighten up lazy_import impl

* Eagerly register resources, but lazily load their impl

* Add CHANGELOG entry

* Satisfy lint

* Restore mypy behavior so the change is not breaking

* Fix golden tests
2021-04-29 16:08:22 -04:00
James Nugent f73ec2fc71
[codegen/go] Permit production of flat Go packages (#6862)
When working in a monorepo environment, it can be desirable to generate
Go SDKs into a structure less like the upstream SDKs, and more like
this:

github.com/x/mymonorepo/sdk/go/package-name

Where `package-name` is also the root of a Go module. Since
`package-name` is not a valid package name in Go, it's also desirable to
be able to choose a replacement name and reduce the amount of nesting.

This commit adds a new Go option to the schema, `rootPackageName`, which
can be used to modify the generated root package name (e.g. to
`mypackage` instead of `package-name`, and remove the additional layer
of nesting.

Test coverage is added to ensure that the correct file structure and
package names are generated.
2021-04-29 13:30:01 -06:00
Paul Stack 0739fa396d
[cleanup] Small stylistic changes to NewPassphaseSecretsManagerFromState (#6909)
This incorporates some post merge feedback from https://github.com/pulumi/pulumi/pull/6893

This doesn't change the functionality of any of the tests:

```
go test -v ./secrets/passphrase -count=1
=== RUN   TestPassphraseManagerIncorrectPassphraseReturnsErrorCrypter
--- PASS: TestPassphraseManagerIncorrectPassphraseReturnsErrorCrypter (0.89s)
=== RUN   TestPassphraseManagerIncorrectStateReturnsError
--- PASS: TestPassphraseManagerIncorrectStateReturnsError (0.00s)
=== RUN   TestPassphraseManagerCorrectPassphraseReturnsSecretsManager
--- PASS: TestPassphraseManagerCorrectPassphraseReturnsSecretsManager (1.08s)
=== RUN   TestPassphraseManagerNoEnvironmentVariablesReturnsError
--- PASS: TestPassphraseManagerNoEnvironmentVariablesReturnsError (0.00s)
PASS
ok  	github.com/pulumi/pulumi/pkg/v3/secrets/passphrase	2.270s
```
2021-04-29 11:37:25 +01:00
Sean Fausett 276d3570ed Enable deterministic builds 2021-04-29 14:24:43 +12:00
Paul Stack 1640b7a5b1
[cli] Ensure the user has set PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE (#6893)
Fixes: #6286

When a user is using the passphrase provider and unsets the environment
variables that let them interact with the secrets provider, then would
get an error as follows:

```
▶ pulumi up -y -f
error: decrypting secret value: failed to decrypt: incorrect passphrase, please set PULUMI_CONFIG_PASSPHRASE to the correct passphrase
```

We are oging to change this error message to make it more obvious
to a user what the error is and how they need to fix it

```
▶ pulumi up -y -f
error: constructing secrets manager of type "passphrase": unable to find either `PULUMI_CONFIG_PASSPHRASE` nor `PULUMI_CONFIG_PASSPHRASE_FILE` when trying to access the Passphrase Secrets Manager. Please ensure one of these values are set to allow the operation to continue
```

Ideally, we would like to prompt the user for the passphrase at this
point rather than error, but the CLI could be in the middle of an
update operation as the same codepath is used for reading stackreference
values
2021-04-28 01:21:16 +01:00
James Nugent 3e3e4f2deb
Permit Go program gen to work with modules at v1 (#6855)
This commit adjusts the way that Go module versions are discovered from
packages when generating Go programs, to account for those on module
version 1. Previously, this function would panic when dereferencing a
nil instance of semver.Version.
2021-04-26 19:19:43 -07:00
stack72 5279b1dfcf [deps] Ensuring pulumi/pulumi pkg references pulumi sdk v3.1.0 2021-04-22 19:34:31 +01:00
Komal 61ce479241
Re-add [BREAKING] - Standardize stack select behavior (#6300) (#6840)
Co-authored-by: Paul Stack <public@paulstack.co.uk>
2021-04-22 14:10:39 +01:00
Komal f8d0ab8803
Re-add - Set pagination defaults for pulumi stack history to 10 entries (#6739) (#6841)
* Set pagination defaults for `pulumi stack history` to 10 entries (#6739)

* Update changelog

Co-authored-by: Evan Boyle <EvanBoyle@users.noreply.github.com>
2021-04-22 13:52:27 +01:00
stack72 23c6e0318e Changing the logo reference in the DotNet Codegen to be the new Pulumi logo 2021-04-21 20:26:00 +01:00
stack72 fecbee5ca5 Ensuring Yandex is part of the docs title generations 2021-04-21 00:41:37 +01:00
Pat Gavlin 6a33b4b7ee
Distinguish between inputty and plain args types. (#6811)
These changes fix a regression introduced by #6686 that caused the SDK
code generators for .NET, Python, and Typescript to omit definitions for
plain object types. This regression occurred because #6686 drew a
clearer line between types used as resource arguments and types used
as function arguments, but conflated "resource arguments" with "inputty
types". This caused the code generators to generate inputty types for
any types used as resource arguments, even those that are used for
plainly-typed properties.

Fixes #6796.
2021-04-19 16:40:39 -07:00
Pat Gavlin 89595a3365
Do not wrap types in Input<> when generating docs. (#6812)
Just what it says on the tin. These changes also add more expansive
tests for documentation generation using our existing example schemas.

Fixes #6797.
2021-04-19 14:05:23 -07:00
stack72 c27e58bf2d [deps] Ensuring pulumi/pulumi pkg references pulumi sdk v3.0.0 2021-04-19 09:14:31 +01:00
Paul Stack ddc3a30406
Merge pull request #6799 from pulumi/reconcile-master-2.x
Reconcile master with 2.25.x patch releases
2021-04-18 21:06:40 +01:00
Justin Van Patten 48a1d3f696
[docgen] Fix horizontal scroll in python resource docs (#6801)
Add line breaks and whitespace to avoid long horizontal scrolls for Python constructor/function arguments. Also, include the new ResourceArgs constructor overload.
2021-04-17 15:33:23 -07:00
stack72 2a224982a5 Reconcile master with 2.25.x patch releases 2021-04-17 11:43:08 +01:00
Justin Van Patten 780a0c8a3d
Support defining remote components in Go (#6403) 2021-04-16 11:49:21 -07:00
Pat Gavlin 507082c003
Generate old type names in k8s compat mode. (#6788)
This avoids unintentional breaking changes. Ideally we would use a
different knob, but we only have one compat field at the moment.
2021-04-16 11:30:25 -07:00
Vivek Lakshmanan c00dc5b4ca Rename gcp-native reference in docs 2021-04-16 09:06:11 -07:00
stack72 664776efe8 [deps] Ensuring pulumi/pulumi pkg references pulumi sdk v3.0.0-rc.1 2021-04-16 09:00:09 +01:00
Pat Gavlin 1cc084dc0e
Fix inconsistent object type naming. (#6686)
See #6200 for a complete description of the issue. In short, we generate
inconsistent names for object types depending on whether or not they are
transitively reachable from resources or functions, which risks
unintentional breaking changes due to schema updates.

1. Name "input" types differently: `TArgs` for a type that is used in
   resource inputs, having `Input<T>` properties, and `T` for a type
   that is used in invoke inputs. The same schema type can produce both.

2. Always keep the name `T` for output types, avoid appending `Result` to
   the name.

3. As needed, introduce a flag in the existing providers' schemas to avoid
   breaking changes. Consider removing it on a major version bump.

Fixes #6200.
2021-04-15 19:03:28 -07:00
Justin Van Patten f7f33d92af [codegen/python] Remove deprecated __name__ and __opts__ args (#6765)
These have been deprecated for a very long time and it's a trivial change to remove them from the generated code. Let's clean this up for the 3.0-based providers.
2021-04-14 19:32:18 +01:00
Paul Stack 19bd08fb1c fixup linting errors after rebase of master -> feature-3.0 (#6766) 2021-04-14 19:32:18 +01:00
stack72 5679496127 [deps] Ensuring pulumi/pulumi pkg references pulumi sdk v3.0.0-beta.2 2021-04-14 19:32:18 +01:00
Paul Stack f6fea7fafb [cli] Removing the deprecated pulumi history command (#6724) 2021-04-14 19:32:18 +01: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
Justin Van Patten fef3157b18 [codegen/python] Adopt improved key translation (#6696)
This change updates the Python SDK codegen to opt-in to the new casing
translation behavior, which will use the passed-in props type's property
name metadata for translations, rather than calling the resource's
`translate_input_property` and `translate_output_property` methods.

- FIX: Keys in user-defined dicts will no longer be unintentionally
  translated/modified.

- BREAKING: Dictionary keys in nested output classes are now
  consistently snake_case. If accessing camelCase keys from such output
  classes, move to accessing the values via the snake_case property
  getters (or snake_case keys). A warning will be logged when accessing
  camelCase keys.

When serializing inputs:

- If a value is a dict and the associated type is an input type, the
dict's keys will be translated based on the input type's property
name metadata.

- If a value is a dict and the associated type is a dict (or Mapping),
the dict's keys will _not_ be translated.

When resolving outputs:

- If a value is a dict and the associated type is an output type, the
dict's keys will be translated based on the output type's property
name metadata.

- If a value is a dict and the associated type is a dict (or Mapping),
the dict's keys will _not_ be translated.
2021-04-14 19:32:18 +01:00
stack72 e05477b8d6 [deps] Ensuring pulumi/pulumi pkg references pulumi sdk v3.0.0-beta.1 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
stack72 5db7c9e277 [deps] Ensuring pulumi/pulumi pkg references pulumi sdk v2.25.0 2021-04-14 17:22:27 +01:00
Levi Blackstone d0509bee49
[cli] Handle providers field for RegisterResourceRequest (#6764)
Update the RegisterResource method in the ResourceMonitor
to unmarshal the providers field added in d297db3 and then resolve
any provider references so that they can be set on the Construct call.
2021-04-13 18:56:34 -06:00
Vivek Lakshmanan e5c99b5f65 Update escape character list for python docstrings 2021-04-13 15:12:50 -07:00
Vivek Lakshmanan dc32980a51 Add new doc alias 2021-04-12 10:36:58 -07:00
svangordon-fruit b7d4032044
Add a flag to stack history to print full dates (#6742) 2021-04-11 20:38:41 +01:00
Evan Boyle 15120b99e3
Enable absolute and relative parent paths for pulumi main (#6734) 2021-04-08 21:39:52 -07:00
Paul Stack 9a66a4182b
fix typo in pulumi stack cli docs (#6721)
Co-authored-by: Charles McGowan <40527412+glitchwizard@users.noreply.github.com>
2021-04-08 09:47:20 +01:00
Justin Van Patten dcf4359c57
[codegen/python] Support <Resource>Args classes (#6525)
Add support for creating instances of resources in Python using a
`<Resource>Args` class. This capability aligns with how args are passed
to resources in all the other language SDKs and the separate object bag
allows the properties to be manipulated/validated/passed-around before
creating the resource.
2021-04-02 10:09:17 -07:00
stack72 7f6ec8a7cf Cleanup after v2.24.1 release 2021-04-01 22:11:21 +01:00
Levi Blackstone 2dad8a6649
Revert "Swap out YAML parser library (#6642)" (#6681)
This reverts commit ff2cf70
2021-04-01 14:44:29 -06:00
Justin Van Patten a9f0aead13
[codegen/go] Fix Go resource registrations (#6641)
We've been emitting calls to `New<Resource>` for resource registrations
in Go, passing `nil` for args. However, some of those `New<Resource>`
functions actually check for `nil` args and return an error if the
resource has required arguments.

At first, I was looking for a way to check inside `New<Resource>` if
the `URN` option was specified and in that case not error on
`nil` args (like we do in other languages), but we don't provide a way
to access the resource option values outside the Go SDK), so I don't
think there is a way to do it this way for Go.

So instead, this change updates the registration code to call
`ctx.RegisterResource` directly instead of `New<Resource>`, where we can
pass a `nil` args.
2021-03-31 16:50:30 -06:00
Vivek Lakshmanan 656ed796a1
Merge pull request #6528 from pulumi/vl/Nested
[codegen/go] Support nested collection types
2021-03-31 14:37:56 -07:00
stack72 80a43e9bec [deps] Ensuring pulumi/pulumi pkg references pulumi sdk v2.24.0 2021-03-31 21:27:02 +01:00
Vivek Lakshmanan 78c48d5d31 Fix comment/example handling 2021-03-30 22:24:45 -07:00
Vivek Lakshmanan fec7209d6b PR comments and some additional cleanup 2021-03-30 22:24:11 -07:00
Vivek Lakshmanan 3151d23f09 Fix to create inputs for nested collections types 2021-03-30 22:24:11 -07:00
Vivek Lakshmanan 05b196dc59 Avoid processing collections of primitives 2021-03-30 22:24:11 -07:00
Vivek Lakshmanan 8b5e196209 Cleanup 2021-03-30 22:24:11 -07:00
Vivek Lakshmanan 700a576b70 Support nested collection types 2021-03-30 22:24:11 -07:00
Levi Blackstone ff2cf701a7
Swap out YAML parser library (#6642)
Related to #423
2021-03-29 14:49:00 -06:00
stack72 1c16f3bea7 [deps] Ensure pulumi/pulumi pkg uses sdk v2.23.2 2021-03-25 17:35:35 +00:00
Luke Hoban b82b850af0
Fix pulumi refresh diffs (#6568) 2021-03-19 13:11:59 +11:00
pulumi-bot 92544b746a [deps] Pinning pulumi/pulumi pkg & tests to v2.23.1 of the pulumi sdk 2021-03-18 04:14:20 +00:00
pulumi-bot 7977f1d160 Post v2.23.0 release cleanup 2021-03-17 19:23:39 +00:00
pulumi-bot 8a98c7fc14 [deps] Pinning pulumi/pulumi pkg to v2.23.0 of the pulumi sdk 2021-03-17 16:24:06 +00:00
Kraig Amador 71ec66aa45
Support locking on filestate logins (#2697)
When using the filestate backend (local files and cloud buckets) there is no protection to prevent two processes from managing the same stack simultaneously.

This PR creates a locks directory in the management directory that stores lock files for a stack. Each backend implementation gets its own UUID that is joined with the stack name. The feature is currently available behind the `PULUMI_SELF_MANAGED_STATE_LOCKING=1` environment variable flag.
2021-03-16 14:00:47 +11:00
Paul Stack 59686ab3ad
Ensure a user has access to the secret manager before trying to decrypt checkpoint (#6215) 2021-03-15 14:17:43 +00:00
Christian Nunciato c20bdbe945
Update resource-docs templates to adjust for Hugo upgrade (#6524) 2021-03-14 07:24:55 -07:00
Paul Stack 3f2d58ef7b
Fixing up go.mod and go.sum to ensure they don't continually change (#6502) 2021-03-11 20:41:45 +00:00