Terraform-provider-aws: cloudfront: support for cache and origin request policies

Created on 29 Jul 2020  路  12Comments  路  Source: hashicorp/terraform-provider-aws

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Amazon recently introduced CloudFront Cache Policy, Origin Request Policy. In short, caching configuration can be factored out of distribution config. Distribution can then reference existing, shared, policy. Several important features were added as well. Like decoupling headers contributing to caching key from the headers in origin request. New "Viewer" headers were added as well.

New or Affected Resource(s)

  • aws_cloudfront_distribution - CF has to be able to switch to policy-based config (per behavior)
  • aws_cloudfront_cache_policy - new resource(s). Name is to be defined.
  • aws_cloudfront_origin_request_policy - new resource(s). Name is to be defined.

Potential Terraform Configuration

# custom policy
resource "aws_cloudfront_cache_policy" "test1" {
  name = "test1"
  comment = ".."
  ...
}

resource "aws_cloudfront_distribution" "foo" {
  ..
  ordered_cache_behavior {
    ..
    cache_policy              = aws_cloudfront_cache_policy.test1.name
    origin_request_policy = "Managed-AllViewer"               # AWS-managed policy
  }
}

References

enhancement new-resource serviccloudfront

Most helpful comment

Hi all! :wave: Just wanted to direct you to our public roadmap for this quarter (Nov-Jan) in which this item has been mentioned.

Due to the significant community interest in support for this feature, we will be looking at merging existing contributions soon.聽

We appreciate all the contributions and feedback thus far.

Look out for support in the provider soon!

All 12 comments

I'll pick this up.

are aws_cloudfront_cache_policy and aws_cloudfront_origin_request_policy ready to use?

Come across the need for this at work recently. Any word on when cache policies will be able to Terraform?

I need both OriginRequesPolicies AND CachePolicies.

Any updates on this?

Would be nice to know when this change will be ready for use :)

It would be great if can share details about it, as this is one of the most important features for CloudFront automation for maintaining multiple behaviors cache(via pre-defined cache policies ids- available in cloud formation) via terraform.

One more waiting for this feature

also looking forward to it.

Waiting for this

Hi all! :wave: Just wanted to direct you to our public roadmap for this quarter (Nov-Jan) in which this item has been mentioned.

Due to the significant community interest in support for this feature, we will be looking at merging existing contributions soon.聽

We appreciate all the contributions and feedback thus far.

Look out for support in the provider soon!

Was this page helpful?
0 / 5 - 0 ratings