forked from ansible/ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
aws_codecommit: Fix integration tests and Add support for updating th…
…e description (ansible#61263) * Update DevOps AWS policy - Fix typos in permission names - While AWS claims you can use 'arn:aws:codecommit:*' it errors unless you use '*' * aws_codecommit: (integration tests) Migrate to module_defaults * aws_codecommit: (integration tests) Fix integration tests * aws_codecommit: (integration tests) Add tests for updating the description * aws_codecommit: Add support for updating the description and rename "comment" option to "description"
- Loading branch information
Showing
4 changed files
with
105 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
minor_changes: | ||
- aws_codecommit - Support updating the description |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,105 @@ | ||
--- | ||
- block: | ||
# ============================================================ | ||
- name: set connection information for all tasks | ||
set_fact: | ||
aws_connection_info: &aws_connection_info | ||
aws_access_key: "{{ aws_access_key }}" | ||
aws_secret_key: "{{ aws_secret_key }}" | ||
security_token: "{{ security_token }}" | ||
region: "{{ aws_region }}" | ||
no_log: true | ||
- module_defaults: | ||
group/aws: | ||
aws_access_key: "{{ aws_access_key }}" | ||
aws_secret_key: "{{ aws_secret_key }}" | ||
security_token: "{{ security_token | default(omit) }}" | ||
region: "{{ aws_region }}" | ||
block: | ||
# ============================================================ | ||
- name: Create a repository (CHECK MODE) | ||
aws_codecommit: | ||
name: "{{ resource_prefix }}_repo" | ||
description: original comment | ||
state: present | ||
register: output | ||
check_mode: yes | ||
- assert: | ||
that: | ||
- output is changed | ||
|
||
- name: Create a repository | ||
aws_codecommit: | ||
name: "{{ resource_prefix }}_repo" | ||
comment: original comment | ||
description: original comment | ||
state: present | ||
<<: *aws_connection_info | ||
register: output | ||
- assert: | ||
that: | ||
- output is changed | ||
- output['repository_metadata'].repository_name == '{{ resource_prefix }}_repo' | ||
- output['repository_metadata'].repository_description == 'original comment' | ||
# ============================================================ | ||
- name: Create a repository (CHECK MODE) | ||
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo' | ||
- output.repository_metadata.repository_description == 'original comment' | ||
|
||
- name: No-op update to repository | ||
aws_codecommit: | ||
name: "{{ resource_prefix }}_check_repo" | ||
comment: original comment | ||
name: "{{ resource_prefix }}_repo" | ||
description: original comment | ||
state: present | ||
register: output | ||
- assert: | ||
that: | ||
- output is not changed | ||
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo' | ||
- output.repository_metadata.repository_description == 'original comment' | ||
|
||
- name: Update repository description (CHECK MODE) | ||
aws_codecommit: | ||
name: "{{ resource_prefix }}_repo" | ||
description: new comment | ||
state: present | ||
<<: *aws_connection_info | ||
register: output | ||
check_mode: yes | ||
- assert: | ||
that: | ||
- output is changed | ||
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo' | ||
- output.repository_metadata.repository_description == 'original comment' | ||
|
||
- name: Update repository description | ||
aws_codecommit: | ||
name: "{{ resource_prefix }}_repo" | ||
description: new comment | ||
state: present | ||
register: output | ||
- assert: | ||
that: | ||
- output is changed | ||
- output.repository_metadata.repository_name == '{{ resource_prefix }}_repo' | ||
- output.repository_metadata.repository_description == 'new comment' | ||
|
||
# ============================================================ | ||
- name: Delete a repository (CHECK MODE) | ||
aws_codecommit: | ||
name: "{{ resource_prefix }}_repo" | ||
state: absent | ||
<<: *aws_connection_info | ||
register: output | ||
check_mode: yes | ||
- assert: | ||
that: | ||
- output is changed | ||
|
||
- name: Delete a repository | ||
aws_codecommit: | ||
name: "{{ resource_prefix }}_repo" | ||
state: absent | ||
<<: *aws_connection_info | ||
register: output | ||
- assert: | ||
that: | ||
- output is changed | ||
|
||
- name: Delete a non-existent repository | ||
aws_codecommit: | ||
name: "{{ resource_prefix }}_repo" | ||
state: absent | ||
register: output | ||
- assert: | ||
that: | ||
- output is not changed | ||
|
||
always: | ||
###### TEARDOWN STARTS HERE ###### | ||
- name: Delete a repository | ||
aws_codecommit: | ||
name: "{{ resource_prefix }}_repo" | ||
state: absent | ||
<<: *aws_connection_info | ||
ignore_errors: yes |