Skip to content

Commit

Permalink
MLPAB-2185 - delete index when environment is destroyed (#1290)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpearce-digital authored Jun 10, 2024
1 parent 9522f74 commit 1e8f8e3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/workflow_destroy_pr_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1e8f8e3

Please sign in to comment.