community.aws icon indicating copy to clipboard operation
community.aws copied to clipboard

Add support for setting cache and origin request policy ids in cache behavior

Open sethernet opened this issue 3 years ago • 4 comments

SUMMARY

Add support for setting cache and origin request policy ids in the cache behaviors block when creating a distribution in cloudfront_distribution.

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

cloudfront_distribution

ADDITIONAL INFORMATION

Currently we are unable to set cache policy or origin request policy ids in the cache behaviors section so that they are added to a distribution.

Example playbook code:

      cache_behaviors:
        - path_pattern: "*/"
          target_origin_id: ""
          field_level_encryption_id: ""
          cache_policy_id: "{{ cache_policy_id }}"
          origin_request_policy_id: "{{ origin_request_policy_id }}"

Example python code:

cache_behavior['cache_policy_id'] = cache_behavior.get('cache_policy_id', config.get('cache_policy_id'))
cache_behavior['origin_request_policy_id'] = cache_behavior.get('origin_request_policy_id', config.get('origin_request_policy_id'))

sethernet avatar Nov 05 '20 23:11 sethernet

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

ansibullbot avatar Nov 16 '20 18:11 ansibullbot

cc @jillr @s-hertel @tremble @willthames @wilvk @wimnat click here for bot help

ansibullbot avatar Nov 16 '20 18:11 ansibullbot

Thank you for raising this idea @sethernet. Would you like to raise a PR for this issue?

alinabuzachis avatar Dec 16 '20 14:12 alinabuzachis

Theoretically the parameter cache_policy_id: 658327ea-f89d-4fab-a63d-7e88639e58f6 works already.
But the default values for min/max/default_ttl that are added, are incompatible together.

markuman avatar Feb 21 '22 14:02 markuman