pulumi/pkg/engine/env_remove.go
Matt Ellis a6eabdc34b Move a bunch of code around
Move most of the guts of `lumi` into the newly created `engine`
package.
2017-08-24 18:00:46 -07:00

25 lines
555 B
Go

package engine
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi-fabric/pkg/util/contract"
)
func RemoveEnv(envName string, force bool) error {
contract.Assert(envName != "")
info, err := initEnvCmd(envName, "")
if err != nil {
return err
}
// Don't remove environments that still have resources.
if !force && info.Snapshot != nil && len(info.Snapshot.Resources) > 0 {
return errors.Errorf(
"'%v' still has resources; removal rejected; pass --force to override", info.Target.Name)
}
removeTarget(info.Target)
return nil
}