Skip to content
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

New Modules: cloudfront_cache_policy and cloudfront_origin_request_policy #2046

Open
wants to merge 81 commits into
base: main
Choose a base branch
from

Conversation

Zozman
Copy link
Contributor

@Zozman Zozman commented Jan 16, 2024

SUMMARY

Currently, there is no module available for creating and modifying CloudFront Cache Policies and Origin Request Policies. This makes it difficult to use custom ones with the cloudfront_distribution module.

Therefore this PR is to add modules for these 2 resources. As these resources are similar in management and functions to CloudFront Response Header Policies that are managed by the cloudfront_response_headers_policy module, this PR is heavily based on the work in #925.

ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME
  • cloudfront_cache_policy
  • cloudfront_origin_request_policy

Copy link

github-actions bot commented Jan 16, 2024

Docs Build 📝

Thank you for contribution!✨

The docsite for this PR is available for download as an artifact from this run:
https://github.com/ansible-collections/community.aws/actions/runs/12266303567

You can compare to the docs for the main branch here:
https://ansible-collections.github.io/community.aws/branch/main

File changes:

  • A collections/community/aws/cloudfront_cache_policy_module.html
  • A collections/community/aws/cloudfront_origin_request_policy_module.html
  • M collections/community/aws/cloudformation_stack_set_module.html
  • M collections/community/aws/cloudfront_distribution_module.html
  • M collections/community/aws/cloudfront_origin_access_identity_module.html
  • M collections/community/aws/cloudfront_response_headers_policy_module.html
  • M collections/community/aws/index.html
  • M collections/index_module.html
Click to see the diff comparison.

NOTE: only file modifications are shown here. New and deleted files are excluded.
See the file list and check the published docs to see those files.

diff --git a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/cloudformation_stack_set_module.html b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/cloudformation_stack_set_module.html
index a653cb9..a24c74d 100644
--- a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/cloudformation_stack_set_module.html
+++ b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/cloudformation_stack_set_module.html
@@ -22,7 +22,7 @@
       <script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
     <script src="../../../_static/js/theme.js"></script>
     <link rel="search" title="Search" href="../../../search.html" />
-    <link rel="next" title="community.aws.cloudfront_distribution module" href="cloudfront_distribution_module.html" />
+    <link rel="next" title="community.aws.cloudfront_cache_policy module" href="cloudfront_cache_policy_module.html" />
     <link rel="prev" title="community.aws.cloudformation_exports_info module" href="cloudformation_exports_info_module.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
 
 
@@ -151,7 +151,7 @@
 
 <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
         <a href="cloudformation_exports_info_module.html" class="btn btn-neutral float-left" title="community.aws.cloudformation_exports_info module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
-        <a href="cloudfront_distribution_module.html" class="btn btn-neutral float-right" title="community.aws.cloudfront_distribution module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
+        <a href="cloudfront_cache_policy_module.html" class="btn btn-neutral float-right" title="community.aws.cloudfront_cache_policy module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
     </div>
 
   <hr/>
diff --git a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/cloudfront_distribution_module.html b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/cloudfront_distribution_module.html
index d9cd64d..b7d90fa 100644
--- a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/cloudfront_distribution_module.html
+++ b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/cloudfront_distribution_module.html
@@ -23,7 +23,7 @@
     <script src="../../../_static/js/theme.js"></script>
     <link rel="search" title="Search" href="../../../search.html" />
     <link rel="next" title="community.aws.cloudfront_distribution_info module" href="cloudfront_distribution_info_module.html" />
-    <link rel="prev" title="community.aws.cloudformation_stack_set module" href="cloudformation_stack_set_module.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
+    <link rel="prev" title="community.aws.cloudfront_cache_policy module" href="cloudfront_cache_policy_module.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
 
 
 
@@ -150,7 +150,7 @@
           
 
 <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
-        <a href="cloudformation_stack_set_module.html" class="btn btn-neutral float-left" title="community.aws.cloudformation_stack_set module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
+        <a href="cloudfront_cache_policy_module.html" class="btn btn-neutral float-left" title="community.aws.cloudfront_cache_policy module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
         <a href="cloudfront_distribution_info_module.html" class="btn btn-neutral float-right" title="community.aws.cloudfront_distribution_info module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
     </div>
 
diff --git a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/cloudfront_origin_access_identity_module.html b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/cloudfront_origin_access_identity_module.html
index 88df06c..a0a53ce 100644
--- a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/cloudfront_origin_access_identity_module.html
+++ b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/cloudfront_origin_access_identity_module.html
@@ -22,7 +22,7 @@
       <script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
     <script src="../../../_static/js/theme.js"></script>
     <link rel="search" title="Search" href="../../../search.html" />
-    <link rel="next" title="community.aws.cloudfront_response_headers_policy module" href="cloudfront_response_headers_policy_module.html" />
+    <link rel="next" title="community.aws.cloudfront_origin_request_policy module" href="cloudfront_origin_request_policy_module.html" />
     <link rel="prev" title="community.aws.cloudfront_invalidation module" href="cloudfront_invalidation_module.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
 
 
@@ -151,7 +151,7 @@
 
 <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
         <a href="cloudfront_invalidation_module.html" class="btn btn-neutral float-left" title="community.aws.cloudfront_invalidation module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
-        <a href="cloudfront_response_headers_policy_module.html" class="btn btn-neutral float-right" title="community.aws.cloudfront_response_headers_policy module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
+        <a href="cloudfront_origin_request_policy_module.html" class="btn btn-neutral float-right" title="community.aws.cloudfront_origin_request_policy module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
     </div>
 
   <hr/>
diff --git a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/cloudfront_response_headers_policy_module.html b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/cloudfront_response_headers_policy_module.html
index 72e274f..5a9bb79 100644
--- a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/cloudfront_response_headers_policy_module.html
+++ b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/cloudfront_response_headers_policy_module.html
@@ -23,7 +23,7 @@
     <script src="../../../_static/js/theme.js"></script>
     <link rel="search" title="Search" href="../../../search.html" />
     <link rel="next" title="community.aws.codebuild_project module" href="codebuild_project_module.html" />
-    <link rel="prev" title="community.aws.cloudfront_origin_access_identity module" href="cloudfront_origin_access_identity_module.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
+    <link rel="prev" title="community.aws.cloudfront_origin_request_policy module" href="cloudfront_origin_request_policy_module.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
 
 
 
@@ -150,7 +150,7 @@
           
 
 <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
-        <a href="cloudfront_origin_access_identity_module.html" class="btn btn-neutral float-left" title="community.aws.cloudfront_origin_access_identity module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
+        <a href="cloudfront_origin_request_policy_module.html" class="btn btn-neutral float-left" title="community.aws.cloudfront_origin_request_policy module" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
         <a href="codebuild_project_module.html" class="btn btn-neutral float-right" title="community.aws.codebuild_project module" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
     </div>
 
diff --git a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/index.html b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/index.html
index 808e30d..9841576 100644
--- a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/index.html
+++ b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/index.html
@@ -198,10 +198,12 @@
 <li><p><a class="reference internal" href="batch_job_queue_module.html#ansible-collections-community-aws-batch-job-queue-module"><span class="std std-ref">batch_job_queue module</span></a> –</p></li>
 <li><p><a class="reference internal" href="cloudformation_exports_info_module.html#ansible-collections-community-aws-cloudformation-exports-info-module"><span class="std std-ref">cloudformation_exports_info module</span></a> –</p></li>
 <li><p><a class="reference internal" href="cloudformation_stack_set_module.html#ansible-collections-community-aws-cloudformation-stack-set-module"><span class="std std-ref">cloudformation_stack_set module</span></a> –</p></li>
+<li><p><a class="reference internal" href="cloudfront_cache_policy_module.html#ansible-collections-community-aws-cloudfront-cache-policy-module"><span class="std std-ref">cloudfront_cache_policy module</span></a> –</p></li>
 <li><p><a class="reference internal" href="cloudfront_distribution_module.html#ansible-collections-community-aws-cloudfront-distribution-module"><span class="std std-ref">cloudfront_distribution module</span></a> –</p></li>
 <li><p><a class="reference internal" href="cloudfront_distribution_info_module.html#ansible-collections-community-aws-cloudfront-distribution-info-module"><span class="std std-ref">cloudfront_distribution_info module</span></a> –</p></li>
 <li><p><a class="reference internal" href="cloudfront_invalidation_module.html#ansible-collections-community-aws-cloudfront-invalidation-module"><span class="std std-ref">cloudfront_invalidation module</span></a> –</p></li>
 <li><p><a class="reference internal" href="cloudfront_origin_access_identity_module.html#ansible-collections-community-aws-cloudfront-origin-access-identity-module"><span class="std std-ref">cloudfront_origin_access_identity module</span></a> –</p></li>
+<li><p><a class="reference internal" href="cloudfront_origin_request_policy_module.html#ansible-collections-community-aws-cloudfront-origin-request-policy-module"><span class="std std-ref">cloudfront_origin_request_policy module</span></a> –</p></li>
 <li><p><a class="reference internal" href="cloudfront_response_headers_policy_module.html#ansible-collections-community-aws-cloudfront-response-headers-policy-module"><span class="std std-ref">cloudfront_response_headers_policy module</span></a> –</p></li>
 <li><p><a class="reference internal" href="codebuild_project_module.html#ansible-collections-community-aws-codebuild-project-module"><span class="std std-ref">codebuild_project module</span></a> –</p></li>
 <li><p><a class="reference internal" href="codecommit_repository_module.html#ansible-collections-community-aws-codecommit-repository-module"><span class="std std-ref">codecommit_repository module</span></a> –</p></li>
diff --git a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/index_module.html b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/index_module.html
index 22273ca..a27e6c5 100644
--- a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/index_module.html
+++ b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/index_module.html
@@ -141,10 +141,12 @@
 <li><p><a class="reference internal" href="community/aws/batch_job_queue_module.html#ansible-collections-community-aws-batch-job-queue-module"><span class="std std-ref">community.aws.batch_job_queue</span></a> –</p></li>
 <li><p><a class="reference internal" href="community/aws/cloudformation_exports_info_module.html#ansible-collections-community-aws-cloudformation-exports-info-module"><span class="std std-ref">community.aws.cloudformation_exports_info</span></a> –</p></li>
 <li><p><a class="reference internal" href="community/aws/cloudformation_stack_set_module.html#ansible-collections-community-aws-cloudformation-stack-set-module"><span class="std std-ref">community.aws.cloudformation_stack_set</span></a> –</p></li>
+<li><p><a class="reference internal" href="community/aws/cloudfront_cache_policy_module.html#ansible-collections-community-aws-cloudfront-cache-policy-module"><span class="std std-ref">community.aws.cloudfront_cache_policy</span></a> –</p></li>
 <li><p><a class="reference internal" href="community/aws/cloudfront_distribution_module.html#ansible-collections-community-aws-cloudfront-distribution-module"><span class="std std-ref">community.aws.cloudfront_distribution</span></a> –</p></li>
 <li><p><a class="reference internal" href="community/aws/cloudfront_distribution_info_module.html#ansible-collections-community-aws-cloudfront-distribution-info-module"><span class="std std-ref">community.aws.cloudfront_distribution_info</span></a> –</p></li>
 <li><p><a class="reference internal" href="community/aws/cloudfront_invalidation_module.html#ansible-collections-community-aws-cloudfront-invalidation-module"><span class="std std-ref">community.aws.cloudfront_invalidation</span></a> –</p></li>
 <li><p><a class="reference internal" href="community/aws/cloudfront_origin_access_identity_module.html#ansible-collections-community-aws-cloudfront-origin-access-identity-module"><span class="std std-ref">community.aws.cloudfront_origin_access_identity</span></a> –</p></li>
+<li><p><a class="reference internal" href="community/aws/cloudfront_origin_request_policy_module.html#ansible-collections-community-aws-cloudfront-origin-request-policy-module"><span class="std std-ref">community.aws.cloudfront_origin_request_policy</span></a> –</p></li>
 <li><p><a class="reference internal" href="community/aws/cloudfront_response_headers_policy_module.html#ansible-collections-community-aws-cloudfront-response-headers-policy-module"><span class="std std-ref">community.aws.cloudfront_response_headers_policy</span></a> –</p></li>
 <li><p><a class="reference internal" href="community/aws/codebuild_project_module.html#ansible-collections-community-aws-codebuild-project-module"><span class="std std-ref">community.aws.codebuild_project</span></a> –</p></li>
 <li><p><a class="reference internal" href="community/aws/codecommit_repository_module.html#ansible-collections-community-aws-codecommit-repository-module"><span class="std std-ref">community.aws.codecommit_repository</span></a> –</p></li>

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/92e8d3e2717541068e296e489a5bf547

ansible-galaxy-importer FAILURE in 4m 40s (non-voting)
✔️ build-ansible-collection SUCCESS in 11m 07s
✔️ ansible-test-splitter SUCCESS in 4m 44s
✔️ integration-community.aws-1 SUCCESS in 7m 05s
✔️ integration-community.aws-2 SUCCESS in 5m 59s
Skipped 20 jobs

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/52ff6511e7034e6aaec1ad2042db38bf

ansible-galaxy-importer FAILURE in 4m 47s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 06s
✔️ ansible-test-splitter SUCCESS in 3m 54s
✔️ integration-community.aws-1 SUCCESS in 5m 50s
✔️ integration-community.aws-2 SUCCESS in 6m 58s
Skipped 20 jobs

plugins/modules/cloudfront_cache_policy.py Outdated Show resolved Hide resolved
plugins/modules/cloudfront_cache_policy.py Outdated Show resolved Hide resolved
plugins/modules/cloudfront_origin_request_policy.py Outdated Show resolved Hide resolved
plugins/modules/cloudfront_cache_policy.py Outdated Show resolved Hide resolved
plugins/modules/cloudfront_origin_request_policy.py Outdated Show resolved Hide resolved
plugins/modules/cloudfront_origin_request_policy.py Outdated Show resolved Hide resolved
plugins/modules/cloudfront_origin_request_policy.py Outdated Show resolved Hide resolved
plugins/modules/cloudfront_origin_request_policy.py Outdated Show resolved Hide resolved
plugins/modules/cloudfront_origin_request_policy.py Outdated Show resolved Hide resolved
region: '{{ aws_region }}'
block:

- name: Create a simple cache policy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also please add some tests for check_mode and idempotency?

Zozman and others added 20 commits October 21, 2024 23:25
Copy link
Contributor

Build failed.
https://ansible.softwarefactory-project.io/zuul/buildset/b39c7fd55d574553a6695e9511caed5f

ansible-galaxy-importer FAILURE in 5m 04s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 27s
✔️ ansible-test-splitter SUCCESS in 4m 11s
integration-community.aws-1 FAILURE in 5m 47s
integration-community.aws-2 FAILURE in 4m 57s
Skipped 20 jobs

@Zozman Zozman force-pushed the cloudfrontCreateCacheAndOriginPolicy branch from c27c8e3 to 9d49a0d Compare October 22, 2024 07:11
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/bd0fab71da094381a329601bae627ea3

ansible-galaxy-importer FAILURE in 5m 19s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 34s
✔️ ansible-test-splitter SUCCESS in 3m 57s
✔️ integration-community.aws-1 SUCCESS in 6m 33s
✔️ integration-community.aws-2 SUCCESS in 5m 18s
Skipped 20 jobs

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/4eef754b52ec40dd90875f9ee4f2fee7

✔️ ansible-galaxy-importer SUCCESS in 3m 54s (non-voting)
✔️ build-ansible-collection SUCCESS in 10m 41s
✔️ ansible-test-splitter SUCCESS in 3m 55s
✔️ integration-community.aws-1 SUCCESS in 5m 20s
✔️ integration-community.aws-2 SUCCESS in 6m 36s
Skipped 20 jobs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants