Skip to content

Commit

Permalink
Nuke gruntwork S3 buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
yorinasub17 committed Oct 14, 2020
1 parent b3be887 commit 25c3de7
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
19 changes: 19 additions & 0 deletions .circleci/cloud_nuke_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
s3:
include:
names_regex:
- '^cloudfront-example-[a-zA-Z0-9]{6}\.gruntwork\.in.*'
- '^acme-stage-static-[a-z0-9]{6}\.gruntwork\.in(-((logs)|(cloudfront-logs)))?$'
- '^gruntwork-terratest-[a-zA-Z0-9]{6}$'
- '^gw-cis-aws-config-all-regions-[a-zA-Z0-9]{6}-.*'
- '^houston-static-[a-zA-Z0-9]{12}.*'
- '^cloud-nuke-test-[a-z0-9]{12}'
- '^zookeeper-cluster-test-[a-z0-9]{6}'
- '^kafka-zk-standalone-[a-z0-9]{6}'
- '^nlb-testnlbaccesslogs[a-z0-9]{6}-access-logs'
- '^terragrunt-test-bucket-[a-z0-9]{6}'
- '^[a-z0-9]{6}-service-test-s3-bucket'
- '^[a-z0-9]{6}-ecs-service-test-s3-bucket'
- '^vault-module-test-[a-z0-9]{6}'
- '^tst-openvpn-[a-z0-9]{6}'
- '^openvpn-test-[a-z0-9]{6}'
- '^gruntwork-test-[a-z0-9]{6}-config-test$'
20 changes: 6 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ jobs:
- checkout
- run:
command: |
# We explicitly list the resource types we want to nuke, as we are not ready to nuke some resource types in
# the AWS account we use at Gruntwork for testing (Phx DevOps) (e.g., S3)
# We use a config file to ensure that we only nuke the resources that we know relate to testing.
go run main.go aws \
--older-than 1h \
--force \
--exclude-resource-type s3
--config ./.circleci/cloud_nuke_config.yml
no_output_timeout: 1h

nuke_sandbox:
Expand All @@ -44,12 +43,11 @@ jobs:
command: |
export AWS_ACCESS_KEY_ID=$SANDBOX_AWS_ACCESS_KEY_ID
export AWS_SECRET_ACCESS_KEY=$SANDBOX_AWS_SECRET_ACCESS_KEY
# We explicitly list the resource types we want to nuke, as we are not ready to nuke some resource types in
# the AWS account we use at Gruntwork for testing (Sandbox) (e.g., S3)
# We use a config file to ensure that we only nuke the resources that we know relate to testing.
go run main.go aws \
--older-than 24h \
--force \
--exclude-resource-type s3
--config ./.circleci/cloud_nuke_config.yml
no_output_timeout: 1h

deploy:
Expand Down Expand Up @@ -92,10 +90,7 @@ workflows:
branches:
only: master
jobs:
- test
- nuke_phx_devops:
requires:
- test
- nuke_phx_devops

nightly:
triggers:
Expand All @@ -105,7 +100,4 @@ workflows:
branches:
only: master
jobs:
- test
- nuke_sandbox:
requires:
- test
- nuke_sandbox

0 comments on commit 25c3de7

Please sign in to comment.