summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSloane Hertel <shertel@redhat.com>2017-10-26 19:07:19 -0400
committerWill Thames <will@thames.id.au>2017-10-27 09:07:19 +1000
commit2a42800c44aa876427118d3daf6061e09dd850ae (patch)
tree537512283ba5d6857513a65c42bab917e59de0ab
parent56efcb1b72b4d3188011c89c377281a7c2c6626a (diff)
downloadansible-2a42800c44aa876427118d3daf6061e09dd850ae.tar.gz
An availability zone will be selected if none is provided. Set az to an empty string if it's None to avoid traceback. (#32216)
-rw-r--r--lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py b/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py
index 6248a2bce3..cf0a9521fe 100644
--- a/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py
+++ b/lib/ansible/modules/cloud/amazon/ec2_vpc_subnet.py
@@ -124,6 +124,9 @@ def subnet_exists(conn, subnet_id):
def create_subnet(conn, module, vpc_id, cidr, az, check_mode):
try:
+ # Specifying the availability zone is optional.
+ if not az:
+ az = ''
new_subnet = get_subnet_info(conn.create_subnet(VpcId=vpc_id, CidrBlock=cidr, AvailabilityZone=az))
# Sometimes AWS takes its time to create a subnet and so using
# new subnets's id to do things like create tags results in