Skip to content

Commit

Permalink
Various ARN handling fixes (ansible-collections#1848)
Browse files Browse the repository at this point in the history
Various ARN handling fixes

Depends-On: ansible-collections#1619
SUMMARY
fixes: ansible-collections#1846
Various modules had hard-coded ARN handling which assumed the use of the main  partition.  This causes problems for folks using Gov Cloud (and aws-cn)
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/modules/batch_compute_environment.py
plugins/modules/ec2_launch_template.py
plugins/modules/elasticache_info.py
plugins/modules/iam_group.py
plugins/modules/iam_role.py
plugins/modules/msk_config.py
plugins/modules/redshift.py
plugins/modules/sns_topic.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@25a636c
  • Loading branch information
tremble authored and abikouo committed Oct 18, 2024
1 parent a14f58c commit 7ed29d2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/modules/ec2_launch_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@
type: int
"""

import re
from uuid import uuid4

try:
Expand All @@ -436,6 +435,7 @@
from ansible.module_utils.common.dict_transformations import camel_dict_to_snake_dict
from ansible.module_utils.common.dict_transformations import snake_dict_to_camel_dict

from ansible_collections.amazon.aws.plugins.module_utils.arn import validate_aws_arn
from ansible_collections.amazon.aws.plugins.module_utils.botocore import is_boto3_error_code
from ansible_collections.amazon.aws.plugins.module_utils.retries import AWSRetry
from ansible_collections.amazon.aws.plugins.module_utils.tagging import ansible_dict_to_boto3_tag_list
Expand All @@ -446,7 +446,7 @@


def determine_iam_role(module, name_or_arn):
if re.match(r"^arn:aws:iam::\d+:instance-profile/[\w+=/,.@-]+$", name_or_arn):
if validate_aws_arn(name_or_arn, service="iam", resource_type="instance-profile"):
return {"arn": name_or_arn}
iam = module.client("iam", retry_decorator=AWSRetry.jittered_backoff())
try:
Expand Down

0 comments on commit 7ed29d2

Please sign in to comment.