Skip to content

Commit

Permalink
Merge branch 'ansible-collections:main' into wip-connection-ssm-encry…
Browse files Browse the repository at this point in the history
…pted-uploads
  • Loading branch information
fh-maxime-froment authored Oct 19, 2021
2 parents 215d685 + 81d9abd commit b2a7c35
Show file tree
Hide file tree
Showing 61 changed files with 2,839 additions and 1,752 deletions.
2 changes: 2 additions & 0 deletions changelogs/767-iam_role-add-waiter-support.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- iam_role - Added `wait` option for IAM role creation / updates (https://github.com/ansible-collections/community.aws/pull/767).
4 changes: 4 additions & 0 deletions changelogs/fragments/332-ec2_eip-tagging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
minor_changes:
- ec2_eip - added support for tagging EIPs (https://github.com/ansible-collections/community.aws/pull/332).
- ec2_eip_info - added support for tagging EIPs (https://github.com/ansible-collections/community.aws/pull/332).
- ec2_eip_info - added automatic retries for common temporary API failures (https://github.com/ansible-collections/community.aws/pull/332).
2 changes: 2 additions & 0 deletions changelogs/fragments/741-ecs_taskdefinition-placement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- ecs_taskdefinition - add ``placement_constraints`` option (https://github.com/ansible-collections/community.aws/pull/741).
2 changes: 2 additions & 0 deletions changelogs/fragments/753-dynamodb-billing_mode.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- dynamodb_table - add support for setting the `billing_mode` option (https://github.com/ansible-collections/community.aws/pull/753).
2 changes: 2 additions & 0 deletions changelogs/fragments/759-ec2_win_password.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- ec2_win_password - module updated to use the boto3 AWS SDK (https://github.com/ansible-collections/community.aws/pull/759).
18 changes: 18 additions & 0 deletions changelogs/fragments/764-awsretry-backoff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
minor_changes:
- aws_config_delivery_channel - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- aws_direct_connect_confirm_connection - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- aws_direct_connect_connection - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- aws_direct_connect_link_aggregation_group - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- aws_direct_connect_virtual_interface - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- aws_inspector_target - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- aws_kms - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- aws_kms_info - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- cloudformation_stack_set - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- dms_endpoint - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- dms_replication_subnet_group - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- ec2_asg - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- ec2_elb_info - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- ecs_service_info - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- iam_managed_policy - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- iam_saml_federation - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
- rds - replaced use of deprecated backoff decorator (https://github.com/ansible-collections/community.aws/pull/764).
2 changes: 2 additions & 0 deletions changelogs/fragments/765-route53_health_check-tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- route53_health_check - add support for tagging health checks (https://github.com/ansible-collections/community.aws/pull/765).
3 changes: 3 additions & 0 deletions plugins/module_utils/route53.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@


def manage_tags(module, client, resource_type, resource_id, new_tags, purge_tags):
if new_tags is None:
return False

old_tags = get_tags(module, client, resource_type, resource_id)
tags_to_set, tags_to_delete = compare_aws_tags(old_tags, new_tags, purge_tags=purge_tags)

Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/aws_config_delivery_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

# this waits for an IAM role to become fully available, at the cost of
# taking a long time to fail when the IAM role/policy really is invalid
retry_unavailable_iam_on_put_delivery = AWSRetry.backoff(
retry_unavailable_iam_on_put_delivery = AWSRetry.jittered_backoff(
catch_extra_error_codes=['InsufficientDeliveryPolicyException'],
)

Expand Down
4 changes: 2 additions & 2 deletions plugins/modules/aws_direct_connect_confirm_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
from ansible_collections.amazon.aws.plugins.module_utils.direct_connect import DirectConnectError
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry

retry_params = {"tries": 10, "delay": 5, "backoff": 1.2, "catch_extra_error_codes": ["DirectConnectClientException"]}
retry_params = {"retries": 10, "delay": 5, "backoff": 1.2, "catch_extra_error_codes": ["DirectConnectClientException"]}


@AWSRetry.backoff(**retry_params)
@AWSRetry.jittered_backoff(**retry_params)
def describe_connections(client, params):
return client.describe_connections(**params)

Expand Down
10 changes: 5 additions & 5 deletions plugins/modules/aws_direct_connect_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
from ansible_collections.amazon.aws.plugins.module_utils.direct_connect import disassociate_connection_and_lag
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry

retry_params = {"tries": 10, "delay": 5, "backoff": 1.2, "catch_extra_error_codes": ["DirectConnectClientException"]}
retry_params = {"retries": 10, "delay": 5, "backoff": 1.2, "catch_extra_error_codes": ["DirectConnectClientException"]}


def connection_status(client, connection_id):
Expand All @@ -179,7 +179,7 @@ def connection_exists(client, connection_id=None, connection_name=None, verify=T
if connection_id:
params['connectionId'] = connection_id
try:
response = AWSRetry.backoff(**retry_params)(client.describe_connections)(**params)
response = AWSRetry.jittered_backoff(**retry_params)(client.describe_connections)(**params)
except (BotoCoreError, ClientError) as e:
if connection_id:
msg = "Failed to describe DirectConnect ID {0}".format(connection_id)
Expand Down Expand Up @@ -227,7 +227,7 @@ def create_connection(client, location, bandwidth, name, lag_id):
params['lagId'] = lag_id

try:
connection = AWSRetry.backoff(**retry_params)(client.create_connection)(**params)
connection = AWSRetry.jittered_backoff(**retry_params)(client.create_connection)(**params)
except (BotoCoreError, ClientError) as e:
raise DirectConnectError(msg="Failed to create DirectConnect connection {0}".format(name),
last_traceback=traceback.format_exc(),
Expand All @@ -242,7 +242,7 @@ def changed_properties(current_status, location, bandwidth):
return current_bandwidth != bandwidth or current_location != location


@AWSRetry.backoff(**retry_params)
@AWSRetry.jittered_backoff(**retry_params)
def update_associations(client, latest_state, connection_id, lag_id):
changed = False
if 'lagId' in latest_state and lag_id != latest_state['lagId']:
Expand Down Expand Up @@ -277,7 +277,7 @@ def ensure_present(client, connection_id, connection_name, location, bandwidth,
return False, connection_id


@AWSRetry.backoff(**retry_params)
@AWSRetry.jittered_backoff(**retry_params)
def ensure_absent(client, connection_id):
changed = False
if connection_id:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def delete_lag(client, lag_id):
exception=e)


@AWSRetry.backoff(tries=5, delay=2, backoff=2.0, catch_extra_error_codes=['DirectConnectClientException'])
@AWSRetry.jittered_backoff(retries=5, delay=2, backoff=2.0, catch_extra_error_codes=['DirectConnectClientException'])
def _update_lag(client, lag_id, lag_name, min_links):
params = {}
if min_links:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/aws_direct_connect_virtual_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def try_except_ClientError(failure_msg):
def wrapper(f):
def run_func(*args, **kwargs):
try:
result = AWSRetry.backoff(tries=8, delay=5, catch_extra_error_codes=['DirectConnectClientException'])(f)(*args, **kwargs)
result = AWSRetry.jittered_backoff(retries=8, delay=5, catch_extra_error_codes=['DirectConnectClientException'])(f)(*args, **kwargs)
except (ClientError, BotoCoreError) as e:
raise DirectConnectError(failure_msg, traceback.format_exc(), e)
return result
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/aws_inspector_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
pass # caught by AnsibleAWSModule


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def main():
argument_spec = dict(
name=dict(required=True),
Expand Down
26 changes: 13 additions & 13 deletions plugins/modules/aws_kms.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
- (deprecated) Grant or deny access.
- Used for modifying the Key Policy rather than modifying a grant and only
works on the default policy created through the AWS Console.
- This option has been deprecated, and will be removed in 2.13. Use I(policy) instead.
- This option has been deprecated, and will be removed in a release after 2021-12-01. Use I(policy) instead.
default: grant
choices: [ grant, deny ]
aliases:
Expand All @@ -56,7 +56,7 @@
- One of I(policy_role_name) or I(policy_role_arn) are required.
- Used for modifying the Key Policy rather than modifying a grant and only
works on the default policy created through the AWS Console.
- This option has been deprecated, and will be removed in 2.13. Use I(policy) instead.
- This option has been deprecated, and will be removed in a release after 2021-12-01. Use I(policy) instead.
required: false
aliases:
- role_name
Expand All @@ -67,7 +67,7 @@
- One of I(policy_role_name) or I(policy_role_arn) are required.
- Used for modifying the Key Policy rather than modifying a grant and only
works on the default policy created through the AWS Console.
- This option has been deprecated, and will be removed in 2.13. Use I(policy) instead.
- This option has been deprecated, and will be removed in a release after 2021-12-01. Use I(policy) instead.
type: str
required: false
aliases:
Expand All @@ -78,7 +78,7 @@
- Required when I(policy_mode=grant).
- Used for modifying the Key Policy rather than modifying a grant and only
works on the default policy created through the AWS Console.
- This option has been deprecated, and will be removed in 2.13. Use I(policy) instead.
- This option has been deprecated, and will be removed in a release after 2021-12-01. Use I(policy) instead.
required: false
aliases:
- grant_types
Expand All @@ -90,7 +90,7 @@
- Only cleans if changes are being made.
- Used for modifying the Key Policy rather than modifying a grant and only
works on the default policy created through the AWS Console.
- This option has been deprecated, and will be removed in 2.13. Use I(policy) instead.
- This option has been deprecated, and will be removed in a release after 2021-12-01. Use I(policy) instead.
type: bool
default: true
aliases:
Expand Down Expand Up @@ -434,19 +434,19 @@
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import compare_policies


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_iam_roles_with_backoff(connection):
paginator = connection.get_paginator('list_roles')
return paginator.paginate().build_full_result()


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_kms_keys_with_backoff(connection):
paginator = connection.get_paginator('list_keys')
return paginator.paginate().build_full_result()


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_kms_aliases_with_backoff(connection):
paginator = connection.get_paginator('list_aliases')
return paginator.paginate().build_full_result()
Expand All @@ -465,30 +465,30 @@ def get_kms_aliases_lookup(connection):
return _aliases


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_kms_tags_with_backoff(connection, key_id, **kwargs):
return connection.list_resource_tags(KeyId=key_id, **kwargs)


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_kms_grants_with_backoff(connection, key_id):
params = dict(KeyId=key_id)
paginator = connection.get_paginator('list_grants')
return paginator.paginate(**params).build_full_result()


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_kms_metadata_with_backoff(connection, key_id):
return connection.describe_key(KeyId=key_id)


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def list_key_policies_with_backoff(connection, key_id):
paginator = connection.get_paginator('list_key_policies')
return paginator.paginate(KeyId=key_id).build_full_result()


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_key_policy_with_backoff(connection, key_id, policy_name):
return connection.get_key_policy(KeyId=key_id, PolicyName=policy_name)

Expand Down
16 changes: 8 additions & 8 deletions plugins/modules/aws_kms_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@
_aliases = dict()


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_kms_keys_with_backoff(connection):
paginator = connection.get_paginator('list_keys')
return paginator.paginate().build_full_result()


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_kms_aliases_with_backoff(connection):
paginator = connection.get_paginator('list_aliases')
return paginator.paginate().build_full_result()
Expand All @@ -286,12 +286,12 @@ def get_kms_aliases_lookup(connection):
return _aliases


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_kms_tags_with_backoff(connection, key_id, **kwargs):
return connection.list_resource_tags(KeyId=key_id, **kwargs)


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_kms_grants_with_backoff(connection, key_id, **kwargs):
params = dict(KeyId=key_id)
if kwargs.get('tokens'):
Expand All @@ -300,23 +300,23 @@ def get_kms_grants_with_backoff(connection, key_id, **kwargs):
return paginator.paginate(**params).build_full_result()


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_kms_metadata_with_backoff(connection, key_id):
return connection.describe_key(KeyId=key_id)


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def list_key_policies_with_backoff(connection, key_id):
paginator = connection.get_paginator('list_key_policies')
return paginator.paginate(KeyId=key_id).build_full_result()


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_key_policy_with_backoff(connection, key_id, policy_name):
return connection.get_key_policy(KeyId=key_id, PolicyName=policy_name)


@AWSRetry.backoff(tries=5, delay=5, backoff=2.0)
@AWSRetry.jittered_backoff(retries=5, delay=5, backoff=2.0)
def get_enable_key_rotation_with_backoff(connection, key_id):
try:
current_rotation_status = connection.get_key_rotation_status(KeyId=key_id)
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cloudformation_stack_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def compare_stack_instances(cfn, stack_set_name, accounts, regions):
return (desired_stack_instances - existing_stack_instances), existing_stack_instances, (existing_stack_instances - desired_stack_instances)


@AWSRetry.backoff(tries=3, delay=4)
@AWSRetry.jittered_backoff(retries=3, delay=4)
def stack_set_facts(cfn, stack_set_name):
try:
ss = cfn.describe_stack_set(StackSetName=stack_set_name)['StackSet']
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/cloudfront_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
# When the module is called as cloudfront_facts, return values are published
# in ansible_facts['cloudfront'][<id>] and can be used as follows.
# Note that this is deprecated and will stop working in Ansible 2.13.
# Note that this is deprecated and will stop working in a release after 2021-12-01.
- name: Gather facts
community.aws.cloudfront_facts:
distribution: true
Expand Down
12 changes: 6 additions & 6 deletions plugins/modules/dms_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@
from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule
from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry

backoff_params = dict(tries=5, delay=1, backoff=1.5)
backoff_params = dict(retries=5, delay=1, backoff=1.5)


@AWSRetry.backoff(**backoff_params)
@AWSRetry.jittered_backoff(**backoff_params)
def describe_endpoints(connection, endpoint_identifier):
""" checks if the endpoint exists """
try:
Expand All @@ -189,7 +189,7 @@ def describe_endpoints(connection, endpoint_identifier):
return {'Endpoints': []}


@AWSRetry.backoff(**backoff_params)
@AWSRetry.jittered_backoff(**backoff_params)
def dms_delete_endpoint(client, **params):
"""deletes the DMS endpoint based on the EndpointArn"""
if module.params.get('wait'):
Expand All @@ -198,19 +198,19 @@ def dms_delete_endpoint(client, **params):
return client.delete_endpoint(**params)


@AWSRetry.backoff(**backoff_params)
@AWSRetry.jittered_backoff(**backoff_params)
def dms_create_endpoint(client, **params):
""" creates the DMS endpoint"""
return client.create_endpoint(**params)


@AWSRetry.backoff(**backoff_params)
@AWSRetry.jittered_backoff(**backoff_params)
def dms_modify_endpoint(client, **params):
""" updates the endpoint"""
return client.modify_endpoint(**params)


@AWSRetry.backoff(**backoff_params)
@AWSRetry.jittered_backoff(**backoff_params)
def get_endpoint_deleted_waiter(client):
return client.get_waiter('endpoint_deleted')

Expand Down
Loading

0 comments on commit b2a7c35

Please sign in to comment.