Commit Graph

60 Commits

Author SHA1 Message Date
Will Jones eadf1ec185
Support always qualifying stack names () ()
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->

This commit adds the `--fully-qualify-stack-names` (or `-Q` for short)
global command-line argument, which when supplied will always print
stack names in the fully-qualified form of `organization/project/stack`.
Fixes .

## Checklist

- [X] I have run `make tidy` to update any new dependencies
- [X] I have run `make lint` to verify my code passes the lint check
  - [X] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [X] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2024-04-04 10:11:46 +00:00
Fraser Waters f36ce248b2
Add --import-file to pulumi preview ()
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->

Fixes https://github.com/pulumi/pulumi/issues/12768.

This will generate an import file for every resource the preview wants
to Create.

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-12-05 08:32:40 +00:00
Fraser Waters d771acf707
Add tokens.StackName ()
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->

This adds a new type `tokens.StackName` which is a relatively strongly
typed container for a stack name. The only weakly typed aspect of it is
Go will always allow the "zero" value to be created for a struct, which
for a stack name is the empty string which is invalid. To prevent
introducing unexpected empty strings when working with stack names the
`String()` method will panic for zero initialized stack names.
 
Apart from the zero value, all other instances of `StackName` are via
`ParseStackName` which returns a descriptive error if the string is not
valid.

This PR only updates "pkg/" to use this type. There are a number of
places in "sdk/" which could do with this type as well, but there's no
harm in doing a staggered roll out, and some parts of "sdk/" are user
facing and will probably have to stay on the current `tokens.Name` and
`tokens.QName` types.

There are two places in the system where we panic on invalid stack
names, both in the http backend. This _should_ be fine as we've had long
standing validation that stacks created in the service are valid stack
names.

Just in case people have managed to introduce invalid stack names, there
is the `PULUMI_DISABLE_VALIDATION` environment variable which will turn
off the validation _and_ panicing for stack names. Users can use that to
temporarily disable the validation and continue working, but it should
only be seen as a temporary measure. If they have invalid names they
should rename them, or if they think they should be valid raise an issue
with us to change the validation code.

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-11-15 07:44:54 +00:00
Fraser Waters 61dcd6f6ca
Add token info to whoami ()
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->

Fixes https://github.com/pulumi/pulumi-cloud-requests/issues/236

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [x] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [x] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @Pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->
2023-09-23 12:46:11 +00:00
Fraser Waters 4ebf61f896
Move sdk/go/common/display to /pkg/display ()
Similar to how https://github.com/pulumi/pulumi/pull/13953 moves some
code from sdk/go/common to /pkg. This display code is only used in /pkg,
another simple reduction of what's in sdk/go/common.
2023-09-18 11:01:28 +00:00
Fraser Waters 11cd6965d2 Make filestate.Snapshot lazy like httpstate 2023-05-24 08:24:04 +01:00
Fraser Waters 1376a13d13 Fix destroy without project file
Fixes https://github.com/pulumi/pulumi/issues/12714.

The empty project created for destroy operations when no Pulumi.yaml is
found still needs to have it's name filled in so that project name
consistency checks work.

Our tests didn't pick this up because for filestate we were still
searching from the working directory for consistency checks rather than
checking the backends current project. I have _not_ changed that in this
changeset as previosly that triggered total breakage of the filestate
backend when not in project mode (see
https://github.com/pulumi/pulumi/issues/12760).
2023-05-02 10:36:16 +01:00
Justin Van Patten 6219b6d833 Revert "Fix destroy without project file"
This reverts commit 5eb04f18ad.
2023-04-26 18:17:08 -07:00
Fraser Waters 5eb04f18ad Fix destroy without project file
Fixes https://github.com/pulumi/pulumi/issues/12714

The empty project created for destroy operations when no Pulumi.yaml is
found still needs to have it's name filled in so that project name
consistency checks work.

Our tests didn't pick this up because for filestate we were still
searching from the working directory for consistency checks rather than
checking the backends current project. I've also fixed that up as part
of this change.
2023-04-24 16:14:56 +01:00
Fraser Waters 4dcdf7511a Pass *workspace.Project to GetBackendConfigDefaultOrg 2023-03-07 09:17:52 +00:00
Abhinav Gupta 7aa5b77a0c
all: Reformat with gofumpt
Per team discussion, switching to gofumpt.

[gofumpt][1] is an alternative, stricter alternative to gofmt.
It addresses other stylistic concerns that gofmt doesn't yet cover.

  [1]: https://github.com/mvdan/gofumpt

See the full list of [Added rules][2], but it includes:

- Dropping empty lines around function bodies
- Dropping unnecessary variable grouping when there's only one variable
- Ensuring an empty line between multi-line functions
- simplification (`-s` in gofmt) is always enabled
- Ensuring multi-line function signatures end with
  `) {` on a separate line.

  [2]: https://github.com/mvdan/gofumpt#Added-rules

gofumpt is stricter, but there's no lock-in.
All gofumpt output is valid gofmt output,
so if we decide we don't like it, it's easy to switch back
without any code changes.

gofumpt support is built into the tooling we use for development
so this won't change development workflows.

- golangci-lint includes a gofumpt check (enabled in this PR)
- gopls, the LSP for Go, includes a gofumpt option
  (see [installation instrutions][3])

  [3]: https://github.com/mvdan/gofumpt#installation

This change was generated by running:

```bash
gofumpt -w $(rg --files -g '*.go' | rg -v testdata | rg -v compilation_error)
```

The following files were manually tweaked afterwards:

- pkg/cmd/pulumi/stack_change_secrets_provider.go:
  one of the lines overflowed and had comments in an inconvenient place
- pkg/cmd/pulumi/destroy.go:
  `var x T = y` where `T` wasn't necessary
- pkg/cmd/pulumi/policy_new.go:
  long line because of error message
- pkg/backend/snapshot_test.go:
  long line trying to assign three variables in the same assignment

I have included mention of gofumpt in the CONTRIBUTING.md.
2023-03-03 09:00:24 -08:00
Abhinav Gupta fff7e0bc4b
pkg/backend: Prefer contract.Assertf over Assert
Incremental step towards 

Migrates uses of contract.{Assert, AssertNoError, Require} in pkg/engine
to `*f` variants so that we're required to provide more error context.

Refs 
2023-02-21 15:13:16 -08:00
Fraser Waters c5ea3aa7de Pass *Project to currentBackend 2023-02-17 13:20:38 +00:00
Fraser Waters a3f7a342b2 Move the project file handling for secret config to one place
This means the secret providers just work in terms of
workspace.ProjectStack, mutate as they wish and let the higher level
work out if it should save the file or not. Rather than having each
secret manager maintain "should I save the file" code.
2023-02-01 17:03:38 +00:00
Fraser Waters 874d2b6678 Push DefaultSecretsProvider up to pkg/cmd
All uses of stack.DefaultSecretsProvider are now in pkg/cmd, every other
use has been changed to take a secrets.Provider as a parameter in
someway.

I renamed a load of variables from "stack" to "stackName" as part of
this because it clashed with the "stack" module that
DefaultSecretsProvider is currently defined in, but I think this is
probably a good change anyway given these were `string`s not `Stack`s.
2023-01-27 12:04:52 +00:00
Fraser Waters 54c10ba71d Pull NewServiceSecretsManager out of httpstate
A sister PR to https://github.com/pulumi/pulumi/pull/11767. This pulls
as much of NewServiceSecretsManager out of httpstate and to the
secrets/service module.

What's left in httpstate is the DefaultSecretManager method pulling off
the client and stack identifier to pass to NewServiceSecretsManager.
That couldn't be done in secrets/service because that would cause a
dependency chain loop (secrets/service would depend on the
httpstate.Stack, but that would depend on secrets/service).

Arguably the `client.Client` ought to just be a string URL and the
secret manager should make it's own client (like it does in
NewServiceSecretsManagerFromState). But trying to keep each individual
change here small.
2023-01-04 23:04:30 +00:00
Ian Wahbe 23608c2069 Qualify name 2022-11-29 14:07:20 -08:00
Aaron Friel a8a4f88fd8 cli: Add fully qualified stack reference to pulumi about 2022-11-29 14:07:20 -08:00
Fraser Waters eb02b06537
Move default secret manager to stack ()
Thie removes a type test for stack type.
2022-08-18 15:31:34 +01:00
Kyle Dixler 9028a02726
allow `pulumi destroy -s <stack>` if not in a pulumi project dir ()
* pulumi destroy -s <stack> now works as long as you are not in a pulumi project directory
2022-07-11 08:28:53 -07:00
Richard Shade a5687d16a9
Moving previewDigest to sdk/go/common/display, and exporting it. ()
* Moving previewDigest and exporting it, closes 

* Moving previewDigest and exporting it, closes 

* Updating changelog-pending

* Go Mod Tidy

* replacing to local

* more go.mod changes

* reseting go mod

* full move

* Fixing golint

* No go.mod changes needed
2022-06-27 09:08:06 -05:00
Fraser Waters 06e42a5697
Revert "allow `pulumi destroy -s <stack>` if not in a pulumi project dir ()" ()
* Revert "allow `pulumi destroy -s <stack>` if not in a pulumi project dir ()"

This reverts commit 150aba462e.

Fixes https://github.com/pulumi/pulumi/issues/9815

* Update CHANGELOG

* Update CHANGELOG_PENDING.md

Co-authored-by: Anton Tayanovskyy <anton@pulumi.com>
2022-06-09 14:28:52 -04:00
Kyle Dixler 150aba462e
allow `pulumi destroy -s <stack>` if not in a pulumi project dir ()
* pulumi destroy -s <stack> now works as long as you are not in a pulumi project directory
2022-06-01 14:22:32 -07:00
Fraser Waters f629d53480
Remove type test from `pulumi console` ()
* Remove type test from `pulumi console`

Move ConsoleURL to just httpstate.Backend and don't type test on httpstate.Stack.

* Fix stack command

* Remove unused CloudURL on httpstate.Stack
2022-04-19 10:16:27 +01:00
Fraser Waters 50ade97b09
Return organizations from Backend.CurrentUser ()
* Return organizations from Backend.CurrentUser

Organizations are shown by `pulumi about` and `pulumi whoami --verbose`

e.g.
```
$ pulumi whoami --verbose
User: Frassle
Organizations: Frassle
Backend URL: https://app.pulumi.com/Frassle
```

Like usernames these are cached in the credentials file.

* lint

* Add to CHANGELOG
2022-03-31 09:11:19 +01:00
Fraser Waters 7576c0a04e
Fix cloudBackendReference.String ()
* Fix new line

* Match default owner logic in String and Parse

* Add to CHANGELOG
2022-03-24 14:27:14 +00:00
Fraser Waters 1088743de2
Don't type test for stack tags in pulumi new ()
* Don't type test for stack tags in pulumi new

Move Tags to just be on Stack. Saves a type test in `pulumi new`.

Given Tags doesn't actually do a fetch the only error you can really get
back from it is that the backed doesn't support tags.

* Add SupportsTags

* Remove error result from Tags
2022-03-23 22:05:26 +00:00
Fraser Waters 86f3f712aa
Readd "Make StackReference.Name a tokens.Name ()" ()
* Readd "Make StackReference.Name a tokens.Name ()"

This reverts commit f0aa4df149.

This also removes the AsName asserting casts for stack names. We do want
to add them in at some point to be sure that bad names don't slip in
somehow but they don't need adding with this.

* Update sdk/go/common/util/fsutil/qname.go

Co-authored-by: Ian Wahbe <ian@wahbe.com>

Co-authored-by: Ian Wahbe <ian@wahbe.com>
2022-03-17 21:37:11 +00:00
Ian Wahbe f0aa4df149
Revert "Make StackReference.Name a tokens.Name ()" ()
This reverts commit a72df9aefa.
2022-03-09 13:48:52 -08:00
Fraser Waters a72df9aefa
Make StackReference.Name a tokens.Name ()
* Make StackReference.Name a tokens.Name

* Don't panic in ParseStackReference
2022-03-07 20:59:44 +00:00
Fraser Waters 40eee5868e
Preview of update plans ()
* Implement resource plans in the engine

* Plumb plans through the CLI.

* Update wording

* plan renderer

* constraints

* Renames

* Update message

* fixes for rebase breaks and diffs

* WIP: outputs in plans

* fix diff

* fixup

* Liniting and test fixing

* Test and fix PropertyPath.String()

* Fix colors

* Fix cmdutil.PrintTable to handle non-simple strings

* More tests

* Readd test_plan.go

* lint

* Test expected deletes

* Test expected delete

* Test missing create

* Fix test for missing creates

* rm Paths()

* property set shrink test

* notes

* More tests

* Pop op before constraint check

* Delete plan cmd, rename arguments to preview and up

* Hide behind envvars

* typo

* Better constraint diffs

* Adds/Deletes/Updates

* Fix aliased

* Check more constraints

* fix test

* revert stack changes

* Resource sames test

* Fix same resource test

* Fix more tests

* linting

* Update pkg/cmd/pulumi/up.go

Co-authored-by: Alex Mullans <a.mullans@pulumi.com>

* Update pkg/cmd/pulumi/preview.go

Co-authored-by: Alex Mullans <a.mullans@pulumi.com>

* Auto refresh if using plans

* Fix TestGetRefreshOption

* Fix TestExplicitDeleteBeforeReplace

* lint

* More copying in tests because I do not trust myself to get mutation correct

* Small preview plan test

* Add TestPlannedUpdateChangedStack

* Revert auto-refresh changes

* Validate outputs don't change

* omitempty

* Add manifest to plan

* Add proper Plan type

* wip config work

* Config and manifest serder

* linting

* Asset NoError

* Actually check error

* Fix clone

* Test diag message

* Start on more tests

* Add String and GoString to Result

I got fed up assert errors in tests that looked like:
```
Expected nil, but got: &result.simpleResult{err:(*errors.fundamental)(0xc0002fa5d0)}
```

It was very hard to work out at a glance what had gone wrong and I kept
having to hook a debugger just to look at what the error was.

With GoString these now print something like:
```
Expected nil, but got: &simpleResult{err: Unexpected diag message: <{%reset%}>resource violates plan: properties changed: -zed, -baz, -foo<{%reset%}>
}
```

Which is much more ussful.

* Add test error text

* Fix reporting of unseen op errors

* Fix unneeded deletes

* Fix unexpected deletes

* Fix up tests

* Fix merge conflict

* lint

* Fix nil map error

* Fix serialisation typo

* Diff against old inputs

* Diff against checked goal

* Diff against empty for creates

* Fix test

* inputs not outputs

* Seperate PlanDiff type

* Add properties

* Fix input diffs

* Handle creates

* lint

* Add plan message

* Clone plan for update preview

* Save and serialise env vars in plans

* lint

* pretty print json

* input output difference test

* test alias

* fix typo in for loop

* Handle resource plans with nil goal

* go mod tidy

* typo

* Auto use plans from up previews in experimental mode

* Don't preview if we have plan

* Don't run previews with plans now

* fixing tests

* Handle diffs and goals

* Update copystructure

* tests/go.sum

* Revert mod changes

* Add copystructure to tests/go.sum

* includeUnknowns

* go mod tidy

* Make plans for imports

* Remove unused function

* Move code more locally

* Handle nil in serialize

* Handle empty output diffs

* Add test for dropping computed values

* Allow computed properties to become deletes

* if out the generation of plans unless experimental mode is opt'd into

* lint

* typo

* Revert back to plans not skipping previews, this is orthognal to --skip-preview

* Trying to work out non-determinism

* Remove notes.txt

* Hacking with check idea

* Pass checked inputs back to Check from plan file

* Include resource urn in constraint error

* Give much more informative errors when plans fail

* lint

* Update expected diag strings in tests

* Remove unused code

* Duplicate Diff and DeepEquals methods for plans

* Add comment about check ops with failures

* Fix CheckedInputs comment

* OutputDiff doesn't need to be a pointer

* Fix checks against computed

* diffStringSets

* lint

* lint pkg

* Use 4 space indent

* Don't wrap Buffer in Writer

* Mark flags hidden rather than disabled

* Remove envvars from plans

* Assert MarkHidden error

* Add to changelog

* Note plan/save-plan is experimental

Co-authored-by: Pat Gavlin <pat@pulumi.com>
Co-authored-by: Alex Mullans <a.mullans@pulumi.com>
2022-01-31 10:31:51 +00:00
Adrian Smijulj 98211718ad
Watch Command - Added `--path` Argument () 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
Joe Duffy 01d0d64e84
Correctly rename stack files during a rename ()
* Correctly rename stack files during a rename

This fixes , 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. ()
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 ()

* Switch away from native grpc impl. ()

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

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

* Handle all errors for now. ()


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

* Upgrade all paths for sdk and pkg to v2

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

Adjust C# generation

* Replace IDeployment with a sealed class ()

Replace IDeployment with a sealed class

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

* 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 ()
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 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 fccf301d14 move pkg/util/contract -> sdk/go/common/util/contract 2020-03-18 14:40:07 -07:00
Jamie Kinkead 56a3cc7e8f Adjust commenting. 2020-01-17 12:57:08 -08:00
Jamie Kinkead 5a02a61765 Add Current Operation info. 2020-01-17 07:44:23 -08:00
Luke Hoban 25206c5ea8 Add an experimental `pulumi watch` command ()
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
Mikhail Shilkov bf96123d14 Stop ignoring HTTP errors at token validation () 2019-09-10 13:24:30 -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 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 d076bad1a5 Remove `Config()` from `backend.Stack`
For cloud backed stacks, this was already returning nil and due to the
fact that we no longer include config in the checkpoint for local
stacks, it was nil there as well.

Removing this helps clean stuff up and is should make some future
refactorings around custom secret managers easier to land.

We can always add it back later if we miss it (and make it actually do
the right thing!)
2019-05-10 17:07:52 -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