@@ -49,11 +49,11 @@ type Config struct {
4949 StorageName string `mapstructure:"storage_name"`
5050
5151 // Optional configuration values
52- TemplatePrefix string `mapstructure:"template_prefix"`
53- IsTemplateNameFixed bool `mapstructure:"is_template_name_fixed "`
54- StorageSize int `mapstructure:"storage_size"`
55- Timeout time.Duration `mapstructure:"state_timeout_duration"`
56- CloneZones []string `mapstructure:"clone_zones"`
52+ TemplatePrefix string `mapstructure:"template_prefix"`
53+ TemplateName string `mapstructure:"template_name "`
54+ StorageSize int `mapstructure:"storage_size"`
55+ Timeout time.Duration `mapstructure:"state_timeout_duration"`
56+ CloneZones []string `mapstructure:"clone_zones"`
5757
5858 RawNetworking []internal.NetworkInterface `mapstructure:"network_interfaces"`
5959 Networking []request.CreateServerInterface
@@ -79,7 +79,7 @@ func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
7979 c .setEnv ()
8080
8181 // defaults
82- if c .TemplatePrefix == "" {
82+ if c .TemplatePrefix == "" && len ( c . TemplateName ) == 0 {
8383 c .TemplatePrefix = DefaultTemplatePrefix
8484 }
8585
@@ -153,6 +153,18 @@ func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
153153 )
154154 }
155155
156+ if len (c .TemplateName ) > 40 {
157+ errs = packer .MultiErrorAppend (
158+ errs , errors .New ("'template_name' is limited to 40 characters" ),
159+ )
160+ }
161+
162+ if len (c .TemplatePrefix ) > 0 && len (c .TemplateName ) > 0 {
163+ errs = packer .MultiErrorAppend (
164+ errs , errors .New ("you can either use 'template_prefix' or 'template_name' in your configuration" ),
165+ )
166+ }
167+
156168 if errs != nil && len (errs .Errors ) > 0 {
157169 return nil , errs
158170 }
0 commit comments