Skip to content

Commit

Permalink
Fix cleanup of parameters upon pipeline retirement
Browse files Browse the repository at this point in the history
**Why?**

At the moment, the pipeline deletion process attempts to delete the parameters
at `/deployment/${pipeline_name}/regions`. However, the path it should use
needs to include the source of the pipeline definition. In this case, that is
`S3`. So it should have deleted: `/deployment/S3/${pipeline_name}/regions`.

Additionally, if the parameter is not found, it would mark that as a failure.
While there is nothing to delete if it isn't found, so it should accept that
instead.

**What?**

Fixed path and added a catch to make the ParameterNotFound exception pass
anyway.
  • Loading branch information
sbkok authored and StewartW committed Aug 8, 2023
1 parent 761f332 commit 51ab951
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -603,11 +603,22 @@ Resources:
"DeletePipelineParams": {
"Type": "Task",
"Parameters": {
"Name.$": "States.Format('/deployment/{}/regions', $.pipeline_name)"
"Name.$": "States.Format('/deployment/S3/{}/regions', $.pipeline_name)"
},
"Catch": [
{
"ErrorEquals": "ParameterNotFound",
"Next": "ParameterNotFoundFallback"
}
],
"Resource": "arn:${AWS::Partition}:states:::aws-sdk:ssm:deleteParameter",
"ResultPath": "$.ssm_delete_param.result",
"End": true
},
"ParameterNotFoundFallback": {
"Type": "Pass",
"Result": "Parameter not found, nothing to delete, all good",
"End": true
}
}
},
Expand Down

0 comments on commit 51ab951

Please sign in to comment.