diff --git a/sceptre/stack.py b/sceptre/stack.py index f085ced7f..ba96e5816 100644 --- a/sceptre/stack.py +++ b/sceptre/stack.py @@ -305,6 +305,11 @@ def is_valid(value: Any) -> bool: or isinstance(value, Resolver) ) + if not isinstance(parameters, dict): + raise InvalidConfigFileError( + f"{self.name}: parameters must be a dictionary of key-value apirs, got {parameters}" + ) + casted_parameters = {k: cast_value(v) for k, v in parameters.items()} if not all(is_valid(value) for value in casted_parameters.values()): diff --git a/tests/test_stack.py b/tests/test_stack.py index eeddf7451..e67edc49b 100644 --- a/tests/test_stack.py +++ b/tests/test_stack.py @@ -202,6 +202,20 @@ def test_init__invalid_parameters_raise_invalid_config_file_error(self, paramete parameters=parameters, ) + @pytest.mark.parametrize( + "parameters", + [["this", "is", "a", "list"], "a_string"], + ) + def test_init__invalid_parameters__parameters_a_list(self, parameters): + with pytest.raises(InvalidConfigFileError): + Stack( + name="stack_name", + project_code="project_code", + template_handler_config={"type": "file"}, + region="region", + parameters=parameters, + ) + @pytest.mark.parametrize( "parameters", [