Previously we used the word "Environment" as the term for a deployment target, but since then we've started to use the term Stack. Adopt this across the CLI. From a user's point of view, there are a few changes: 1. The `env` verb has been renamed to `stack` 2. The `-e` and `--env` options to commands which operate on an environment now take `-s` or `--stack` instead. 3. Becase of (2), the commands that used `-s` to display a summary now only support passing the full option name (`--summary`). On the local file system, we still store checkpoint data in the `env` sub-folder under `.pulumi` (so we can reuse existing checkpoint files that were written to the old folder)
40 lines
830 B
Go
40 lines
830 B
Go
// Copyright 2017, Pulumi Corporation. All rights reserved.
|
|
|
|
package engine
|
|
|
|
import (
|
|
"github.com/pulumi/pulumi/pkg/diag"
|
|
"github.com/pulumi/pulumi/pkg/tokens"
|
|
"github.com/pulumi/pulumi/pkg/util/contract"
|
|
)
|
|
|
|
type DestroyOptions struct {
|
|
Package string
|
|
DryRun bool
|
|
Parallel int
|
|
Summary bool
|
|
}
|
|
|
|
func (eng *Engine) Destroy(stack tokens.QName, events chan<- Event, opts DestroyOptions) error {
|
|
contract.Require(stack != tokens.QName(""), "stack")
|
|
|
|
info, err := eng.planContextFromStack(stack, opts.Package)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
diag := newEventSink(events, diag.FormatOptions{
|
|
Colors: true,
|
|
})
|
|
|
|
defer close(events)
|
|
|
|
return eng.deployLatest(info, deployOptions{
|
|
Destroy: true,
|
|
DryRun: opts.DryRun,
|
|
Parallel: opts.Parallel,
|
|
Summary: opts.Summary,
|
|
Events: events,
|
|
Diag: diag,
|
|
})
|
|
}
|