Skip to content

Commit

Permalink
Merge pull request #31 from gruntwork-io/packer-tweaks
Browse files Browse the repository at this point in the history
Add support for running a specific Packer build
  • Loading branch information
brikis98 authored Feb 23, 2017
2 parents 041cc89 + b91ed54 commit 7f2c072
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packer/packer.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
)

type PackerOptions struct {
Template string // The path to the Packer template
Template string // The path to the Packer template
Vars map[string]string // The custom vars to pass when running the build command
Only string // If specified, only run the build of this name
}

// Build the given Packer template and return the generated AMI ID
Expand Down Expand Up @@ -52,5 +53,10 @@ func formatPackerArgs(options PackerOptions) []string {
args = append(args, "-var", key + "=" + value)
}

if options.Only != "" {
args = append(args, "-only=" + options.Only)
}

return append(args, options.Template)
}
}

0 comments on commit 7f2c072

Please sign in to comment.