Skip to content

Commit

Permalink
Merge pull request #5586 from terraform-providers/b-aws_cloudfront_di…
Browse files Browse the repository at this point in the history
…stribution-ordered_cache_behavior-import

resource/aws_cloudfront_distribution: Import into ordered_cache_behavior instead of deprecated cache_behavior
  • Loading branch information
bflad committed Aug 20, 2018
2 parents 294c533 + 4e56e0c commit f3dfbdf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aws/cloudfront_distribution_configuration_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ func flattenDistributionConfig(d *schema.ResourceData, distributionConfig *cloud
}
}
if distributionConfig.CacheBehaviors != nil {
if _, ok := d.GetOk("ordered_cache_behavior"); ok {
err = d.Set("ordered_cache_behavior", flattenCacheBehaviors(distributionConfig.CacheBehaviors))
} else {
if _, ok := d.GetOk("cache_behavior"); ok {
err = d.Set("cache_behavior", flattenCacheBehaviorsDeprecated(distributionConfig.CacheBehaviors))
} else {
err = d.Set("ordered_cache_behavior", flattenCacheBehaviors(distributionConfig.CacheBehaviors))
}

if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions aws/resource_aws_cloudfront_distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ func TestAccAWSCloudFrontDistribution_orderedCacheBehavior(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "ordered_cache_behavior.1.path_pattern", "images2/*.jpg"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
Expand Down

0 comments on commit f3dfbdf

Please sign in to comment.