From 817822ababd3847a953ddc5be6cb2e0ff4ad61eb Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 23 Mar 2013 18:40:26 -0700 Subject: [PATCH] Amazon builder --- .gitignore | 1 + Makefile | 4 ++-- builder/amazon/builder.go | 21 +++++++++++++++++++++ example.toml | 15 +++++++++++++++ packer.go | 25 +++++++++++++++++++------ 5 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 builder/amazon/builder.go create mode 100644 example.toml diff --git a/.gitignore b/.gitignore index 5e56e040e..9fe5baeb6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /bin +/packer diff --git a/Makefile b/Makefile index 95c469a61..f01239e52 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: @mkdir -p bin/ - go get - go build -o bin/packer + go get -a + go build -a -o bin/packer .PHONY: all diff --git a/builder/amazon/builder.go b/builder/amazon/builder.go new file mode 100644 index 000000000..62d626081 --- /dev/null +++ b/builder/amazon/builder.go @@ -0,0 +1,21 @@ +package amazon + +type config struct { + AccessKey string + Region string + SecretKey string + SourceAmi string +} + +type Builder struct { + config config +} + +func (*Builder) Prepare() { +} + +func (*Builder) Build() { +} + +func (*Builder) Destroy() { +} diff --git a/example.toml b/example.toml new file mode 100644 index 000000000..27cf2c7e0 --- /dev/null +++ b/example.toml @@ -0,0 +1,15 @@ +name = "my-custom-image" + +[builder.amazon-ebs] +region = "us-east-1" +source = "ami-de0d9eb7" + +[provision] + + [provision.shell] + type = "shell" + path = "script.sh" + +[output] + + [output.vagrant] diff --git a/packer.go b/packer.go index 001051b8e..c4ede8395 100644 --- a/packer.go +++ b/packer.go @@ -1,6 +1,8 @@ // This is the main package for the `packer` application. package main +import "github.com/mitchellh/packer/builder/amazon" + // A command is a runnable sub-command of the `packer` application. // When `packer` is called with the proper subcommand, this will be // called. @@ -22,10 +24,21 @@ type Environment struct { commands map[string]Command } -func main() { - env := Environment { - commands: map[string]Command { - "" - }, - } +type Template struct { + Name string + Builders map[string]interface{} `toml:"builder"` + Provisioners map[string]interface{} `toml:"provision"` + Outputs map[string]interface{} `toml:"output"` +} + +type Builder interface { + Prepare() + Build() + Destroy() +} + +func main() { + var builder Builder + builder = &amazon.Builder{} + builder.Build() }