Skip to content

Commit

Permalink
acceptance tests, gofmt, and md update
Browse files Browse the repository at this point in the history
  • Loading branch information
Barry Tam committed Mar 16, 2019
1 parent bdf9ec3 commit c3a70fa
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 39 deletions.
13 changes: 0 additions & 13 deletions aws/cloudfront_distribution_configuration_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,19 +701,6 @@ func flattenOriginGroupMembers(ogm *cloudfront.OriginGroupMembers) []interface{}
return s
}

func expandOriginGroupMember(m map[string]interface{}) *cloudfront.OriginGroupMember {
return &cloudfront.OriginGroupMember{
OriginId: aws.String(m["origin_id"].(string)),
}
}

func flattenOriginGroupMember(ogms *cloudfront.OriginGroupMember) map[string]interface{} {
m := map[string]interface{}{
"origin_id": *ogms.OriginId,
}
return m
}

// Assemble the hash for the aws_cloudfront_distribution origin
// TypeSet attribute.
func originHash(v interface{}) int {
Expand Down
1 change: 0 additions & 1 deletion aws/resource_aws_cloudfront_distribution.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@ func resourceAwsCloudFrontDistribution() *schema.Resource {
Type: schema.TypeList,
Required: true,
MaxItems: 1,
Set: failoverCriteriaHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"status_codes": {
Expand Down
32 changes: 15 additions & 17 deletions aws/resource_aws_cloudfront_distribution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,16 +753,16 @@ func TestAccAWSCloudFrontDistribution_OriginGroups(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckCloudFrontDistributionExists(resourceName, &distribution),
resource.TestCheckResourceAttr(resourceName, "origin_group.#", "1"),
resource.TestCheckResourceAttr(resourceName, "origin_group.3694416691.origin_id", "groupS3"),
resource.TestCheckResourceAttr(resourceName, "origin_group.3694416691.failover_criteria.409426305.status_codes.#", "4"),
resource.TestCheckResourceAttr(resourceName, "origin_group.3694416691.failover_criteria.409426305.status_codes.0", "403"),
resource.TestCheckResourceAttr(resourceName, "origin_group.3694416691.failover_criteria.409426305.status_codes.1", "404"),
resource.TestCheckResourceAttr(resourceName, "origin_group.3694416691.failover_criteria.409426305.status_codes.2", "500"),
resource.TestCheckResourceAttr(resourceName, "origin_group.3694416691.failover_criteria.409426305.status_codes.3", "502"),
resource.TestCheckResourceAttr(resourceName, "origin_group.3694416691.members.1751759501.ordered_origin_group_member.#", "2"),
resource.TestCheckResourceAttr(resourceName, "origin_group.3694416691.members.1751759501.ordered_origin_group_member.0.origin_id", "primaryS3"),
resource.TestCheckResourceAttr(resourceName, "origin_group.3694416691.members.1751759501.ordered_origin_group_member.1.origin_id", "failoverS3"),
resource.TestCheckResourceAttr(resourceName, "default_cache_behavior.2496375652.target_origin_id", "groupS3"),
resource.TestCheckResourceAttr(resourceName, "origin_group.1789175660.origin_id", "groupS3"),
resource.TestCheckResourceAttr(resourceName, "origin_group.1789175660.failover_criteria.#", "1"),
resource.TestCheckResourceAttr(resourceName, "origin_group.1789175660.failover_criteria.0.status_codes.#", "4"),
resource.TestCheckResourceAttr(resourceName, "origin_group.1789175660.failover_criteria.0.status_codes.1057413486", "403"),
resource.TestCheckResourceAttr(resourceName, "origin_group.1789175660.failover_criteria.0.status_codes.1883721641", "404"),
resource.TestCheckResourceAttr(resourceName, "origin_group.1789175660.failover_criteria.0.status_codes.2661388106", "502"),
resource.TestCheckResourceAttr(resourceName, "origin_group.1789175660.failover_criteria.0.status_codes.2895637960", "500"),
resource.TestCheckResourceAttr(resourceName, "origin_group.1789175660.member.#", "2"),
resource.TestCheckResourceAttr(resourceName, "origin_group.1789175660.member.0.origin_id", "primaryS3"),
resource.TestCheckResourceAttr(resourceName, "origin_group.1789175660.member.1.origin_id", "failoverS3"),
),
},
},
Expand Down Expand Up @@ -1482,13 +1482,11 @@ resource "aws_cloudfront_distribution" "failover_distribution" {
failover_criteria {
status_codes = [403, 404, 500, 502]
}
members {
ordered_origin_group_member {
origin_id = "primaryS3"
}
ordered_origin_group_member {
origin_id = "failoverS3"
}
member {
origin_id = "primaryS3"
}
member {
origin_id = "failoverS3"
}
}
enabled = true
Expand Down
15 changes: 7 additions & 8 deletions website/docs/r/cloudfront_distribution.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,15 @@ resource "aws_cloudfront_distribution" "s3_distribution" {
origin_id = "groupS3"
failover_criteria {
status_codes = [403, 404, 500, 502, 503, 504]
status_codes = [403, 404, 500, 502]
}
members {
ordered_origin_group_member {
origin_id = "primaryS3"
}
ordered_origin_group_member {
origin_id = "failoverS3"
}
member {
origin_id = "primaryS3"
}
member {
origin_id = "failoverS3"
}
}
Expand Down

0 comments on commit c3a70fa

Please sign in to comment.