diff --git a/cmd/klotho/dependencies.go b/cmd/klotho/dependencies.go index f533be40..e8878848 100644 --- a/cmd/klotho/dependencies.go +++ b/cmd/klotho/dependencies.go @@ -4,12 +4,13 @@ import ( "context" "errors" "fmt" - "github.com/klothoplatform/klotho/pkg/logging" "os" "os/exec" "path/filepath" "runtime" + "github.com/klothoplatform/klotho/pkg/logging" + pulumi "github.com/pulumi/pulumi/sdk/v3" "github.com/pulumi/pulumi/sdk/v3/go/auto" ) @@ -95,8 +96,8 @@ func installPulumi(ctx context.Context) error { } func isDockerInstalled() bool { - // Check if docker is installed - cmd := exec.Command("docker", "--version") + // Check if docker is installed and the daemon is running + cmd := exec.Command("docker", "ps") err := cmd.Run() return err == nil } diff --git a/pkg/k2/orchestration/orchestrator.go b/pkg/k2/orchestration/orchestrator.go index d8d59ed7..d39bc21a 100644 --- a/pkg/k2/orchestration/orchestrator.go +++ b/pkg/k2/orchestration/orchestrator.go @@ -87,7 +87,15 @@ func (o *Orchestrator) resolveInitialState(ir *model.ApplicationEnvironment) (ma // Check for default region mismatch if state.DefaultRegion != ir.DefaultRegion { - return nil, fmt.Errorf("default region mismatch: %s != %s", state.DefaultRegion, ir.DefaultRegion) + deployed := make(map[string]model.ConstructStatus) + for k, v := range state.Constructs { + if model.IsDeletable(v.Status) { + deployed[k] = v.Status + } + } + if len(deployed) > 0 { + return nil, fmt.Errorf("cannot change region (%s -> %s) with deployed resources: %v", state.DefaultRegion, ir.DefaultRegion, deployed) + } } // Check for schema version mismatch