diff --git a/moto/ssm/models.py b/moto/ssm/models.py index d88deb808..1ffc1a9d5 100644 --- a/moto/ssm/models.py +++ b/moto/ssm/models.py @@ -2062,7 +2062,11 @@ class SimpleSystemManagerBackend(BaseBackend): "formed as a mix of letters, numbers and the following 3 symbols .-_" ) raise ValidationException(invalid_prefix_error) - if not parameter_type and not overwrite and not self._parameters[name]: + if ( + not parameter_type + and not overwrite + and not (name in self._parameters and self._parameters[name]) + ): raise ValidationException( "A parameter type is required when you create a parameter." ) diff --git a/tests/test_ssm/test_ssm_boto3.py b/tests/test_ssm/test_ssm_boto3.py index 29aa73ade..9a97573bf 100644 --- a/tests/test_ssm/test_ssm_boto3.py +++ b/tests/test_ssm/test_ssm_boto3.py @@ -448,6 +448,9 @@ def test_put_parameter_no_type(): == "A parameter type is required when you create a parameter." ) + # Ensure backend state is consistent + assert client.describe_parameters() + @mock_ssm def test_update_parameter():