Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using cloudformation_update_stack and paremeters #118

Open
cwilson21 opened this issue May 26, 2022 · 1 comment
Open

Using cloudformation_update_stack and paremeters #118

cwilson21 opened this issue May 26, 2022 · 1 comment

Comments

@cwilson21
Copy link

When trying to update a cloudformation stack, we specify the parameters we want to update and we get an error about other parameters that need to be updated.

Example of what is specified:

{"ParameterKey": "GlusterDiskSizeParameter","ParameterValue": "450"}

The following error comes when using the above parameters:

botocore.exceptions.ClientError: An error occurred (ValidationError) when calling the UpdateStack operation: Parameters: [RDSUsernameParameter, RDSPasswordParameter, ClusterIDParameter] must have values

However when we call that same function, and add each of those Parameters with "UsePreviousValue": True" we get an error indicating invalid parameters

 "stderr": "st2.actions.python.ActionManager: DEBUG    Calling method \"boto3.cloudformation.update_stack\" with kwargs: {'Parameters': ['{\"ParameterKey\":\"GlusterDiskSizeParameter\"', '\"ParameterValue\":\"450\"}', '{\"ParameterKey\":\"RDSUsernameParameter\"', '\"UsePreviousValue\":true}', '{\"ParameterKey\":\"RDSPasswordParameter\"', '\"UsePreviousValue\":true}', '{\"ParameterKey\":\"ClusterIDParameter\"', '\"UsePreviousValue\":true}'], 'StackName': 'Cluster96518'}\nTraceback (most recent call last):\n  File \"/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py\", line 395, in <module>\n    obj.run()\n  File \"/opt/stackstorm/st2/lib/python3.8/site-packages/python_runner/python_action_wrapper.py\", line 214, in run\n    output = action.run(**self._parameters)\n  File \"/opt/stackstorm/packs/aws/actions/run.py\", line 36, in run\n    return self.do_method(module_path, cls, aws_action, **kwargs)\n  File \"/opt/stackstorm/packs/aws/actions/lib/action.py\", line 224, in do_method\n    resultset = getattr(obj, action)(**kwargs)\n  File \"/opt/stackstorm/virtualenvs/aws/lib/python3.8/site-packages/botocore/client.py\", line 251, in _api_call\n    return self._make_api_call(operation_name, kwargs)\n  File \"/opt/stackstorm/virtualenvs/aws/lib/python3.8/site-packages/botocore/client.py\", line 512, in _make_api_call\n    request_dict = self._convert_to_request_dict(\n  File \"/opt/stackstorm/virtualenvs/aws/lib/python3.8/site-packages/botocore/client.py\", line 565, in _convert_to_request_dict\n    request_dict = self._serializer.serialize_to_request(\n  File \"/opt/stackstorm/virtualenvs/aws/lib/python3.8/site-packages/botocore/validate.py\", line 270, in serialize_to_request\n    raise ParamValidationError(report=report.generate_report())\nbotocore.exceptions.ParamValidationError: Parameter validation failed:\nInvalid type for parameter Parameters[0], value: {\"ParameterKey\":\"GlusterDiskSizeParameter\", type: <class 'str'>, valid types: <class 'dict'>\nInvalid type for parameter Parameters[1], value: \"ParameterValue\":\"450\"}, type: <class 'str'>, valid types: <class 'dict'>\nInvalid type for parameter Parameters[2], value: {\"ParameterKey\":\"RDSUsernameParameter\", type: <class 'str'>, valid types: <class 'dict'>\nInvalid type for parameter Parameters[3], value: \"UsePreviousValue\":true}, type: <class 'str'>, valid types: <class 'dict'>\nInvalid type for parameter Parameters[4], value: {\"ParameterKey\":\"RDSPasswordParameter\", type: <class 'str'>, valid types: <class 'dict'>\nInvalid type for parameter Parameters[5], value: \"UsePreviousValue\":true}, type: <class 'str'>, valid types: <class 'dict'>\nInvalid type for parameter Parameters[6], value: {\"ParameterKey\":\"ClusterIDParameter\", type: <class 'str'>, valid types: <class 'dict'>\nInvalid type for parameter Parameters[7], value: \"UsePreviousValue\":true}, type: <class 'str'>, valid types: <class 'dict'>\n",

We also are selecting to use the existing template as we are just updating and replacing a parameter in it. Any assistance on what we are doing wrong or how to move forward with this would be appreciated.

@cwilson21
Copy link
Author

Figured this out. You have to nest UsePreviousValue under ParameterValue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant