Skip to content

Commit

Permalink
Merge pull request #975 from gruntwork-io/check-for-packer-json
Browse files Browse the repository at this point in the history
Skip packer init for non-HCL templates
  • Loading branch information
bwhaley authored Aug 16, 2021
2 parents 2db22cd + 6e2135f commit 3984e1d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/packer/packer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"sync"
"time"
Expand Down Expand Up @@ -214,6 +215,12 @@ func packerInit(t testing.TestingT, options *Options) error {
return nil
}

extension := filepath.Ext(options.Template)
if extension != ".hcl" {
options.Logger.Logf(t, "Skipping 'packer init' because it is only supported for HCL2 templates")
return nil
}

cmd := shell.Command{
Command: "packer",
Args: []string{"init", options.Template},
Expand Down

0 comments on commit 3984e1d

Please sign in to comment.