Skip to content

Commit

Permalink
provider/aws: Updating CloudFront distribution to set LoggingConfig i…
Browse files Browse the repository at this point in the history
…f disabled (#6407)

- Addresses the issue when local state file has logging_config populated and the user
  disables the configuration via the UI (or in this case an
  application of the TF config).  This will now properly set the
  logging_config during the read operation and identify the state as
  diverging

Fixes #6390
  • Loading branch information
jrnt30 authored and catsby committed May 4, 2016
1 parent 63849a5 commit 1c691dc
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,16 @@ func flattenDistributionConfig(d *schema.ResourceData, distributionConfig *cloud
return err
}
}

if distributionConfig.Logging != nil && *distributionConfig.Logging.Enabled {
err = d.Set("logging_config", flattenLoggingConfig(distributionConfig.Logging))
if err != nil {
return err
}
} else {
err = d.Set("logging_config", schema.NewSet(loggingConfigHash, []interface{}{}))
}
if err != nil {
return err
}

if distributionConfig.Aliases != nil {
err = d.Set("aliases", flattenAliases(distributionConfig.Aliases))
if err != nil {
Expand Down

0 comments on commit 1c691dc

Please sign in to comment.