Add physical_resource_id to ECS task definition
This commit is contained in:
parent
5fe575b6ed
commit
4636a2afc3
@ -109,6 +109,10 @@ class TaskDefinition(BaseObject):
|
|||||||
del response_object['arn']
|
del response_object['arn']
|
||||||
return response_object
|
return response_object
|
||||||
|
|
||||||
|
@property
|
||||||
|
def physical_resource_id(self):
|
||||||
|
return self.arn
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):
|
def create_from_cloudformation_json(cls, resource_name, cloudformation_json, region_name):
|
||||||
properties = cloudformation_json['Properties']
|
properties = cloudformation_json['Properties']
|
||||||
|
@ -1319,15 +1319,20 @@ def test_create_task_definition_through_cloudformation():
|
|||||||
}
|
}
|
||||||
template_json = json.dumps(template)
|
template_json = json.dumps(template)
|
||||||
cfn_conn = boto3.client('cloudformation', region_name='us-west-1')
|
cfn_conn = boto3.client('cloudformation', region_name='us-west-1')
|
||||||
|
stack_name = 'test_stack'
|
||||||
cfn_conn.create_stack(
|
cfn_conn.create_stack(
|
||||||
StackName="test_stack",
|
StackName=stack_name,
|
||||||
TemplateBody=template_json,
|
TemplateBody=template_json,
|
||||||
)
|
)
|
||||||
|
|
||||||
ecs_conn = boto3.client('ecs', region_name='us-west-1')
|
ecs_conn = boto3.client('ecs', region_name='us-west-1')
|
||||||
resp = ecs_conn.list_task_definitions()
|
resp = ecs_conn.list_task_definitions()
|
||||||
len(resp['taskDefinitionArns']).should.equal(1)
|
len(resp['taskDefinitionArns']).should.equal(1)
|
||||||
|
task_definition_arn = resp['taskDefinitionArns'][0]
|
||||||
|
|
||||||
|
task_definition_details = cfn_conn.describe_stack_resource(
|
||||||
|
StackName=stack_name,LogicalResourceId='testTaskDefinition')['StackResourceDetail']
|
||||||
|
task_definition_details['PhysicalResourceId'].should.equal(task_definition_arn)
|
||||||
|
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
@mock_ecs
|
@mock_ecs
|
||||||
|
Loading…
Reference in New Issue
Block a user