provider/aws: Fix Read of AWS CloudWatch Log when Update was called (#6384)

Fixes #6169

The Update func was hitting a return err and when the err was empty, it
was skipping over the subsequent read func
This commit is contained in:
Paul Stack 2016-04-28 00:02:33 +01:00
parent 776f522582
commit c12a31e1b0
1 changed files with 6 additions and 2 deletions

View File

@ -117,15 +117,19 @@ func resourceAwsCloudWatchLogGroupUpdate(d *schema.ResourceData, meta interface{
} }
log.Printf("[DEBUG] Setting retention for CloudWatch Log Group: %q: %s", name, input) log.Printf("[DEBUG] Setting retention for CloudWatch Log Group: %q: %s", name, input)
_, err = conn.PutRetentionPolicy(&input) _, err = conn.PutRetentionPolicy(&input)
if err != nil {
return err
}
} else { } else {
log.Printf("[DEBUG] Deleting retention for CloudWatch Log Group: %q", name) log.Printf("[DEBUG] Deleting retention for CloudWatch Log Group: %q", name)
_, err = conn.DeleteRetentionPolicy(&cloudwatchlogs.DeleteRetentionPolicyInput{ _, err = conn.DeleteRetentionPolicy(&cloudwatchlogs.DeleteRetentionPolicyInput{
LogGroupName: aws.String(name), LogGroupName: aws.String(name),
}) })
} if err != nil {
return err return err
} }
}
}
return resourceAwsCloudWatchLogGroupRead(d, meta) return resourceAwsCloudWatchLogGroupRead(d, meta)
} }