-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MLPAB-2185 - delete index when environment is destroyed (#1290)
- Loading branch information
1 parent
9522f74
commit 1e8f8e3
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -149,3 +149,22 @@ jobs: | |
- name: Remove container insights log group | ||
run: | | ||
aws logs delete-log-group --log-group-name /aws/ecs/containerinsights/${{ needs.generate_environment_workspace_name.outputs.environment_workspace_name }}-eu-west-1/performance | ||
- name: Configure AWS Credentials For opensearch | ||
uses: aws-actions/[email protected] | ||
with: | ||
role-to-assume: arn:aws:iam::653761790766:role/modernising-lpa-github-actions-opensearch-delete-index | ||
aws-region: eu-west-1 | ||
role-duration-seconds: 900 | ||
role-session-name: OPGModernisingOpensearchIndexDeleteGithubAction | ||
- name: Delete opensearch index lpas_v2_${{ needs.generate_environment_workspace_name.outputs.environment_workspace_name }} | ||
run: | | ||
pip install awscurl==0.33 | ||
response=$(awscurl \ | ||
"${{ secrets.DEVELOPMENT_OPENSEARCH_COLLECTION_ENDPOINT }}/lpas_v2_${{ needs.generate_environment_workspace_name.outputs.environment_workspace_name }}" \ | ||
--request DELETE \ | ||
--region eu-west-1 \ | ||
--service aoss | jq -r '.status') | ||
if [[ $response != "200" && $response != "404" ]]; then | ||
echo "Error: Unexpected response status $response" | ||
exit 1 | ||
fi |