add UsePreviousValue support for parameters when updating a CloudFormation stack (#1504)
This commit is contained in:
parent
d55ff20685
commit
c13f77173f
2 changed files with 37 additions and 3 deletions
|
|
@ -276,6 +276,33 @@ def test_create_stack_from_s3_url():
|
|||
json.loads(dummy_template_json, object_pairs_hook=OrderedDict))
|
||||
|
||||
|
||||
@mock_cloudformation
|
||||
def test_update_stack_with_previous_value():
|
||||
name = 'update_stack_with_previous_value'
|
||||
cf_conn = boto3.client('cloudformation', region_name='us-east-1')
|
||||
cf_conn.create_stack(
|
||||
StackName=name, TemplateBody=dummy_template_yaml_with_ref,
|
||||
Parameters=[
|
||||
{'ParameterKey': 'TagName', 'ParameterValue': 'foo'},
|
||||
{'ParameterKey': 'TagDescription', 'ParameterValue': 'bar'},
|
||||
]
|
||||
)
|
||||
cf_conn.update_stack(
|
||||
StackName=name, UsePreviousTemplate=True,
|
||||
Parameters=[
|
||||
{'ParameterKey': 'TagName', 'UsePreviousValue': True},
|
||||
{'ParameterKey': 'TagDescription', 'ParameterValue': 'not bar'},
|
||||
]
|
||||
)
|
||||
stack = cf_conn.describe_stacks(StackName=name)['Stacks'][0]
|
||||
tag_name = [x['ParameterValue'] for x in stack['Parameters']
|
||||
if x['ParameterKey'] == 'TagName'][0]
|
||||
tag_desc = [x['ParameterValue'] for x in stack['Parameters']
|
||||
if x['ParameterKey'] == 'TagDescription'][0]
|
||||
assert tag_name == 'foo'
|
||||
assert tag_desc == 'not bar'
|
||||
|
||||
|
||||
@mock_cloudformation
|
||||
@mock_s3
|
||||
@mock_ec2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue