IPv6 Support To Cloudfront (#10332)
* Added IPv6 Support To Cloudfront * Added IPv6 docs to cloudfront
This commit is contained in:
parent
8f0dd03a94
commit
a886b630a0
|
@ -46,6 +46,7 @@ func expandDistributionConfig(d *schema.ResourceData) *cloudfront.DistributionCo
|
|||
CustomErrorResponses: expandCustomErrorResponses(d.Get("custom_error_response").(*schema.Set)),
|
||||
DefaultCacheBehavior: expandDefaultCacheBehavior(d.Get("default_cache_behavior").(*schema.Set).List()[0].(map[string]interface{})),
|
||||
Enabled: aws.Bool(d.Get("enabled").(bool)),
|
||||
IsIPV6Enabled: aws.Bool(d.Get("is_ipv6_enabled").(bool)),
|
||||
HttpVersion: aws.String(d.Get("http_version").(string)),
|
||||
Origins: expandOrigins(d.Get("origin").(*schema.Set)),
|
||||
PriceClass: aws.String(d.Get("price_class").(string)),
|
||||
|
@ -101,6 +102,7 @@ func flattenDistributionConfig(d *schema.ResourceData, distributionConfig *cloud
|
|||
var err error
|
||||
|
||||
d.Set("enabled", distributionConfig.Enabled)
|
||||
d.Set("is_ipv6_enabled", distributionConfig.IsIPV6Enabled)
|
||||
d.Set("price_class", distributionConfig.PriceClass)
|
||||
d.Set("hosted_zone_id", cloudFrontRoute53ZoneID)
|
||||
|
||||
|
|
|
@ -490,6 +490,11 @@ func resourceAwsCloudFrontDistribution() *schema.Resource {
|
|||
Optional: true,
|
||||
Default: false,
|
||||
},
|
||||
"is_ipv6_enabled": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: false,
|
||||
},
|
||||
|
||||
"tags": tagsSchema(),
|
||||
},
|
||||
|
|
|
@ -177,6 +177,26 @@ func TestAccAWSCloudFrontDistribution_HTTP11Config(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig(t *testing.T) {
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckCloudFrontDistributionDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: testAccAWSCloudFrontDistributionIsIPV6EnabledConfig,
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckCloudFrontDistributionExistence(
|
||||
"aws_cloudfront_distribution.is_ipv6_enabled",
|
||||
),
|
||||
resource.TestCheckResourceAttr(
|
||||
"aws_cloudfront_distribution.is_ipv6_enabled", "is_ipv6_enabled", "true"),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig(t *testing.T) {
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
|
@ -746,3 +766,52 @@ resource "aws_cloudfront_distribution" "http_1_1" {
|
|||
%s
|
||||
}
|
||||
`, rand.New(rand.NewSource(time.Now().UnixNano())).Int(), testAccAWSCloudFrontDistributionRetainConfig())
|
||||
|
||||
var testAccAWSCloudFrontDistributionIsIPV6EnabledConfig = fmt.Sprintf(`
|
||||
variable rand_id {
|
||||
default = %d
|
||||
}
|
||||
|
||||
resource "aws_cloudfront_distribution" "is_ipv6_enabled" {
|
||||
origin {
|
||||
domain_name = "www.example.com"
|
||||
origin_id = "myCustomOrigin"
|
||||
custom_origin_config {
|
||||
http_port = 80
|
||||
https_port = 443
|
||||
origin_protocol_policy = "http-only"
|
||||
origin_ssl_protocols = [ "SSLv3", "TLSv1" ]
|
||||
}
|
||||
}
|
||||
enabled = true
|
||||
is_ipv6_enabled = true
|
||||
comment = "Some comment"
|
||||
default_cache_behavior {
|
||||
allowed_methods = [ "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT" ]
|
||||
cached_methods = [ "GET", "HEAD" ]
|
||||
target_origin_id = "myCustomOrigin"
|
||||
smooth_streaming = false
|
||||
forwarded_values {
|
||||
query_string = false
|
||||
cookies {
|
||||
forward = "all"
|
||||
}
|
||||
}
|
||||
viewer_protocol_policy = "allow-all"
|
||||
min_ttl = 0
|
||||
default_ttl = 3600
|
||||
max_ttl = 86400
|
||||
}
|
||||
http_version = "http1.1"
|
||||
restrictions {
|
||||
geo_restriction {
|
||||
restriction_type = "whitelist"
|
||||
locations = [ "US", "CA", "GB", "DE" ]
|
||||
}
|
||||
}
|
||||
viewer_certificate {
|
||||
cloudfront_default_certificate = true
|
||||
}
|
||||
%s
|
||||
}
|
||||
`, rand.New(rand.NewSource(time.Now().UnixNano())).Int(), testAccAWSCloudFrontDistributionRetainConfig())
|
||||
|
|
|
@ -36,6 +36,7 @@ resource "aws_cloudfront_distribution" "s3_distribution" {
|
|||
}
|
||||
|
||||
enabled = true
|
||||
is_ipv6_enabled = true
|
||||
comment = "Some comment"
|
||||
default_root_object = "index.html"
|
||||
|
||||
|
@ -114,6 +115,8 @@ of several sub-resources - these resources are laid out below.
|
|||
* `enabled` (Required) - Whether the distribution is enabled to accept end
|
||||
user requests for content.
|
||||
|
||||
* `is_ipv6_enabled` (Optional) - Whether the IPv6 is enabled for the distribution.
|
||||
|
||||
* `http_version` (Optional) - The maximum HTTP version to support on the
|
||||
distribution. Allowed values are `http1.1` and `http2`. The default is
|
||||
`http2`.
|
||||
|
|
Loading…
Reference in New Issue