Merge pull request #2735 from hashicorp/b-aws-lc-enable-monitoring-fix

provider/aws: Fix issue with Launch Configurations and enable_monitoring
This commit is contained in:
Clint 2015-07-15 17:02:40 -05:00
commit f0bed182b8
1 changed files with 5 additions and 7 deletions

View File

@ -118,8 +118,8 @@ func resourceAwsLaunchConfiguration() *schema.Resource {
"enable_monitoring": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Computed: true,
ForceNew: true,
Default: true,
},
"ebs_block_device": &schema.Schema{
@ -272,10 +272,8 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface
createLaunchConfigurationOpts.UserData = aws.String(userData)
}
if v, ok := d.GetOk("enable_monitoring"); ok {
createLaunchConfigurationOpts.InstanceMonitoring = &autoscaling.InstanceMonitoring{
Enabled: aws.Boolean(v.(bool)),
}
createLaunchConfigurationOpts.InstanceMonitoring = &autoscaling.InstanceMonitoring{
Enabled: aws.Boolean(d.Get("enable_monitoring").(bool)),
}
if v, ok := d.GetOk("iam_instance_profile"); ok {
@ -394,7 +392,7 @@ func resourceAwsLaunchConfigurationCreate(d *schema.ResourceData, meta interface
createLaunchConfigurationOpts.LaunchConfigurationName = aws.String(lcName)
log.Printf(
"[DEBUG] autoscaling create launch configuration: %#v", createLaunchConfigurationOpts)
"[DEBUG] autoscaling create launch configuration: %s", createLaunchConfigurationOpts)
// IAM profiles can take ~10 seconds to propagate in AWS:
// http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#launch-instance-with-role-console
@ -435,7 +433,7 @@ func resourceAwsLaunchConfigurationRead(d *schema.ResourceData, meta interface{}
LaunchConfigurationNames: []*string{aws.String(d.Id())},
}
log.Printf("[DEBUG] launch configuration describe configuration: %#v", describeOpts)
log.Printf("[DEBUG] launch configuration describe configuration: %s", describeOpts)
describConfs, err := autoscalingconn.DescribeLaunchConfigurations(&describeOpts)
if err != nil {
return fmt.Errorf("Error retrieving launch configuration: %s", err)