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

Update matching for aws-nuke #93

Merged
merged 3 commits into from
Jun 30, 2020
Merged
Show file tree
Hide file tree
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
27 changes: 22 additions & 5 deletions .github/aws-nuke.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
regions:
#- us-east-1
- us-east-2
#- us-west-1
#- us-west-2

account-blacklist:
- "999999999999" # production
Expand Down Expand Up @@ -30,6 +32,8 @@ resource-types:
- ELBLoadBalancer
- ELBv2
- ELBv2TargetGroup
- LambdaFunction
- LambdaEventSourceMapping

# don't nuke IAM users
excludes:
Expand Down Expand Up @@ -71,6 +75,14 @@ presets:
value: "true"
IAMRole:
- "OrganizationAccountAccessRole"
EC2SecurityGroup:
- property: "Name"
type: "regex"
value: "^fargate-default$"
EC2NetworkInterface:
- property: "tag:Name"
type: "regex"
value: "^$"

cpco:
filters:
Expand All @@ -91,9 +103,12 @@ presets:
type: "regex"
value: "^cpco-.*"
EC2SecurityGroup:
- property: "tag:Name"
- property: "Name"
type: "regex"
value: "^cpco-.*"
- property: "tag:Name"
type: "regex"
value: "^fargate-default$"
EC2Instance:
- property: "tag:Name"
type: "regex"
Expand Down Expand Up @@ -139,10 +154,12 @@ presets:
type: "regex"
value: "^cpco-.*"
ELBv2:
- property: "tag:Name"
type: "regex"
- type: "regex"
value: "^cpco-.*"
- type: "regex"
value: "^atlantis$"
ELBv2TargetGroup:
- property: "tag:Name"
type: "regex"
- type: "regex"
value: "^cpco-.*"
- type: "regex"
value: ".*atlantis.*"
24 changes: 21 additions & 3 deletions .github/workflows/aws-nuke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,34 @@ name: 'aws-nuke'

on:
# Enable pull request for testing
#pull_request:
# types: [opened, synchronize, reopened]
pull_request:
types: [opened, synchronize, reopened]

# Nuke testing account nightly
schedule:
- cron: '0 0 * * *'

jobs:
update:
# Run aws-nuke simulation (don't actually delete anything)
dry-run:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}
steps:
- name: checkout
uses: actions/checkout@v1
- name: aws-nuke
uses: "docker://quay.io/rebuy/aws-nuke:v2.14.0"
with:
args: "--config .github/aws-nuke.yaml --force"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
AWS_SECRET_KEY: "${{ secrets.AWS_SECRET_KEY }}"

# Run aws-nuke "for reals" (delete everything)
no-dry-run:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'schedule' }}
steps:
- name: checkout
uses: actions/checkout@v1
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ install:
## Start the geodesic shell by calling wrapper script
run:
$(SCRIPT)

nuke:
docker run -it -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -v $(CURDIR)/.github:/.github quay.io/rebuy/aws-nuke:v2.14.0 --config /.github/aws-nuke.yaml --force --no-dry-run

nuke-dryrun:
docker run -it -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN -v $(CURDIR)/.github:/.github quay.io/rebuy/aws-nuke:v2.14.0 --config /.github/aws-nuke.yaml --force