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

Add support for codedeploy #1950

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

Conversation

shblue21
Copy link
Contributor

@shblue21 shblue21 commented Sep 20, 2023

SUMMARY

fix #887

hello. I have implemented 2 modules related to AWS Codedeploy.

  • codedeploy_application
  • codedeploy_deployment
    I've preserved the implementation of other modules as much as possible.
ISSUE TYPE
  • New Module Pull Request
COMPONENT NAME

codedeploy_application
codedeploy_deployment

ADDITIONAL INFORMATION

The deployment group relied on exception responses from AWS whenever possible, although the required parameters vary depending on the EC2/ECS/Lamdba deployment target.

@github-actions
Copy link

github-actions bot commented Sep 20, 2023

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/6719355836

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/codedeploy_application_module.html
  • A collections/community/aws/codedeploy_deployment_group_module.html
  • M collections/community/aws/codecommit_repository_module.html
  • M collections/community/aws/codepipeline_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/codecommit_repository_module.html b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/codecommit_repository_module.html
index 372c728..4e597d8 100644
--- a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/codecommit_repository_module.html
+++ b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/codecommit_repository_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.codepipeline module – Create or delete AWS CodePipelines" href="codepipeline_module.html" />
+    <link rel="next" title="community.aws.codedeploy_application module – Manage applications in AWS CodeDeploy" href="codedeploy_application_module.html" />
     <link rel="prev" title="community.aws.codebuild_project module – Create or delete an AWS CodeBuild project" href="codebuild_project_module.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
 
 
@@ -542,7 +542,7 @@ see <a class="reference internal" href="#ansible-collections-community-aws-codec
 
 <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
         <a href="codebuild_project_module.html" class="btn btn-neutral float-left" title="community.aws.codebuild_project module – Create or delete an AWS CodeBuild project" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
-        <a href="codepipeline_module.html" class="btn btn-neutral float-right" title="community.aws.codepipeline module – Create or delete AWS CodePipelines" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
+        <a href="codedeploy_application_module.html" class="btn btn-neutral float-right" title="community.aws.codedeploy_application module – Manage applications in AWS CodeDeploy" 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/codepipeline_module.html b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/codepipeline_module.html
index 74be3d5..6d07237 100644
--- a/home/runner/work/community.aws/community.aws/docsbuild/base/collections/community/aws/codepipeline_module.html
+++ b/home/runner/work/community.aws/community.aws/docsbuild/head/collections/community/aws/codepipeline_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.config_aggregation_authorization module – Manage cross-account AWS Config authorizations" href="config_aggregation_authorization_module.html" />
-    <link rel="prev" title="community.aws.codecommit_repository module – Manage repositories in AWS CodeCommit" href="codecommit_repository_module.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
+    <link rel="prev" title="community.aws.codedeploy_deployment_group module – Manage deployment groups in AWS CodeDeploy" href="codedeploy_deployment_group_module.html" /><!-- extra head elements for Ansible beyond RTD Sphinx Theme -->
 
 
 
@@ -591,7 +591,7 @@ see <a class="reference internal" href="#ansible-collections-community-aws-codep
           
 
 <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
-        <a href="codecommit_repository_module.html" class="btn btn-neutral float-left" title="community.aws.codecommit_repository module – Manage repositories in AWS CodeCommit" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
+        <a href="codedeploy_deployment_group_module.html" class="btn btn-neutral float-left" title="community.aws.codedeploy_deployment_group module – Manage deployment groups in AWS CodeDeploy" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
         <a href="config_aggregation_authorization_module.html" class="btn btn-neutral float-right" title="community.aws.config_aggregation_authorization module – Manage cross-account AWS Config authorizations" 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 bbcc95f..a1872ce 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
@@ -209,6 +209,8 @@
 <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> – Create, update and delete response headers policies to be used in a Cloudfront distribution</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> – Create or delete an AWS CodeBuild project</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> – Manage repositories in AWS CodeCommit</p></li>
+<li><p><a class="reference internal" href="codedeploy_application_module.html#ansible-collections-community-aws-codedeploy-application-module"><span class="std std-ref">codedeploy_application module</span></a> – Manage applications in AWS CodeDeploy</p></li>
+<li><p><a class="reference internal" href="codedeploy_deployment_group_module.html#ansible-collections-community-aws-codedeploy-deployment-group-module"><span class="std std-ref">codedeploy_deployment_group module</span></a> – Manage deployment groups in AWS CodeDeploy</p></li>
 <li><p><a class="reference internal" href="codepipeline_module.html#ansible-collections-community-aws-codepipeline-module"><span class="std std-ref">codepipeline module</span></a> – Create or delete AWS CodePipelines</p></li>
 <li><p><a class="reference internal" href="config_aggregation_authorization_module.html#ansible-collections-community-aws-config-aggregation-authorization-module"><span class="std std-ref">config_aggregation_authorization module</span></a> – Manage cross-account AWS Config authorizations</p></li>
 <li><p><a class="reference internal" href="config_aggregator_module.html#ansible-collections-community-aws-config-aggregator-module"><span class="std std-ref">config_aggregator module</span></a> – Manage AWS Config aggregations across multiple accounts</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 1651532..9dc5155 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
@@ -152,6 +152,8 @@
 <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> – Create, update and delete response headers policies to be used in a Cloudfront distribution</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> – Create or delete an AWS CodeBuild project</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> – Manage repositories in AWS CodeCommit</p></li>
+<li><p><a class="reference internal" href="community/aws/codedeploy_application_module.html#ansible-collections-community-aws-codedeploy-application-module"><span class="std std-ref">community.aws.codedeploy_application</span></a> – Manage applications in AWS CodeDeploy</p></li>
+<li><p><a class="reference internal" href="community/aws/codedeploy_deployment_group_module.html#ansible-collections-community-aws-codedeploy-deployment-group-module"><span class="std std-ref">community.aws.codedeploy_deployment_group</span></a> – Manage deployment groups in AWS CodeDeploy</p></li>
 <li><p><a class="reference internal" href="community/aws/codepipeline_module.html#ansible-collections-community-aws-codepipeline-module"><span class="std std-ref">community.aws.codepipeline</span></a> – Create or delete AWS CodePipelines</p></li>
 <li><p><a class="reference internal" href="community/aws/config_aggregation_authorization_module.html#ansible-collections-community-aws-config-aggregation-authorization-module"><span class="std std-ref">community.aws.config_aggregation_authorization</span></a> – Manage cross-account AWS Config authorizations</p></li>
 <li><p><a class="reference internal" href="community/aws/config_aggregator_module.html#ansible-collections-community-aws-config-aggregator-module"><span class="std std-ref">community.aws.config_aggregator</span></a> – Manage AWS Config aggregations across multiple accounts</p></li>

@softwarefactory-project-zuul
Copy link
Contributor

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

✔️ ansible-galaxy-importer SUCCESS in 4m 26s (non-voting)
✔️ build-ansible-collection SUCCESS in 12m 31s
✔️ ansible-test-splitter SUCCESS in 4m 58s
integration-community.aws-1 FAILURE in 9m 34s
integration-community.aws-2 FAILURE in 9m 11s
Skipped 20 jobs

@softwarefactory-project-zuul
Copy link
Contributor

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

✔️ ansible-galaxy-importer SUCCESS in 4m 27s (non-voting)
✔️ build-ansible-collection SUCCESS in 12m 55s
✔️ ansible-test-splitter SUCCESS in 4m 46s
integration-community.aws-1 FAILURE in 8m 05s
integration-community.aws-2 FAILURE in 7m 54s
Skipped 20 jobs

@shblue21
Copy link
Contributor Author

shblue21 commented Oct 6, 2023

Hello Team!,
I am getting the following error when performing CI. (Zuul Build)

CodeDeployAnsibleAWSError: couldn't get application: An error occurred (AccessDeniedException) when calling the GetApplication operation: User: arn:aws:sts::966509639900:assumed-role/ansible-core-ci-test-prod/prod=remote=zuul-cloud is not authorized to perform: codedeploy:GetApplication on resource: arn:aws:codedeploy:us-east-1:966509639900:application:ansible-test-18813389-np0004166926_app2 because no identity-based policy allows the codedeploy:GetApplication action
fatal: [testhost]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_codedeploy_application_payload_b6m9ga50/ansible_codedeploy_application_payload.zip/ansible_collections/community/aws/plugins/modules/codedeploy_application.py\", line 112, in _get_application\n  File \"/home/zuul/venv/lib/python3.11/site-packages/botocore/client.py\", line 415, in _api_call\n    return self._make_api_call(operation_name, kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/home/zuul/venv/lib/python3.11/site-packages/botocore/client.py\", line 745, in _make_api_call\n    raise error_class(parsed_response, operation_name)\nbotocore.exceptions.ClientError: An error occurred (AccessDeniedException) when calling the GetApplication operation: User: arn:aws:sts::966509639900:assumed-role/ansible-core-ci-test-prod/prod=remote=zuul-cloud is not authorized to perform: codedeploy:GetApplication on resource: arn:aws:codedeploy:us-east-1:966509639900:application:ansible-test-18813389-np0004166926_app2 because no identity-based policy allows the codedeploy:GetApplication action\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"<stdin>\", line 121, in <module>\n  File \"<stdin>\", line 113, in _ansiballz_main\n  File \"<stdin>\", line 61, in invoke_module\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/tmp/ansible_codedeploy_application_payload_b6m9ga50/ansible_codedeploy_application_payload.zip/ansible_collections/community/aws/plugins/modules/codedeploy_application.py\", line 217, in <module>\n  File \"/tmp/ansible_codedeploy_application_payload_b6m9ga50/ansible_codedeploy_application_payload.zip/ansible_collections/community/aws/plugins/modules/codedeploy_application.py\", line 209, in main\n  File \"/tmp/ansible_codedeploy_application_payload_b6m9ga50/ansible_codedeploy_application_payload.zip/ansible_collections/community/aws/plugins/modules/codedeploy_application.py\", line 182, in ensure_application_absent\n  File \"/tmp/ansible_codedeploy_application_payload_b6m9ga50/ansible_codedeploy_application_payload.zip/ansible_collections/community/aws/plugins/modules/codedeploy_application.py\", line 117, in _get_application\nCodeDeployAnsibleAWSError: couldn't get application: An error occurred (AccessDeniedException) when calling the GetApplication operation: User: arn:aws:sts::966509639900:assumed-role/ansible-core-ci-test-prod/prod=remote=zuul-cloud is not authorized to perform: codedeploy:GetApplication on resource: arn:aws:codedeploy:us-east-1:966509639900:application:ansible-test-18813389-np0004166926_app2 because no identity-based policy allows the codedeploy:GetApplication action\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Do I need to give permission to the test code?

Copy link
Contributor

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

✔️ ansible-galaxy-importer SUCCESS in 3m 51s (non-voting)
✔️ build-ansible-collection SUCCESS in 15m 16s
✔️ ansible-test-splitter SUCCESS in 5m 52s
integration-community.aws-1 FAILURE in 6m 32s
integration-community.aws-2 FAILURE in 6m 43s
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.

Module for AWS CodeDeploy
1 participant