create CloudFormation outputs and enable 'Fn::GetAtt' to work.
This commit is contained in:
parent
832769b8a7
commit
1d9ffafaa5
10 changed files with 269 additions and 8 deletions
|
|
@ -9,6 +9,7 @@ from boto.ec2.instance import Instance as BotoInstance, Reservation
|
|||
from boto.ec2.blockdevicemapping import BlockDeviceMapping, BlockDeviceType
|
||||
from boto.ec2.spotinstancerequest import SpotInstanceRequest as BotoSpotRequest
|
||||
from boto.ec2.launchspecification import LaunchSpecification
|
||||
from boto.exception import BotoServerError
|
||||
|
||||
from moto.core import BaseBackend
|
||||
from moto.core.models import Model
|
||||
|
|
@ -185,6 +186,15 @@ class NetworkInterface(object):
|
|||
else:
|
||||
return self._group_set
|
||||
|
||||
def get_cfn_attribute(self, attribute_name):
|
||||
if attribute_name == 'PrimaryPrivateIpAddress':
|
||||
return self.private_ip_address
|
||||
elif attribute_name == 'SecondaryPrivateIpAddresses':
|
||||
raise NotImplementedError('"Fn::GetAtt" : [ "{0}" , "SecondaryPrivateIpAddresses" ]"')
|
||||
raise BotoServerError(400,
|
||||
'Bad Request',
|
||||
'Template error: resource {0} does not support attribute type {1} in Fn::GetAtt')
|
||||
|
||||
|
||||
class NetworkInterfaceBackend(object):
|
||||
def __init__(self):
|
||||
|
|
@ -412,6 +422,21 @@ class Instance(BotoInstance, TaggedEC2Resource):
|
|||
eni.attachment_id = None
|
||||
eni.device_index = None
|
||||
|
||||
def get_cfn_attribute(self, attribute_name):
|
||||
if attribute_name == 'AvailabilityZone':
|
||||
return self.placement
|
||||
elif attribute_name == 'PrivateDnsName':
|
||||
return self.private_dns_name
|
||||
elif attribute_name == 'PublicDnsName':
|
||||
return self.public_dns_name
|
||||
elif attribute_name == 'PrivateIp':
|
||||
return self.private_ip_address
|
||||
elif attribute_name == 'PublicIp':
|
||||
return self.ip_address
|
||||
raise BotoServerError(400,
|
||||
'Bad Request',
|
||||
'Template error: resource {0} does not support attribute type {1} in Fn::GetAtt')
|
||||
|
||||
|
||||
class InstanceBackend(object):
|
||||
|
||||
|
|
@ -971,6 +996,13 @@ class SecurityGroup(object):
|
|||
return False
|
||||
return True
|
||||
|
||||
def get_cfn_attribute(self, attribute_name):
|
||||
if attribute_name == 'GroupId':
|
||||
return self.id
|
||||
raise BotoServerError(400,
|
||||
'Bad Request',
|
||||
'Template error: resource {0} does not support attribute type {1} in Fn::GetAtt')
|
||||
|
||||
|
||||
class SecurityGroupBackend(object):
|
||||
|
||||
|
|
@ -1494,6 +1526,13 @@ class Subnet(TaggedEC2Resource):
|
|||
|
||||
return filter_value
|
||||
|
||||
def get_cfn_attribute(self, attribute_name):
|
||||
if attribute_name == 'AvailabilityZone':
|
||||
raise NotImplementedError('"Fn::GetAtt" : [ "{0}" , "AvailabilityZone" ]"')
|
||||
raise BotoServerError(400,
|
||||
'Bad Request',
|
||||
'Template error: resource {0} does not support attribute type {1} in Fn::GetAtt')
|
||||
|
||||
|
||||
class SubnetBackend(object):
|
||||
def __init__(self):
|
||||
|
|
@ -1929,6 +1968,13 @@ class ElasticAddress(object):
|
|||
def physical_resource_id(self):
|
||||
return self.allocation_id
|
||||
|
||||
def get_cfn_attribute(self, attribute_name):
|
||||
if attribute_name == 'AllocationId':
|
||||
return self.allocation_id
|
||||
raise BotoServerError(400,
|
||||
'Bad Request',
|
||||
'Template error: resource {0} does not support attribute type {1} in Fn::GetAtt')
|
||||
|
||||
|
||||
class ElasticAddressBackend(object):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue