diff --git a/builder/amazon/common/ami_config.go b/builder/amazon/common/ami_config.go index 524f01eb2..074bd5a9c 100644 --- a/builder/amazon/common/ami_config.go +++ b/builder/amazon/common/ami_config.go @@ -2,6 +2,7 @@ package common import ( "fmt" + "github.com/mitchellh/goamz/aws" "github.com/mitchellh/packer/packer" ) @@ -61,6 +62,14 @@ func (c *AMIConfig) Prepare(t *packer.ConfigTemplate) []error { errs = append(errs, fmt.Errorf("ami_name must be specified")) } + if len(c.AMIRegions) > 0 { + for _, region := range c.AMIRegions { + if _, ok := aws.Regions[region]; !ok { + errs = append(errs, fmt.Errorf("Unknown region: %s", region)) + } + } + } + if len(errs) > 0 { return errs }