If `aws_s3_bucket` logging options are cleared on the AWS side, Terraform does not detect this, and changes must be made out-of-band or through a recreation of the resource. This PR addresses this issue.

Fixes #8576.
This commit is contained in:
Ameir Abdeldayem 2017-04-03 03:00:51 -04:00
parent d209dc1a32
commit 2e5abb1e84
1 changed files with 4 additions and 4 deletions

View File

@ -728,8 +728,8 @@ func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error {
}
log.Printf("[DEBUG] S3 Bucket: %s, logging: %v", d.Id(), logging)
lcl := make([]map[string]interface{}, 0, 1)
if v := logging.LoggingEnabled; v != nil {
lcl := make([]map[string]interface{}, 0, 1)
lc := make(map[string]interface{})
if *v.TargetBucket != "" {
lc["target_bucket"] = *v.TargetBucket
@ -738,9 +738,9 @@ func resourceAwsS3BucketRead(d *schema.ResourceData, meta interface{}) error {
lc["target_prefix"] = *v.TargetPrefix
}
lcl = append(lcl, lc)
if err := d.Set("logging", lcl); err != nil {
return err
}
}
if err := d.Set("logging", lcl); err != nil {
return err
}
// Read the lifecycle configuration