[issue-4283] ssm put_parameter with tags and overwrite should error (#4362)
This commit is contained in:
parent
8c2d0b0557
commit
f50cf51de7
@ -1547,6 +1547,12 @@ class SimpleSystemManagerBackend(BaseBackend):
|
||||
"1 validation error detected: Value '' at 'value' failed to satisfy"
|
||||
" constraint: Member must have length greater than or equal to 1."
|
||||
)
|
||||
if overwrite and tags:
|
||||
raise ValidationException(
|
||||
"Invalid request: tags and overwrite can't be used together. To create a "
|
||||
"parameter with tags, please remove overwrite flag. To update tags for an "
|
||||
"existing parameter, please use AddTagsToResource or RemoveTagsFromResource."
|
||||
)
|
||||
if name.lower().lstrip("/").startswith("aws") or name.lower().lstrip(
|
||||
"/"
|
||||
).startswith("ssm"):
|
||||
|
@ -279,6 +279,19 @@ def test_put_parameter(name):
|
||||
"arn:aws:ssm:us-east-1:{}:parameter/{}".format(ACCOUNT_ID, name)
|
||||
)
|
||||
new_data_type = "aws:ec2:image"
|
||||
|
||||
with pytest.raises(ClientError) as ex:
|
||||
response = client.put_parameter(
|
||||
Name=name,
|
||||
Description="desc 3",
|
||||
Value="value 3",
|
||||
Type="String",
|
||||
Overwrite=True,
|
||||
Tags=[{"Key": "foo", "Value": "bar"}],
|
||||
DataType=new_data_type,
|
||||
)
|
||||
assert ex.value.response["Error"]["Code"] == "ValidationException"
|
||||
|
||||
response = client.put_parameter(
|
||||
Name=name,
|
||||
Description="desc 3",
|
||||
|
Loading…
Reference in New Issue
Block a user