Skip to content

Commit b9cf0ae

Browse files
authored
fix: terraform installation (#971)
1 parent 9d94eb0 commit b9cf0ae

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

pkg/cmd/build/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import (
2222
func IntentWithSpinner(o *builders.Options, proj *v1.Project, stack *v1.Stack, ws *v1.Workspace) (*v1.Intent, error) {
2323
var sp *pterm.SpinnerPrinter
2424
if o.NoStyle {
25-
fmt.Printf("Generating Intent in the Stack %s...\n", stack.Name)
25+
fmt.Printf("Generating Spec in the Stack %s...\n", stack.Name)
2626
} else {
2727
sp = &pretty.SpinnerT
28-
sp, _ = sp.Start(fmt.Sprintf("Generating Intent in the Stack %s...", stack.Name))
28+
sp, _ = sp.Start(fmt.Sprintf("Generating Spec in the Stack %s...", stack.Name))
2929
}
3030

3131
// style means color and prompt here. Currently, sp will be nil only when o.NoStyle is true

pkg/cmd/init/init.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func NewCmd() *cobra.Command {
4343
}
4444

4545
cmd.Flags().StringVarP(&o.ProjectDir, "target", "t", "",
46-
i18n.T("specify the target direcotry"))
46+
i18n.T("specify the target directory"))
4747

4848
return cmd
4949
}

pkg/engine/runtime/terraform/install.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (installer *CLIInstaller) CheckAndInstall() error {
3636
break
3737
}
3838

39-
if i == installer.Intent.Resources.Len() {
39+
if i == installer.Intent.Resources.Len()-1 {
4040
return nil
4141
}
4242
}
@@ -56,7 +56,15 @@ func (installer *CLIInstaller) CheckAndInstall() error {
5656

5757
// check whether the terraform executable binary has been installed.
5858
func checkTerraformExecutable() error {
59-
if err := exec.Command("terraform", "--version").Run(); err == nil {
59+
// select the executable file name according to the operating system.
60+
var executable string
61+
if runtime.GOOS == "windows" {
62+
executable = "terraform.exe"
63+
} else {
64+
executable = "terraform"
65+
}
66+
67+
if err := exec.Command(executable, "--version").Run(); err == nil {
6068
return nil
6169
}
6270

@@ -65,7 +73,7 @@ func checkTerraformExecutable() error {
6573
return err
6674
}
6775

68-
execPath := filepath.Join(installDir, "terraform")
76+
execPath := filepath.Join(installDir, executable)
6977
if err := exec.Command(execPath, "--version").Run(); err != nil {
7078
return err
7179
}

test/e2e/kusionctl_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
path := filepath.Join(GetWorkDir(), "konfig", "example", "service-multi-stack", "dev")
1313
output, err := ExecKusionWithWorkDir("kusion build", path)
1414
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
15-
gomega.Expect(output).To(gomega.ContainSubstring("Generating Intent"))
15+
gomega.Expect(output).To(gomega.ContainSubstring("Generating Spec"))
1616
})
1717
})
1818
})*/

0 commit comments

Comments
 (0)