-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cloudfront: support for cache and origin request policies #14373
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! 👋 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! |
Any word on when this will be released? |
I think to be effective we'd also want |
@EthanDavis I am currently working on this one, and I expect it will be released in the next week or two. @jessefarinacci Agreed. I'm working on covering the data sources for the new policies also. |
@bill-rich any alternatives for this until it get's released? |
You can temporarily use
|
Hey @garthkerr thank you for that. |
@M-A-N-I-S-H-K this won't work for remote runs. But if it's just remote state, you can pipe it in like:
I have this wrapped in a
|
Eagerly waiting for it to be merged. |
I can't find this feature in ROADMAP any more, did you give up to support this feature ? |
@abcfy2 It's still there, first item under Workflow Improvements |
@lejeunen Oh, the default branch is |
No need to worry about the roadmap, And I expect that support for cache policies is following soon: #17336 Edit:
|
How do i use an aws_cloudfront_origin_request_policy after its created inside my cache behavior. For the **aws_cloudfront_cache_policy ** I can use cache_policy_id but what can I use with aws_cloudfront_origin_request_policy @ewbankkit ? |
How to add the resource "aws_cloudfront_origin_request_policy" "this" {
...
}
resource "aws_cloudfront_cache_policy" "this" {
...
}
resource "aws_cloudfront_distribution" "distribution" {
...
default_cache_behavior {
allowed_methods = ["GET", "HEAD"]
cached_methods = ["GET", "HEAD"]
target_origin_id = "origin_id"
viewer_protocol_policy = "redirect-to-https"
compress = true
origin_request_policy_id = aws_cloudfront_origin_request_policy.this.id
cache_policy_id = aws_cloudfront_cache_policy.this.id
}
} |
one last question, how do i go about importing existing aws_cloudfront_cache_policy and aws_cloudfront_origin_request_policy? thanks for the previous reply |
Existing resources should be importable via the corresponding data resources
So you could e.g. use managed policies from AWS:
|
im looking to import policies created manually in the console, not using the data sources :) LE:
|
Hy team, I have a previously created cloudfront distribution with
Now when I try to implement
Once I apply this, I get the following error.
But when I create new distribution with only Is there a way to implement |
FYI, I tried to use Managed policies provided by Amazon and below codes worked. I don't know why but when I used the
|
I've used the terraform-aws module, in that case I needed to add the cache/origin-request policies to the
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
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)
Potential Terraform Configuration
References
The text was updated successfully, but these errors were encountered: