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

Fixing and adding better logging to purge AWS resources workflow #6246

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/purge-aws-test-resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ env:
AWS_RESOURCE_TYPES: 'AWS::Kinesis::Stream,AWS::S3::Bucket,AWS::RDS::DBInstance,AWS::RDS::DBSubnetGroup,AWS::MemoryDB::Cluster,AWS::MemoryDB::SubnetGroup'
jobs:
purge_aws_resources:
name: AWS resources clean-ups
name: Delete all AWS resources created by tests
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
Expand All @@ -37,10 +37,13 @@ jobs:
aws-region: ${{ env.AWS_REGION }}
- name: Filter and delete resources
run: |
for resource_type in ${${{env.AWS_RESOURCE_TYPES}}//,/ }
RESOURCE_TYPES=${{env.AWS_RESOURCE_TYPES}}
for resource_type in ${RESOURCE_TYPES//,/ }
do
echo "Deleting resources of type $resource_type"
aws cloudcontrol list-resources --type-name "$resource_type" --query "ResourceDescriptions[].Identifier" --output text | tr '\t' '\n' | while read identifier
do
echo "Deleting resource $identifier of type $resource_type"
aws cloudcontrol delete-resource --type-name "$resource_type" --identifier "$identifier"
done
done
done