Commit graph

647 commits

Author SHA1 Message Date
Levi Blackstone 54d6703fee
Temporarily disable resource ref support (#5932)
Disable resource ref support until https://github.com/pulumi/pulumi-kubernetes/issues/1405
is fixed. This bug currently affects Python users with recent versions of the pulumi SDK
who are using the pulumi-kubernetes provider.
2020-12-12 12:02:45 -08:00
Evan Boyle 069f9f28cf
Fix bug that could cause Go SDK to drop dependencies (#5930)
* fix bug that could cause Go SDK to drop dependencies

* changelog
2020-12-11 16:27:11 -08:00
Levi Blackstone d3c75afce1
[codegen/go] Fix Input/Output methods for Go resources (#5916) 2020-12-11 11:49:08 -07:00
stack72 93e621aef6 Prepare for v2.15.5 release 2020-12-11 11:49:50 +00:00
Justin Van Patten 160220bc4a
[sdk/dotnet] Fix deserializing resources (#5921)
This change implements getResource in the mock monitor. This uncovered some issues deserializing resources, which this change also addresses.
2020-12-10 22:58:08 -08:00
Justin Van Patten afd5ad6a97
[sdk/python] Implement getResource in the mock monitor (#5919) 2020-12-10 15:23:00 -08:00
Levi Blackstone 4d48ee0517
Enable resource reference feature by default (#5905)
* Enable resource reference feature by default

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

* Set AcceptResources in the language SDKs

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

Co-authored-by: Justin Van Patten <jvp@justinvp.com>
2020-12-10 11:21:05 -07:00
Justin Van Patten 918615f072
[sdk/nodejs] Implement getResource in the mock monitor (#5914)
Otherwise, unit tests for programs that reference resources that have been registered with `registerResourceModule` fail with unhandled exceptions.
2020-12-10 09:30:34 -08:00
Paul Stack 3994fa8c22
Prevent panic when using pulumi import with local backend (#5906)
Fixes: #5876
2020-12-10 13:31:45 +00:00
Luke Hoban b45b3ed543
Re-apply #5857 (#5893)
This re-applies the fix in 5857 to make credentials.json writes concurrency safe.

The original fix used `path.Dir` instead of `filepath.Dir` - which led to not placing the temp file in the same folder (and drive) as the renamed file target.  This led to errors on Windows environments where the working directory was on a different drive than the `~/.pulumi` directory.  The change to use `filepath.Dir` instead ensures that even on Windows, the true directory containing the credentials file is used for the temp file as well.

Fixes #3877.
2020-12-08 17:38:59 -08:00
Aylei faebaa0dc5
[ciutil] Correct system name of Jenkins CI (#5891)
Signed-off-by: Aylei <rayingecho@gmail.com>
2020-12-08 18:36:31 +00:00
stack72 d804b7d99c Prepare for v2.15.4 release 2020-12-08 14:32:15 +00:00
Paul Stack 4f5b3c8522
Ensure we have an import error before using in import path (#5884)
Without this, we can panic
2020-12-08 00:43:35 +00:00
Vivek Lakshmanan aba03b8594
Merge pull request #5874 from pulumi/vl/Windows
Shim python interpreter for windows if interpreter uses reparse points
2020-12-07 15:13:21 -08:00
Vivek Lakshmanan 4e144e666c Add changelog entry 2020-12-07 14:17:45 -08:00
stack72 890a81ac4f Prepare for v2.15.3 release 2020-12-07 18:34:46 +00:00
Luke Hoban df8f01dba7
Revert #5857 (#5880)
Fixes #5879.
2020-12-07 10:06:41 -08:00
stack72 223f6501eb Prepare for v2.15.2 release 2020-12-07 12:48:25 +00:00
Joe Duffy a5c30f1547
Properly resize arrays when adding (#5872)
* Properly resize arrays when adding

The current logic attempts to update the array but, because
append may need to allocate a new array with adequate space,
the code can currently leave dest referring to the old,
under-sized array. The solution is to use the set(dest)
logic that already exists and is used for the IsNull case.

Added a test case that would fail before this fix and now passes.

This fixes pulumi/pulumi#5871.

* Add CHANGELOG entry
2020-12-06 21:23:50 +00:00
stack72 a70cb41731 Prepare for v2.15.1 release 2020-12-04 20:06:10 +00:00
Paul Stack 12dd0767ac
Ensure we can rotate pulumi passphrase secrets providers (#5865)
Fixes: #5452

When the user is requesting to change the secrets provider to a
passphrase provider, we now calculate that has been requested.

This means, we will prompt for a new passphrase for use in encrypting
the stack.

```
pulumi stack change-secrets-provider passphrase
Enter your passphrase to unlock config/secrets
    (set PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE to remember):
Enter your new passphrase to protect config/secrets:
Re-enter your new passphrase to confirm:
Migrating old configuration and state to new secrets provider
Enter your passphrase to unlock config/secrets
    (set PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE to remember):
```
2020-12-04 15:21:51 +00:00
Justin Van Patten 5ab051cd97
Implement GetRequiredPlugins for Python (#5787)
Implement GetRequiredPlugins for Python, which determines the plugins
required by the program.

Also, if the `virtualenv` runtime option is set, and the specified
virtual directory is missing or empty, automatically create it and
install dependencies into it.
2020-12-03 19:22:16 -08:00
Luke Hoban 9e955241fc
Make credentials.json file writes concurrency safe (#5857)
Running `pulumi` operations in parallel could occasionally result in truncating the `~/.pulumi/credentials.json` file and reading that truncated file from another process before the content could be written.

Instead, use `os.Rename` to atomically replace the file contents.

Concurrent `pulumi` operations could still compete for who gets to write the file first, and could lead to surprising results in some extreme cases.   But we should not see the corrupted file contents any longer.

Fixes #3877.
2020-12-03 15:07:55 -08:00
stack72 911eec4d55 Prepare for v2.15.0 release 2020-12-02 20:15:29 +00:00
Justin Van Patten ea1b962999
Revert "Enable resource reference feature by default" (#5850)
To de-risk the Pulumi v2.15.0 release, temporarily revert 679d40950f. Use of resource references will require `PULUMI_EXPERIMENTAL_RESOURCE_REFERENCES=1` to be set until the feature has been enabled by default.
2020-12-02 08:39:21 -08:00
Joe Duffy 01d0d64e84
Correctly rename stack files during a rename (#5812)
* Correctly rename stack files during a rename

This fixes pulumi/pulumi#4463, by renaming a stack's configuration
file based on its stack-part, and ignoring the owner-part. Our
workspace system doesn't recognize configuration files with fully
qualified names. That, by the way, causes problems if we have
multiple stacks in different organizations that share a stack-part.

The fix here is simple: propagate the new StackReference from the
Rename operation and rely on the backend's normalization to a
simple name, and then use that the same way we are using a
StackReference to determine the path for the origin stack.

An alternative fix is to recognize fully qualified config files,
however, there's a fair bit of cleanup we will be doing as part of
https://github.com/pulumi/pulumi/issues/2522 and
https://github.com/pulumi/pulumi/issues/4605, so figured it is best
to make this work the way the system expects first, and revisit it
as part of those overall workstreams. I also suspect we may want to
consider changing the default behavior here as part of
https://github.com/pulumi/pulumi/issues/5731.

Tests TBD; need some advice on how best to test this since it
only happens with our HTTP state backend -- all integration tests
appear to use the local filestate backend at the moment.

* Add a changelog entry for bug fix

* Add some stack rename tests

* Fix a typo

* Address CR feedback

* Make some logic clearer

Use "parsedName" instead of "qn", add a comment explaining why
we're doing this, and also explicitly ignore the error rather
than implicitly doing so with _.
2020-12-01 16:55:48 -08:00
Levi Blackstone 679d40950f
Enable resource reference feature by default (#5848)
Unless the PULUMI_DISABLE_RESOURCE_REFERENCES flag
is explicitly set to a truthy value, the resource reference feature is now
enabled by default.
2020-12-01 16:58:49 -07:00
Paul Stack eee053cb4c
Ensure EncryptionKey is regenerated when changing secrets provider (#5842)
Fixes: #5835

when rotating a key in the Azure KeyVault secrets provider, we had
the following error:

```
error: secrets (code=InvalidArgument): keyvault.BaseClient#Decrypt: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadParameter" Message="The parameter is incorrect.\r\n"
```

This was because we were not regenerating the EncrytpionKey when
we were changing the secrets provider. Therefore, we now ensure
that this key is regenerated and we can successfully change the secrets provider

```
▶ pulumi stack init dev --secrets-provider="azurekeyvault://stack72kv10.vault.azure.net/keys/pulumi-secret"
Created stack 'dev'

▶ pulumi config set MyDBRootPassword Password1234! --secret

▶ pulumi config --show-secrets
KEY               VALUE
MyDBRootPassword  Password1234!

▶ pulumi stack change-secrets-provider "azurekeyvault://stack72kv20.vault.azure.net/keys/pulumi-secret"

▶ pulumi config --show-secrets
KEY               VALUE
MyDBRootPassword  Password1234!
```
2020-12-01 15:26:23 +00:00
Nathan Winder 0bdf73341b
Enable creation of TStack using IServiceProvider (#5723)
* Enable creation of TStack using IServiceProvider to enable dependency injection.

* fixed line endings

* update change log

* Added PR link to change log

* fixed change log

* Added integration test

* Review adjustments

Co-authored-by: Mikhail Shilkov <github@mikhail.io>
2020-11-30 16:43:18 +01:00
Komal 48f43906f4
[sdk/python] - Support enums (#5615)
Co-authored-by: Pat Gavlin <pat@pulumi.com>
2020-11-24 19:15:11 -06:00
Luke Hoban 4ecd8f9f56
Add PULUMI_BACKEND_URL env var (#5789)
The PULUMI_BACKEND_URL env var allows specifying the backend to use instead of deferring to the project or the ~/.pulumi/credentials.json file to decide on the "current" backend.  This allows for using Pulumi without a dependence on this piece of global filesystem state, so that each `pulumi` invocation can control the exact backend it want's to operate on, without having to do stateful `pulumi login`/`pulumi logout` operations.

This is especially useful for automation scenarios like Automation API generally (and effectively solves https://github.com/pulumi/pulumi/issues/5591), or https://github.com/pulumi/pulumi-kubernetes-operator/issues/83 specifically.

This also makes things like efe7a599e6/dist/actions/entrypoint.sh (L10) less necessary, and possible to accomplish for any containerized `pulumi` execution without the need for this logic to be embedded in bash scripts wrapping the CLI.
2020-11-22 15:27:59 -08:00
Justin Van Patten 4c88e215ce
Respect PULUMI_PYTHON_CMD in scripts (#5782)
If `PULUMI_PYTHON_CMD` is set, use it instead of running `python` directly.
2020-11-18 19:08:41 -08:00
stack72 8ade2f8319 Prepare for v2.14.0 release 2020-11-18 16:56:26 +00:00
Paul Stack 41a881a374
Small UX change to the output of policy violations (#5773)
Fixes: #5626

It used to be:

```
Policy Violations:
    [advisory]  aws v0.1.20200912  allowed-image-owner (demo-aws-ts-webserver-server-0: aws:ec2/instance:Instance)
    Check machine image is from an approved publisher.
    Publisher [137112412989] is not one of [self,099720109477].

```

Notice that it was name: type

We would rather this was type: name

```
Policy Violations:
    [advisory]  aws v0.1.20200912  allowed-image-owner (aws:ec2/instance:Instance: demo-aws-ts-webserver-server-0)
    Check machine image is from an approved publisher.
    Publisher [137112412989] is not one of [self,099720109477].

```
2020-11-17 21:14:28 +00:00
Tomas Jansson 89daaa2ff1
Output key and correct stack on keynotfound (#5740)
* Output key and correct stack on keynotfound

Co-authored-by: Mikhail Shilkov <github@mikhail.io>
2020-11-17 19:58:56 +01:00
Justin Van Patten bfe4969f35
.NET: Report plugin install errors during pulumi new (#5760)
The way `pulumi new` installs dependencies for .NET projects is slightly different from other languages. For Node.js, Python, and Go, `pulumi new` runs the appropriate command to install project dependencies (e.g. `npm install`, `pip install`, or `go mod download`). For .NET, it calls the same routine used during `preview|up` to ensure required plugins are installed. For .NET, this ends up running `dotnet build` which implicitly installs Nuget packages, builds the project, and also attempts to determine and install the needed Pulumi plugins. When this operation runs during `preview|up`, and there are failures installing a plugin, the error is logged, but deliberately not returned, because an error will be shown for missing plugins later on during the `preview|up` operation. However, during `pulumi new`, we should show any plugin install errors.
2020-11-16 21:56:13 -08:00
Justin Van Patten 594da1e95c
Fix plugin install failures on Windows (#5759)
When installing a plugin, previous versions of Pulumi extracted the
plugin tarball to a temp directory and then renamed the temp directory
to the final plugin directory. This was done to prevent concurrent
installs: if a process fails to rename the temp dir because the final
dir already exists, it means another process already installed the
plugin. Unfortunately, on Windows the rename operation often fails due
to aggressive virus scanners opening files in the temp dir.

In order to provide reliable plugin installs on Windows, we now extract
the tarball directly into the final directory, and use file locks to
prevent concurrent installs from toppling over one another.

During install, a lock file is created in the plugin cache directory
with the same name as the plugin's final directory but suffixed with
`.lock`. The process that obtains the lock is responsible for extracting
the tarball. Before it does that, it cleans up any previous temp
directories of failed installs of previous versions of Pulumi. Then it
creates an empty `.partial` file next to the `.lock` file. The
`.partial` file indicates an installation is in-progress. The `.partial`
file is deleted when installation is complete, indicating the plugin was
successfully installed. If a failure occurs during installation, the
`.partial` file will remain indicating the plugin wasn't fully
installed. The next time the plugin is installed, the old installation
directory will be removed and replaced with a fresh install.

This is the same approach Go uses for installing modules in its
module cache.
2020-11-16 09:44:29 -08:00
Mikhail Shilkov b200e171a6
Update .NET Grpc to the latest and Protobuf to Pulumi fork (#5757) 2020-11-14 14:25:38 +01:00
Vivek Lakshmanan 9d6e380680
Merge pull request #5741 from pulumi/vl/GoVersion
Pulumi-language-go and pulumi new now checks go version is at least 1.14.0
2020-11-12 15:40:57 -08:00
Pat Gavlin 1e0c9efdd7
Respect provider config secretness. (#5742)
Just what it says on the tin. This is implemented by changing the
`GetPackageConfig` method of `ConfigSource` to return a `PropertyMap`
and ensuring that any secret config is represented by a `Secret`.
2020-11-12 12:18:12 -08:00
Vivek Lakshmanan bcb9d0f4c8 Refactor to add version check to pulumi new as well 2020-11-12 09:20:28 -08:00
Komal e3725a6e40
Support python 3.9 on windows (#5739) 2020-11-11 14:07:59 -08:00
Pat Gavlin 0ec12d01f9
Create a builtin provider during import. (#5730)
`pulumi import` may otherwise fail if there are providers in the
statefile.
2020-11-10 21:11:30 -08:00
Levi Blackstone 64e5de1edc
[codegen/go] Add support for ResourceType and isComponent (#5497) 2020-11-09 11:55:53 -07:00
Paul Stack 3d8068e355
adding the import documentation where specified (#5667) 2020-11-09 14:12:58 +00:00
stack72 8b8b538d08 Prepare for v2.13.2 release 2020-11-07 10:14:03 +00:00
Justin Van Patten 88f6b4c560
Report feature "resourceReferences" is not supported (#5709)
This feature isn't fully supported yet, so stop reporting it is.
2020-11-06 18:56:23 -08:00
stack72 ff22649925 Prepare for v2.13.1 release 2020-11-06 20:49:20 +00:00
Paul Stack 8685f96ce6
Ensure pulumi history marks secrets that can't be un-encrypted as such (#5701) 2020-11-06 19:54:33 +00:00
Pat Gavlin f6b687ea03
Fix feature support checks in the Python SDK. (#5702) 2020-11-06 19:53:24 +00:00