|
|
@ -126,6 +126,7 @@ def get_subnet_info(subnet):
|
|
|
|
|
|
|
|
|
|
|
|
return subnet_info
|
|
|
|
return subnet_info
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def subnet_exists(vpc_conn, subnet_id):
|
|
|
|
def subnet_exists(vpc_conn, subnet_id):
|
|
|
|
filters = {'subnet-id': subnet_id}
|
|
|
|
filters = {'subnet-id': subnet_id}
|
|
|
|
subnet = vpc_conn.get_all_subnets(filters=filters)
|
|
|
|
subnet = vpc_conn.get_all_subnets(filters=filters)
|
|
|
@ -149,6 +150,8 @@ def create_subnet(vpc_conn, vpc_id, cidr, az, check_mode):
|
|
|
|
except EC2ResponseError as e:
|
|
|
|
except EC2ResponseError as e:
|
|
|
|
if e.error_code == "DryRunOperation":
|
|
|
|
if e.error_code == "DryRunOperation":
|
|
|
|
subnet = None
|
|
|
|
subnet = None
|
|
|
|
|
|
|
|
elif e.error_code == "InvalidSubnet.Conflict":
|
|
|
|
|
|
|
|
raise AnsibleVPCSubnetCreationException("%s: the CIDR %s conflicts with another subnet with the VPC ID %s." % (e.error_code, cidr, vpc_id))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise AnsibleVPCSubnetCreationException(
|
|
|
|
raise AnsibleVPCSubnetCreationException(
|
|
|
|
'Unable to create subnet {0}, error: {1}'.format(cidr, e))
|
|
|
|
'Unable to create subnet {0}, error: {1}'.format(cidr, e))
|
|
|
|