Commit graph

2813 commits

Author SHA1 Message Date
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
Komal 10d99b8afb
[automation/go] - Expose structured logging (#6436) 2021-03-10 20:49:48 -08:00
Paul Stack 63857ac72d
Disabling the use of pulumi watch on darwin/arm64 architecture (#6497) 2021-03-10 22:03:55 +00:00
Paul Stack 1f16423ede
Change nodejs codegen to use coalescing operator when when default values are present (#6496) 2021-03-10 21:16:18 +00:00
Justin Van Patten 572c74826c
Add schema & codegen support for plain properties (#6481)
This change adds schema and codegen support for plain properties which
are emitted typed as the plain type rather than wrapped as an `Input`.
Plain properties require a prompt value and do not accept a value that
is `Output`.
2021-03-10 07:08:08 -08:00
Paul Stack 0241fb282c
Upgrading to go-cloud v0.22.0 (#6473) 2021-03-09 18:59:01 +00:00
Paul Stack 0d5b3d375d
Ensuring dotnet package sources are correct for local packages (#6476)
When passing a package source as part of a `dotnet add package` in
our acceptance testing framework, dotnet was then trying to use that
package source for the restoration of other packages in the csproj
file.

We have removed passing the source to dotnet add package add
and replaced it with adding a machine level package source via
dotnet nuget add source command

this is the more correct way to work and will allow us to be able
to search multiple locations as part of the dotnet restore command
2021-03-09 14:57:24 +00:00
Mikhail Shilkov 3ddf121b79 Respect provider aliases while diffing resources 2021-03-02 22:48:31 +01:00
Mikhail Shilkov d1bd1a6cef Add missing provider title lookup 2021-03-02 15:59:41 +01:00
Komal 8616390418
[codegen/python] - Fix python .get() codegen (#6433) 2021-03-01 09:54:25 -08:00
Vivek Lakshmanan 48aff05ff3
Merge pull request #6428 from pulumi/vl/EnumContainerTypes
Adding enum container types support for go codegen
2021-02-26 09:42:31 -08:00
Vivek Lakshmanan 8d022e39e8 Fix tests 2021-02-25 22:26:54 -08:00
Vivek Lakshmanan 92571f8f12 Adding enum container types support for go codegen 2021-02-25 22:26:37 -08:00
Komal ebb6575185
Add triple quotes around deprecation warnings. (#6429) 2021-02-25 21:22:04 -08:00
Mikhail Shilkov 9a837db992 Fix a lint error 2021-02-23 11:17:02 +01:00
Mikhail Shilkov 5b2ebc738b
Merge pull request #6250 from pulumi/mikhailshilkov/stack-overflow-programgen
Avoid stack overflow in Azure NextGen program examples
2021-02-23 09:45:50 +01:00
Luke Hoban 8fc6f910b4
Fix mustWrite for Input/Output PropertyMaps (#6396) 2021-02-23 09:04:57 +11:00
Justin Van Patten 277dee6cc1
[codegen/dotnet] Fixes to version.txt (#6398)
We currently include `version.txt` in the package via `<Content Include="version.txt">`. This places the file in the NuGet package in two locations: the `content` directory and `contentFiles`.

We want the file to be in `content` because this is where the Pulumi .NET Language host looks for the file when determining a program's required plugins.

However, having the file in `contentFiles` is problematic. For packages that reference other Pulumi resource packages (e.g. for multi-lang components), referenced `contentFiles` are included in the package by default. This means another package's `version.txt` will be included and used over the current project's `version.txt`. For example, if a multi-lang component package `Pulumi.Xyz` references `Pulumi.Aws`, the `version.txt` from `Pulumi.Aws` will be used in `Pulumi.Xyz` package rather than the intended `version.txt` for `Pulumi.Xyz`.

To address this, stop including `version.txt` in `contentFiles`. We do this by changing the `<Content Include="version.txt" />` to `<None Include="version.txt" Pack="True" PackagePath="content" />` in the project file. This  ensures the file will still be included in the package in the `content` dir (where the Pulumi .NET language host expects to find it), but doesn't include the file in `contentFiles` which would cause it to be used in other packages that reference the package.

Further, when generating `<PackageReference>`s for packages that start with "Pulumi.", include an additional `ExcludeAssets="contentFiles"` attribute to prevent the package's `contentFiles` from being included.
2021-02-22 08:33:16 -08:00
Komal 4882c9fec5
[CLI] - Add commands for config set-all and rm-all (#6373) 2021-02-19 21:55:58 -08:00
Paul Stack 1731053b18
[cli] Disable permalinks to the update details page when using elf-managed backends (S3, Azure, GCS) (#6251)
Fixes: #4029
Fixes: #3537

Should the user want to get permalinks when using a self-managed backend, they can pass a flag:
```
$ pulumi up --suppress-permalink false
```

Permalinks for these self-managed backends will be suppressed on `update`, `preview`, `destroy`,
`import` and `refresh` operations.
2021-02-19 23:55:35 +00:00
Paul Stack 47a43dc862
Allow http cloudurls on pulumi login (#6393) 2021-02-19 22:56:49 +00:00
Justin Van Patten fac20ddf6b
[codegen/python] Emit pulumiplugin.json in the correct dir (#6385)
This new optional file can be used to include additional metadata about the provider plugin (such as version and custom server URL), which the Python language host will use when determining a program's required plugins.

This change fixes the codegen to emit the file in the correct location (inside the package dir). Note: Providers need to opt-in to emitting this file via a schema option (because it requires some Makefile changes to insert the version in the file) and we haven't done that with any of our providers yet.
2021-02-18 13:36:36 -08:00
Komal f4f5aaf500
[codegen/docs] - More doc title fixes (#6357) 2021-02-17 09:08:19 -08:00
Komal ae91a277df
[codegen/docs] - Standardize function and resource titles. (#6325) 2021-02-16 20:03:06 -08:00
Paul Stack 6479653f77
Fixing build of test TestResourceNestedPropertyPythonCasing inpkg/codegen (#6336) 2021-02-15 23:56:09 +00:00
Levi Blackstone a1fc0d2095
[codegen/docs] Add environment variable info to Provider inputs (#6330)
The schema specifies supported environment variables
for Provider inputs, but these are not currently reflected
in the generated docs. This change adds any supported
environment variables to the input property comment
field on Provider resources.

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2021-02-12 17:11:56 -07:00
Justin Van Patten bdc309bb4a
[codegen/python] Fix issues related to referencing external resources/types (#6328)
- Fix bugs referencing external resources/types
- Fix circular import issue
- Avoid panic when referencing external nested types
2021-02-12 15:54:19 -08:00
Luke Hoban f4b0fa86fe
Don't mutate the opts argument in resource constructors in Node.js (#6321) 2021-02-13 05:10:59 +11:00
Justin Van Patten d02c0b1152
Default to UseAutomaticVirtualEnv in integration tests (#6318)
This way, the tests use the built-in virtual environment support by
default, which is what most customers will be using. A new `UsePipenv`
option is available to go back to using pipenv for tests.
2021-02-11 18:16:07 -08:00
Justin Van Patten f111a53337
Look for python binary first on Windows (#6317)
We previously looked for `python3` and fallback to `python` on all systems. However, our Windows CI images include a `python3.exe` symlink to `python.exe` which does not work with `venv`. So on Windows, just look for `python` first, falling back to `python3`. (The default python.org Windows installation only includes `python.exe`).
2021-02-11 11:34:07 -08:00
Justin Van Patten 066507cd00
Do not specify a specific version of Python on Windows (#6316)
We install the version of Python we need in the CI environment (e.g. 3.9.x).
2021-02-11 08:22:04 -08:00
Evan Boyle 8e58f5d682
Add pagination to pulumi stack history (#6292)
replaces the unreleased `--limit` flag with `--page` and `--page-size` to support full pagination
2021-02-09 16:20:01 -08:00
Christian Nunciato e2b48d2f20
Fix up resource-docs links (#6279)
Co-authored-by: Praneet Loke <1466314+praneetloke@users.noreply.github.com>
2021-02-09 09:04:02 -08:00
Evan Boyle 808483218e
fix linting errors in pkg (#6281) 2021-02-08 13:13:55 -08:00
Evan Boyle eefc104c2b
Add --limit flag to pulumi stack history and consume from automation api (#6257)
Adds a `--limit` flag to `pulumi stack history. This allows limiting to the last few entries rather than fetching the entirety of a stack's update history (which can be quite slow for stacks with lots of updates). Example: `pulumi stack history --limit 1` fetches the last history entry only. 

`stack.up` and related operations in the Automation API have been updated to consume this change, drastically reducing overhead.
2021-02-08 10:49:57 -08:00
Christian Nunciato 40ce511a2b
Remove language SDK blocks from resource templates (#6270) 2021-02-07 19:31:05 +00:00
Mikhail Shilkov c007f1f2f8 Avoid stack overflow in Azure NextGen program examples 2021-02-04 15:44:20 +01:00
Chris Smith b29f440f0e
Add comments (#6234) 2021-02-01 16:00:46 -08:00
Justin Van Patten e86a69bedd
[codegen/nodejs] Emit externally referenced resources/types (#6225) 2021-01-29 16:52:00 -08:00
Vivek Lakshmanan 1452709e97 Fix test 2021-01-29 10:14:24 -08:00
Vivek Lakshmanan 7cba9df480 Handle arrays/maps of external refs as pointers 2021-01-29 10:12:17 -08:00
Justin Van Patten b3d11e1c32
Enable resource references by default (#6202) 2021-01-27 13:25:26 -08:00
Paul Stack d72b788011
Ensure Old Secrets Provider Details Removed when Changing to Passphrase (#6210)
Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2021-01-27 20:07:25 +00:00
Vivek Lakshmanan 82020af298 Various fixes go codegen to fix SDK compilation problems 2021-01-26 23:16:42 -08:00
Justin Van Patten d7dc6bf404
[codegen/dotnet]: Fix bugs referencing external resources/types (#6182)
- Avoids problematic `using` statements.
- Fixes fully qualified names of external resources.
- Avoids emitting directories with README.md files for external modules.
2021-01-26 11:02:34 -08:00
Vivek Lakshmanan 54582e7c68
Merge pull request #6179 from pulumi/vl/FixEnum
[codegen/go] Fix default value handling for enums
2021-01-22 19:28:01 -08:00
Vivek Lakshmanan b8e0d53b9b Fix tests for other languages for updated enum test schema 2021-01-22 17:30:44 -08:00
Vivek Lakshmanan fd3bbca5aa Fix default value handling for enums 2021-01-22 17:30:44 -08:00
Levi Blackstone f5dab03846
[codegen/go] Handle hyphenated package names 2021-01-22 15:42:11 -07:00
Mikhail Shilkov 4335a44bfb
Relax the diff path check to avoid panic (#6159) 2021-01-22 12:00:44 +01:00
Vivek Lakshmanan 88d54c0c64 Cleanup 2021-01-21 16:09:08 -08:00
Vivek Lakshmanan f5c76031ae Cleanup test go.mod
Follow up from https://github.com/pulumi/pulumi/pull/6124
2021-01-21 16:00:10 -08:00
Levi Blackstone f6ec691544
Fix malformed resource value bug (#6164)
* Fix resource-ref-as-ID marshaling. (#6125)

This reapplies 2f0dba23ab.

* Fix malformed resource value bug

PR #6125 introduced a bug by marshaling resource
ids as PropertyValues, but not handling that case on
the unmarshaling side. The previous code assumed
that the id was a simple string value. This bug prevents
any stack update operations (preview, update, destroy,
refresh). Since this change was already
released, we must now handle both cases in the
unmarshaling code.

* Add resource ref unit tests for the Go SDK. (#6142)

This reapplies 3d505912b8.

Co-authored-by: Pat Gavlin <pat@pulumi.com>
2021-01-21 16:40:27 -07:00
Paul Stack 9322072146
Revert "Fix resource-ref-as-ID marshaling. (#6125)" (#6167) 2021-01-21 20:37:40 +00:00
Vivek Lakshmanan 6566b9058e Fix base import path handling in go programgen 2021-01-20 16:04:33 -08:00
Vivek Lakshmanan 4da8a45eb2 Option to generate container types resources now specified in GoPackageInfo 2021-01-20 11:29:01 -08:00
Vivek Lakshmanan 38ac84038c Make resource container-type generation optional 2021-01-20 11:29:01 -08:00
Vivek Lakshmanan 3aa566d286 Fix tests 2021-01-20 11:29:01 -08:00
Vivek Lakshmanan 3d6701732a PR comments 2021-01-20 11:29:01 -08:00
Vivek Lakshmanan 68b655bba6 Test fixes for other languages due to change in schema. 2021-01-20 11:29:01 -08:00
Vivek Lakshmanan 8f2901df01 Test data to cover types generated for external references 2021-01-20 11:29:01 -08:00
Vivek Lakshmanan 22896074f3 Expand testing to cover all generated files 2021-01-20 11:29:01 -08:00
Vivek Lakshmanan 842e4aa052 Support for external resource references and imports/aliases 2021-01-20 11:29:01 -08:00
Levi Blackstone 2dfec71a5c
[codegen/go] Register resource modules/packages (#6121) 2021-01-19 16:59:51 -07:00
Paul Stack 3b8c3f7e61
Add an option to be able to stack export showing secrets for use in ExtraRuntimeValidation (#6094)
Fixes: #2993

```
func TestAccMyExample(t *testing.T) {
	test := getBaseOptions().
		With(integration.ProgramTestOptions{
			Dir: filepath.Join(getCwd(t), "test-dir"),
			DecryptSecretsInOutput: true,
			ExtraRuntimeValidation: func(t *testing.T, stackInfo integration.RuntimeValidationStackInfo) {
			  // manipulate the output of the stack here
			}),
		})

	integration.ProgramTest(t, &test)
}
```
2021-01-19 19:18:45 +00:00
Pat Gavlin 2f0dba23ab
Fix resource-ref-as-ID marshaling. (#6125)
When marshaling a resource reference as its ID (i.e. when
opts.KeepResources is false, as it will be in the case of downlevel SDKs
and resource providers), we must take care to marshal/unmarshal an empty
ID as the unknown property value.

This includes the following changes to the resource ref APIs:

- Bifurcate resource reference creation into two methods: one for
  creating references to custom resources and one for creating
  references to component resources.
- Store the ID in a resource reference as a PropertyValue s.t. it can be
  computed.
- Add a helper method for retrieving the ID as a string + an indicator of
  whether or not the reference has an ID.

Fixes #5939.
2021-01-15 16:06:57 -08:00
Paul Stack 655418bbbf
Updating the description for the pulumi logs cli command (#6122)
Fixes: #6118
2021-01-15 18:23:52 +00:00
Levi Blackstone aec642e8c9
[codegen/go] Add utility function to get current package version (#6117)
This function uses reflection to determine the current package
path and then extracts the version from that path string.
2021-01-15 10:03:57 -07:00
Paul Stack 61ae57da0c
Add support for pulumi logout --all (#6101) 2021-01-15 13:38:58 +00:00
Vivek Lakshmanan 6259bc0e8d Remove unnecessary local copy of stringSet 2021-01-12 14:28:50 -08:00
Vivek Lakshmanan 7980f047fb Add test to validate impact of setting PULUMI_BACKEND_URL 2021-01-11 16:27:54 -08:00
Vivek Lakshmanan 0d4f886525
Merge pull request #6069 from pulumi/vl/OptionalStrictEnum
Allow optional strict enum types to be omitted
2021-01-11 11:35:26 -08:00
Levi Blackstone 709fcbad51
Document Go packages (#6009)
Co-authored-by: Pat Gavlin <pat@pulumi.com>
2021-01-11 11:07:59 -07:00
Vivek Lakshmanan 15f9fb395f Address review comments 2021-01-11 10:00:13 -08:00
Vivek Lakshmanan 81b6a1b83d Linting 2021-01-11 09:58:32 -08:00
Vivek Lakshmanan b70c89eeec Allow optional strict enum types to be omitted
Fixes https://github.com/pulumi/pulumi/issues/6068
2021-01-11 09:58:32 -08:00
Pulumi Bot 42f355b497
[CLI] Add Version to the output of pulumi stack history (#6063)
fixes: #4328

Allows events to be tracked back to those of the Pulumi SaaS

Co-authored-by: stack72 <public@paulstack.co.uk>
2021-01-07 19:44:15 +00:00
Pat Gavlin e1ac01a9f2
Respect the version option for provider resources. (#6055)
Although raw provider resources accept an input that allows a user to
specifiy a provider version to use, this input is not reflected in
current SDK code generation. Furthermore, we already have a method to
specify the provider version that should be used for a resource: the
"version" resource option. These changes update the code that handles
provider resource registrations to autmoatically populate the version
input from the "version" resource option if the option is present.

Fixes https://github.com/pulumi/pulumi-azure/issues/803.
2021-01-05 15:57:11 -08:00
Mikhail Shilkov 061950dbc2
[codegen/dotnet] Stop generating nested unions (#6047) 2021-01-05 11:13:40 +01:00