pulumi/pkg/backend
Justin Van Patten 2dd13292a3
Consolidate some new and up functionality (#1884)
Previously `new` was operating under the assumption that it was always
going to be creating a new project/stack, and would always prompt for
these values. However, we want to be able to use `new` to pull down the
source for an existing stack. This change adds a `--stack` flag to `new`
that can be used to specify an existing stack. If the specified stack
already exists, we won't prompt for the project name/description, and
instead just use the existing stack's values. If `--stack` is specified,
but doesn't already exist, it will just use that as the stack name
(instead of prompting) when creating the stack. `new` also now handles
configuration like `up <url>`: if the stack is a preconfigured empty
stack (i.e. it was created/configured in the Pulumi Console via Pulumi
Button or New Project), we will use the existing stack's config without
prompting. Otherwise we will prompt for config, and just like `up
<url>`, we'll use the existing stack's config values as defaults when
prompting, or if the stack didn't exist, use the defaults from the
template.

Previously `up <url>`'s handling of the project name/description wasn't
correct: it would always automatically use the values from the template
without prompting. Now, just like `new`:

 - When updating an existing stack, it will not prompt, and just use the
   existing stack's values.

 - When creating a new stack, it will prompt for the project
   name/description, using the defaults from the template.

This PR consolidates some of the `new`/`up` implementation so it shares
code for this functionality. There's definitely opportunities for a lot
more code reuse, but that cleanup can happen down the line if/when we
have the cycles.
2018-09-06 12:45:56 -07:00
..
display Fix a few lint warnings 2018-09-05 08:25:23 -07:00
filestate Fix integration tests 2018-09-05 11:39:58 -07:00
httpstate Consolidate some new and up functionality (#1884) 2018-09-06 12:45:56 -07:00
state Add license headers 2018-05-22 15:02:47 -07:00
apply.go Don't close eventChannel when panicking (#1891) 2018-09-05 17:50:48 -07:00
backend.go Implement preview-then-update for local stacks 2018-09-05 07:33:18 -07:00
snapshot.go Fix some potential bugs in the refresher. (#1845) 2018-08-29 21:00:05 -07:00
snapshot_test.go Elide unnecessary checkpoint writes. (#1798) 2018-08-20 14:14:50 -07:00
stack.go Implement preview-then-update for local stacks 2018-09-05 07:33:18 -07:00
updates.go Clarify refresh text 2018-08-29 17:09:14 -07:00