From 94f703692cae44140701e855edd3b8a252cd2c44 Mon Sep 17 00:00:00 2001 From: Paul Hinze Date: Wed, 22 Apr 2015 12:53:47 -0500 Subject: [PATCH] provider/aws: switch to helper for LC names --- .../aws/resource_aws_launch_configuration.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/builtin/providers/aws/resource_aws_launch_configuration.go b/builtin/providers/aws/resource_aws_launch_configuration.go index 3ed551c86..8d8e09342 100644 --- a/builtin/providers/aws/resource_aws_launch_configuration.go +++ b/builtin/providers/aws/resource_aws_launch_configuration.go @@ -364,16 +364,13 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface createLaunchConfigurationOpts.BlockDeviceMappings = blockDevices } - var id string + var lcName string if v, ok := d.GetOk("name"); ok { - id = v.(string) + lcName = 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) - id = configName + lcName = resource.UniqueId() } - createLaunchConfigurationOpts.LaunchConfigurationName = aws.String(id) + createLaunchConfigurationOpts.LaunchConfigurationName = aws.String(lcName) log.Printf( "[DEBUG] autoscaling create launch configuration: %#v", createLaunchConfigurationOpts) @@ -382,7 +379,7 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface return fmt.Errorf("Error creating launch configuration: %s", err) } - d.SetId(id) + d.SetId(lcName) log.Printf("[INFO] launch configuration ID: %s", d.Id()) // We put a Retry here since sometimes eventual consistency bites