Commit graph

88 commits

Author SHA1 Message Date
Ian Wahbe 272c4643b2
Update error handling (#8406)
This is the result of a change applied via `go-rewrap-errors`.
2021-11-12 18:37:17 -08: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
Adrian Smijulj 98211718ad
Watch Command - Added --path Argument (#7247) 2021-06-21 17:34:21 +10: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
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
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
Paul Stack 61ae57da0c
Add support for pulumi logout --all (#6101) 2021-01-15 13:38:58 +00:00
Levi Blackstone 709fcbad51
Document Go packages (#6009)
Co-authored-by: Pat Gavlin <pat@pulumi.com>
2021-01-11 11:07:59 -07: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
Pat Gavlin 89c71bb49e
[cli] Add an import command. (#4765)
Co-authored-by: stack72 <public@paulstack.co.uk>
2020-10-14 12:51:53 +01:00
CyrusNajmabadi 66bd3f4aa8
Breaking changes due to Feature 2.0 work
* Make `async:true` the default for `invoke` calls (#3750)

* Switch away from native grpc impl. (#3728)

* Remove usage of the 'deasync' library from @pulumi/pulumi. (#3752)

* Only retry as long as we get unavailable back.  Anything else continues. (#3769)

* Handle all errors for now. (#3781)


* Do not assume --yes was present when using pulumi in non-interactive mode (#3793)

* Upgrade all paths for sdk and pkg to v2

* Backport C# invoke classes and other recent gen changes (#4288)

Adjust C# generation

* Replace IDeployment with a sealed class (#4318)

Replace IDeployment with a sealed class

* .NET: default to args subtype rather than Args.Empty (#4320)

* Adding system namespace for Dotnet code gen

This is required for using Obsolute attributes for deprecations

```
Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'ObsoleteAttribute' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj]
Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'Obsolete' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj]
```

* Fix the nullability of config type properties in C# codegen (#4379)
2020-04-14 09:30:25 +01:00
evanboyle d3f5bbce48 go fmt 2020-03-18 17:27:02 -07:00
evanboyle c1440e48d4 move pkg/util/result -> sdk/go/common/util 2020-03-18 15:45:42 -07:00
evanboyle 8df534a71e move pkg/diag -> sdk/go/common/diag 2020-03-18 15:09:29 -07:00
evanboyle f754b486b8 move pkg/resource/config -> sdk/go/common/resource/config 2020-03-18 15:03:37 -07:00
evanboyle 67cb405c93 move pkg/apitype -> sdk/common/apitype 2020-03-18 15:00:30 -07:00
evanboyle 70f386a967 move pkg/tokens -> sdk/go/common/tokens 2020-03-18 14:49:56 -07:00
evanboyle 8fb3f428b0 move pkg/workspace -> sdk/go/common/workspace 2020-03-18 14:35:53 -07:00
evanboyle fba783caf9 move pkg/resource -> sdk/go/common/resource, but leave nested resource packages 2020-03-18 13:36:19 -07:00
Chris Smith ba046b063b
Add --version flag to 'pulumi stack export' (#3906)
* Add --version flag to 'pulumi stack export'

* Update CHANGELOG

* Update/rebase with latest

* Fix lint warning
2020-02-13 12:25:57 -08:00
Erin Krengel 223e0c5e83
Add policy ls (#3753) 2020-01-16 12:04:51 -08:00
Chris Smith 738005dd83
Move stack name validation to the Backend interface (#3679)
* Replace workspace.ValidateStackName with backend

* Add filestate.ValidateStackName

* Add httpstate.ValidateStackName

* Fix lint issues

* Update test
2019-12-30 10:24:48 -08:00
Chris Smith 7fd76b6372
Wire through OverStackLimitError (#3465) 2019-11-07 08:22:59 -08:00
Luke Hoban 25206c5ea8 Add an experimental pulumi watch command (#3391)
Adds a new experimental `pulumi watch` CLI command which can be used for inner loop development on a Pulumi stack.  This command is only available currently via `PULUMI_EXPERIMENTAL=true` while in active development.

The `watch` command does the following:
1. Watches the workspace (the tree rooted at the `Pulumi.yaml` file) for changes
2. Triggers an `update` to the stack whenever there is a change
3. Streams output containing summaries of key update events as well as logs from any resources under management into a combined CLI output

Part of https://github.com/pulumi/pulumi/issues/3448.

The PULUMI_EXPERIMENTAL flag also makes`query` and `policy` available.
2019-11-06 12:56:29 -08:00
Alex Clemmer 9c16485152 Don't require a stack to run pulumi query 2019-10-23 15:14:56 -07:00
Pat Gavlin 14da941b0c
Standardize on Stack for backend methods. (#3336)
The current pattern of using backend.Stack values in the CLI but
accepting backend.StackReference values in backend methods leads to
frequent transitions between these types. In the case of the HTTP
backend, the transition from a StackReference to a Stack requires an API
call. These changes refactor the backend.Backend API such that most of
its methods accept backend.Stack values in place of
backend.StackReference values, which avoids these transitions.

This removes two calls to the getStack API on the startup path of a
`pulumi preview`.
2019-10-14 14:30:42 -07:00
Chris Smith fbb28eacc9
Fix problem with divergent project names (#3269)
* Prevent stack/workspace project name mismatch

* Account for Pulumi.yaml missing entirely
2019-09-26 12:27:37 -07:00
Mikhail Shilkov c270204387 Check project existence during pulumi new 2019-08-23 09:09:54 +02:00
Chris Smith eb0934970c
Add support for filtering stacks by organization, tag (#3108)
* Add support for filtering stacks by organization, tag

* Update CHANGELOG.md

* Address PR feedback

* Address even more PR feedback

* Support empty-string filters
2019-08-22 13:56:43 -07:00
Mikhail Shilkov 04b169a64b Add a hint about the org name in stack in pulumi new 2019-08-19 09:21:02 +02:00
Alex Clemmer 0850c88a97 Address comments 2019-07-16 00:58:33 -07:00
Alex Clemmer c93a860574 Add PolicyPack abstraction with Publish verb
This commit will implement the core business logic of `pulumi policy
publish` -- code to boot an analyzer, ask it for metadata about the
policies it contains, pack the code, and transmit all of this to the
Pulumi service.
2019-07-16 00:58:33 -07:00
Matt Ellis 917f3738c5 Add --server to pulumi plugin install
Previously, when the CLI wanted to install a plugin, it used a special
method, `DownloadPlugin` on the `httpstate` backend to actually fetch
the tarball that had the plugin. The reason for this is largely tied
to history, at one point during a closed beta, we required presenting
an API key to download plugins (as a way to enforce folks outside the
beta could not download them) and because of that it was natural to
bake that functionality into the part of the code that interfaced with
the rest of the API from the Pulumi Service.

The downside here is that it means we need to host all the plugins on
`api.pulumi.com` which prevents community folks from being able to
easily write resource providers, since they have to manually manage
the process of downloading a provider to a machine and getting it on
the `$PATH` or putting it in the plugin cache.

To make this easier, we add a `--server` argument you can pass to
`pulumi plugin install` to control the URL that it attempts to fetch
the tarball from. We still have perscriptive guidence on how the
tarball must be
named (`pulumi-[<type>]-[<provider-name>]-vX.Y.Z.tar.gz`) but the base
URL can now be configured.

Folks publishing packages can use install scripts to run `pulumi
plugin install` passing a custom `--server` argument, if needed.

There are two improvements we can make to provide a nicer end to end
story here:

- We can augment the GetRequiredPlugins method on the language
  provider to also return information about an optional server to use
  when downloading the provider.

- We can pass information about a server to download plugins from as
  part of a resource registration or creation of a first class
  provider.

These help out in cases where for one reason or another where `pulumi
plugin install` doesn't get run before an update takes place and would
allow us to either do the right thing ahead of time or provide better
error messages with the correct `--server` argument. But, for now,
this unblocks a majority of the cases we care about and provides a
path forward for folks that want to develop and host their own
resource providers.
2019-06-03 09:31:18 -07:00
Matt Ellis 6278c1c8d9 Do not depend on backend package from client package
The next change is going to do some code motion that would create some
circular imports if we did not do this. There was nothing that
required the members we were moving be in the backend package, so it
was easy enough to pull them out.
2019-05-10 17:07:52 -07:00
Matt Ellis e7e934a59a Push initialization of SecretsManager out of the backend
When preforming an update, require that a secrets manager is passed in
as part of the `backend.UpdateOperation` bag and use it.  The CLI now
passes this in (it still uses the default base64 secrets manager, so
this is just code motion into a high layer, since the CLI will be the
one to choose what secrets manager to use based on project settings).
2019-05-10 17:07:52 -07:00
Matt Ellis 67bb134c28 Don't return serialized outputs from stack.GetRooStacktResource
Half of the call sites didn't care about these values and with the
secrets work the ergonmics of calling this method when it has to
return serialized ouputs isn't great. Move the serialization for this
into the CLI itself, as it was the only place that cared to do
this (so it could display things to end users).
2019-05-10 17:07:52 -07:00
Matt Ellis 10792c417f Remove backend.GetStackCrypter
As part of the pluggable secrets work, the crypter's used for secrets
are no longer tied to a backend. To enforce this, we remove the
`backend.GetStackCrypter` function and then have the relevent logic to
construct one live inside the CLI itself.

Right now the CLI still uses the backend type to decide what Crypter
to build, but we'll change that shortly.
2019-05-10 17:07:52 -07:00
Matt Ellis 5cde8e416a Rename base64sm to b64 2019-05-10 17:07:52 -07:00
Matt Ellis 97902ee50b Refactor config loading out of the backend
We require configuration to preform updates (as well as previews,
destroys and refreshes). Because of how everything evolved, loading
this configuration (and finding the coresponding decrypter) was
implemented in both the file and http backends, which wasn't great.

Refactor things such that the CLI itself builds out this information
and passes it along to the backend to preform operations. This means
less code duplicated between backends and less places the backend
assume things about the existence of `Pulumi.yaml` files and in
general makes the interface more plesent to use for others uses.
2019-05-10 17:07:52 -07:00
Matt Ellis cc74ef8471 Encrypt secret values in deployments
When constructing a Deployment (which is a plaintext representation of
a Snapshot), ensure that we encrypt secret values. To do so, we
introduce a new type `secrets.Manager` which is able to encrypt and
decrypt values. In addition, it is able to reflect information about
itself that can be stored in the deployment such that we can
deserialize the deployment into a snapshot (decrypting the values in
the process) without external knowledge about how it was encrypted.

The ability to do this is import for allowing stack references to
work, since two stacks may not use the same manager (or they will use
the same type of manager, but have different state).

The state value is stored in plaintext in the deployment, so it **must
not** contain sensitive data.

A sample manager, which just base64 encodes and decodes strings is
provided, as it useful for testing. We will allow it to be varried
soon.
2019-05-10 17:07:52 -07:00
Alex Clemmer 2c7af058de Expose resource outputs through invoke
This command exposes a new resource `Invoke` operation,
`pulumi:pulumi:readStackResourceOutputs` which retrieves all resource
outputs for some user-specified stack, not including those deleted.

Fixes #2600.
2019-05-02 18:08:08 -07:00
Alex Clemmer da82638edd Add query primitives to state backend
Because `pulumi query` is not implemented with the update
infrastructure, it is important that we *not* do things like open an
update when the query program runs.

This commit will thus implement the "query" path in the state backend in
a completely parallel universe. Conceptually, this is much like the
update path, but with a conspicuous lack of any connection to the
backend service.
2019-05-02 18:08:08 -07:00
CyrusNajmabadi c6d87157d9
Use result.Result in more places. (#2568) 2019-03-19 16:21:50 -07:00
Matt Ellis a1bb16407d Add pulumi stack rename
`pulumi stack rename` allows you to change the name of an existing
stack. This operation is non-distructive, however it is possible that
the next update will show additional changes to resources, if the
pulumi program uses the value of `getStack()` as part of a resource
name.
2019-03-19 11:04:33 -07:00
Sean Gillespie 26cc1085b1
Install missing plugins on startup (#2560)
* Install missing plugins on startup

This commit addresses the problem of missing plugins by scanning the
snapshot and language host on startup for the list of required plugins
and, if there are any plugins that are required but not installed,
installs them. The mechanism by which plugins are installed is exactly
the same as 'pulumi plugin install'.

The installation of missing plugins is best-effort and, if it fails,
will not fail the update.

This commit addresses pulumi/pulumi-azure#200, where users using Pulumi
in CI often found themselves missing plugins.

* Add CHANGELOG

* Skip downloading plugins if no client provided

* Reduce excessive test output

* Update Gopkg.lock

* Update pkg/engine/destroy.go

Co-Authored-By: swgillespie <sean@pulumi.com>

* CR: make pluginSet a newtype

* CR: Assign loop induction var to local var
2019-03-15 15:01:37 -07:00
Justin Van Patten 5d3d8c01dd
Add commands for managing stack tags (#2333)
Adds `pulumi stack tag` commands for managing stack tags.
2019-01-04 13:23:47 -08:00
Pat Gavlin bc08574136
Add an API for importing stack outputs (#2180)
These changes add a new resource to the Pulumi SDK,
`pulumi.StackReference`, that represents a reference to another stack.
This resource has an output property, `outputs`, that contains the
complete set of outputs for the referenced stack. The Pulumi account
performing the deployment that creates a `StackReference`  must have
access to the referenced stack or the call will fail.

This resource is implemented by a builtin provider managed by the engine.
This provider will be used for any custom resources and invokes inside
the `pulumi:pulumi` module. Currently this provider supports only the
`pulumi:pulumi:StackReference` resource.

Fixes #109.
2018-11-14 13:33:35 -08:00
Joe Duffy 423c995dfd
Default an update's message to the Git commit title (#2009)
There is a seldom-used capability in our CLI, the ability to pass
-m to specify an update message, which we will then show prominently.

At the same time, we already scrape some interesting information from
the Git repo from which an update is performed, like the SHA hash,
committer, and author information. We explicitly didn't want to scrape
the entire message just in case someone put sensitive info inside of it.

It seems safe -- indeed, appealing -- to use just the title portion
as the default update message when no other has been provided (the
majority case). We'll work on displaying it in a better way, but this
strengthens our GitOps/CI/CD story.

Fixes pulumi/pulumi#2008.
2018-10-02 10:49:41 -07:00
Chris Smith 792c316e5e
Change backend.ListStacks to return a new StackSummary interface (#1931)
* Have backend.ListStacks return a new StackSummary interface

* Update filestake backend to use new type

* Update httpstate backend to use new type

* Update commands to use new type

* lint

* Address PR feedback

* Lint
2018-09-13 20:54:42 -07:00
joeduffy 95e917441a Implement preview-then-update for local stacks
This change implements the same preview behavior we have for
cloud stacks, in pkg/backend/httpbe, for local stacks, in
pkg/backend/filebe. This mostly required just refactoring bits
and pieces so that we can share more of the code, although it
does still entail quite a bit of redundancy. In particular, the
apply functions for both backends are now so close to being
unified, but still require enough custom logic that it warrants
keeping them separate (for now...)
2018-09-05 07:33:18 -07:00