mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
provider/aws: switch to helper for LC names
This commit is contained in:
parent
d1106e9e22
commit
94f703692c
@ -364,16 +364,13 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface
|
|||||||
createLaunchConfigurationOpts.BlockDeviceMappings = blockDevices
|
createLaunchConfigurationOpts.BlockDeviceMappings = blockDevices
|
||||||
}
|
}
|
||||||
|
|
||||||
var id string
|
var lcName string
|
||||||
if v, ok := d.GetOk("name"); ok {
|
if v, ok := d.GetOk("name"); ok {
|
||||||
id = v.(string)
|
lcName = v.(string)
|
||||||
} else {
|
} else {
|
||||||
hash := sha1.Sum([]byte(fmt.Sprintf("%#v", createLaunchConfigurationOpts)))
|
lcName = resource.UniqueId()
|
||||||
configName := fmt.Sprintf("terraform-%s", base64.URLEncoding.EncodeToString(hash[:]))
|
|
||||||
log.Printf("[DEBUG] Computed Launch config name: %s", configName)
|
|
||||||
id = configName
|
|
||||||
}
|
}
|
||||||
createLaunchConfigurationOpts.LaunchConfigurationName = aws.String(id)
|
createLaunchConfigurationOpts.LaunchConfigurationName = aws.String(lcName)
|
||||||
|
|
||||||
log.Printf(
|
log.Printf(
|
||||||
"[DEBUG] autoscaling create launch configuration: %#v", createLaunchConfigurationOpts)
|
"[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)
|
return fmt.Errorf("Error creating launch configuration: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.SetId(id)
|
d.SetId(lcName)
|
||||||
log.Printf("[INFO] launch configuration ID: %s", d.Id())
|
log.Printf("[INFO] launch configuration ID: %s", d.Id())
|
||||||
|
|
||||||
// We put a Retry here since sometimes eventual consistency bites
|
// We put a Retry here since sometimes eventual consistency bites
|
||||||
|
Loading…
Reference in New Issue
Block a user