providers/aws: set id outside if/esle

This commit is contained in:
Mitchell Hashimoto 2015-04-14 08:23:16 -07:00
parent f7a2f2a2e7
commit 783d912b7c
1 changed files with 1 additions and 2 deletions

View File

@ -366,15 +366,14 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface
var id string
if v, ok := d.GetOk("name"); ok {
createLaunchConfigurationOpts.LaunchConfigurationName = aws.String(v.(string))
id = v.(string)
} else {
hash := sha1.Sum([]byte(fmt.Sprintf("%#v", createLaunchConfigurationOpts)))
configName := fmt.Sprintf("terraform-%s", base64.URLEncoding.EncodeToString(hash[:]))
log.Printf("[DEBUG] Computed Launch config name: %s", configName)
createLaunchConfigurationOpts.LaunchConfigurationName = aws.String(configName)
id = configName
}
createLaunchConfigurationOpts.LaunchConfigurationName = aws.String(id)
log.Printf(
"[DEBUG] autoscaling create launch configuration: %#v", createLaunchConfigurationOpts)