Commit 6d6b3e1a authored by Samit Pal's avatar Samit Pal

The default image name in the code has a bug. It is being set to...

The default image name in the code has a bug. It is being set to packer-{{timestamp}}, the {{timestamp}} part needs to be interpolated. Without the interpolation the GCE builder fails with
the following error

==> googlecompute: Creating image...
==> googlecompute: Error waiting for image: googleapi: Error 400: Invalid value for field 'resource.name': 'packer-{{timestamp}}'. Must be a match of regex '(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)', invalid
parent 872e78d5
...@@ -73,7 +73,13 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) { ...@@ -73,7 +73,13 @@ func NewConfig(raws ...interface{}) (*Config, []string, error) {
} }
if c.ImageName == "" { if c.ImageName == "" {
c.ImageName = "packer-{{timestamp}}" img, err := interpolate.Render("packer-{{timestamp}}", nil)
if err != nil {
panic(err)
}
// Default to packer-{{ unix timestamp (utc) }}
c.ImageName = img
} }
if c.InstanceName == "" { if c.InstanceName == "" {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment