Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6542114
Bump github.com/aws/aws-sdk-go from 1.44.295 to 1.44.307 (#1052)
dependabot[bot] Jul 25, 2023
6ebac13
Bump github.com/aws/aws-sdk-go from 1.44.307 to 1.44.313 (#1061)
dependabot[bot] Aug 2, 2023
529f885
Support for TGW Attachment Peering resources (#996)
alemuro Aug 2, 2023
06a0dfe
Enable aws-cn by setting the default partition correctly (#1042)
ganhuang Aug 2, 2023
93f09c3
kms-keys: Skip keys already in pending replica deletion state (#1046)
jbmchuck Aug 2, 2023
8ecf7cc
feat: Adding tag properties to EC2DefaultSecurityGroupRule resource (…
gdbranco Aug 2, 2023
34899fb
Fix date format for ASG creationDate (#1014)
vboulineau Aug 2, 2023
47fc6c7
Add formatting check to GitHub Actions (#1063)
der-eismann Aug 2, 2023
2bef99a
appconfig: add support for five resources (#1055)
tbarrella Aug 2, 2023
90ad6c4
ecs: list all services, not just 10 (#1056)
tbarrella Aug 2, 2023
d01537a
Adding CloudFrontOriginRequestPolicy resources. (#1051)
MikeSchouw Aug 3, 2023
4d7b18b
Bump github.com/aws/aws-sdk-go from 1.44.313 to 1.44.318 (#1066)
dependabot[bot] Aug 8, 2023
42a68a3
Group Golang dependabot updates (#1070)
der-eismann Aug 15, 2023
df499d5
Filter main route tables (#953)
leighpascoe Aug 15, 2023
955a8f4
Bump the golang group with 1 update (#1071)
dependabot[bot] Aug 15, 2023
96d3e60
Update readme for v2.24.0 release (#1072)
github-actions[bot] Aug 15, 2023
b873fb3
app config: fix max results 100 -> 50 (#1075)
tbarrella Aug 16, 2023
f4030b9
Update readme for v2.24.1 release (#1076)
github-actions[bot] Aug 16, 2023
b044caf
Updating detection filters.
swhite-oreilly Aug 17, 2023
3472f9d
Bump the golang group with 2 updates (#1080)
dependabot[bot] Aug 22, 2023
db11768
Adding filters for key-phrases and dominant-language
swhite-oreilly Aug 22, 2023
7b51b7f
Adding pii entitites and sentiment detection job support.
swhite-oreilly Aug 22, 2023
eeb2e17
Adding events detection job support.
swhite-oreilly Aug 22, 2023
88607f3
Fix: Don't delete predefined deployment strategies (#1081)
der-eismann Aug 23, 2023
468e5e3
Stop building ARM containers for PRs (#1082)
der-eismann Aug 23, 2023
158ca36
Defuse unnecessary errors for unavailable services (#1083)
der-eismann Aug 23, 2023
ef87e80
Build with Go 1.21 (#1084)
der-eismann Aug 23, 2023
a3fa4aa
Update readme for v2.24.2 release (#1086)
github-actions[bot] Aug 23, 2023
a552489
Add EC2InstanceConnectEndpoint resource (#1087)
der-eismann Aug 23, 2023
9874f48
Add elasticache user and group support (#1044)
swhite-oreilly Aug 24, 2023
f8fc2e5
Add support for CloudFront public keys and CloudFront key groups (#87…
npellegrin Aug 24, 2023
f1aff70
feat: MemoryDBACL resource support (#1079)
JTaylor-myenergi Aug 24, 2023
e641116
Stopped Executions before deleting step functions state machines (#1053)
suleman-sohail Aug 24, 2023
150eb13
Add RedshiftScheduledAction resource (#1047)
MikeSchouw Aug 24, 2023
dd94ae0
Merge remote-tracking branch 'upstream/main' into Update-comprehend-d…
swhite-oreilly Aug 24, 2023
b598367
Merge branch 'oreilly-main' into Update-comprehend-detection-filters
swhite-oreilly Aug 24, 2023
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
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ updates:
day: "tuesday"
time: "10:00"
timezone: "Europe/Berlin"
groups:
golang:
patterns:
- "*"
64 changes: 63 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,77 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
- name: Setup tools
run: |
go install golang.org/x/lint/golint@latest
- name: Checkout code
uses: actions/checkout@v3
- name: Check Formatting
run: |
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
echo "### Go formatting is off, please execute 'gofmt -w -s .' - see following diff: ###"
gofmt -s -d .
exit 1
fi
- name: Test Project
run: |
make test
- name: Build Project
run: |
make

docker_build:
runs-on: ubuntu-22.04
name: Docker Build
if: github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == 'rebuy-de/aws-nuke' && github.event.pull_request.user.login != 'dependabot[bot]')

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Generate image tags
shell: bash
run: |
if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then
BRANCH="$(echo ${GITHUB_HEAD_REF} | tr '/' '_')"
echo "tags=quay.io/rebuy/aws-nuke:${BRANCH},docker.io/rebuy/aws-nuke:${BRANCH}" >> $GITHUB_OUTPUT
else
echo "tags=quay.io/rebuy/aws-nuke:main,docker.io/rebuy/aws-nuke:main,\
quay.io/rebuy/aws-nuke:latest,docker.io/rebuy/aws-nuke:latest" >> $GITHUB_OUTPUT
fi
id: generate_tags

- name: Set up QEMU
if: github.event_name != 'pull_request'
id: qemu
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to Quay.io
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.generate_tags.outputs.tags }}
platforms: ${{ github.event_name != 'pull_request' && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: '1.20'
go-version: '1.21'
- name: Checkout code
uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20-alpine as builder
FROM golang:1.21-alpine as builder

RUN apk add --no-cache git make curl openssl

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -612,10 +612,10 @@ The easiest way of installing it, is to download the latest
#### Example for Linux Intel/AMD

Download and extract
`$ wget -c https://github.com/rebuy-de/aws-nuke/releases/download/v2.23.0/aws-nuke-v2.23.0-linux-amd64.tar.gz -O - | tar -xz -C $HOME/bin`
`$ wget -c https://github.com/rebuy-de/aws-nuke/releases/download/v2.24.2/aws-nuke-v2.24.2-linux-amd64.tar.gz -O - | tar -xz -C $HOME/bin`

Run
`$ aws-nuke-v2.23.0-linux-amd64`
`$ aws-nuke-v2.24.2-linux-amd64`

### Compile from Source

Expand All @@ -639,7 +639,7 @@ $ docker run \
--rm -it \
-v /full-path/to/nuke-config.yml:/home/aws-nuke/config.yml \
-v /home/user/.aws:/home/aws-nuke/.aws \
quay.io/rebuy/aws-nuke:v2.23.0 \
quay.io/rebuy/aws-nuke:v2.24.2 \
--profile default \
--config /home/aws-nuke/config.yml
```
Expand Down
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ func NewRootCommand() *cobra.Command {
awsutil.DefaultAWSPartitionID = endpoints.AwsPartitionID
case endpoints.UsGovEast1RegionID, endpoints.UsGovWest1RegionID:
awsutil.DefaultAWSPartitionID = endpoints.AwsUsGovPartitionID
case endpoints.CnNorth1RegionID, endpoints.CnNorthwest1RegionID:
awsutil.DefaultAWSPartitionID = endpoints.AwsCnPartitionID
default:
if config.CustomEndpoints.GetRegion(defaultRegion) == nil {
err = fmt.Errorf("The custom region '%s' must be specified in the configuration 'endpoints'", defaultRegion)
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/rebuy-de/aws-nuke/v2

go 1.19
go 1.21

require (
github.com/aws/aws-sdk-go v1.44.295
github.com/aws/aws-sdk-go v1.44.328
github.com/fatih/color v1.15.0
github.com/golang/mock v1.6.0
github.com/google/uuid v1.3.0
github.com/google/uuid v1.3.1
github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4
github.com/pkg/errors v0.9.1
github.com/rebuy-de/rebuy-go-sdk/v4 v4.5.1
Expand Down
11 changes: 7 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/aws/aws-sdk-go v1.44.295 h1:SGjU1+MqttXfRiWHD6WU0DRhaanJgAFY+xIhEaugV8Y=
github.com/aws/aws-sdk-go v1.44.295/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/aws/aws-sdk-go v1.44.328 h1:WBwlf8ym9SDQ/GTIBO9eXyvwappKJyOetWJKl4mT7ZU=
github.com/aws/aws-sdk-go v1.44.328/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand All @@ -11,8 +11,8 @@ github.com/gemnasium/logrus-graylog-hook/v3 v3.1.0 h1:SLtCnpI5ZZaz4l7RSatEhppB1B
github.com/gemnasium/logrus-graylog-hook/v3 v3.1.0/go.mod h1:wi1zWv9tIvyLSMLCAzgRP+YR24oLVQVBHfPPKjtht44=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
Expand Down Expand Up @@ -71,6 +71,7 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
Expand Down Expand Up @@ -98,6 +99,7 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
Expand All @@ -112,6 +114,7 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntN
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
7 changes: 4 additions & 3 deletions pkg/config/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ func parseDate(input string) (time.Time, error) {
return t, nil
}

formats := []string{"2006-01-02",
formats := []string{
"2006-01-02",
"2006/01/02",
"2006-01-02T15:04:05Z",
"2006-01-02 15:04:05.000 -0700 MST", // Date format used by AWS for CreateTime on ASGs
time.RFC3339Nano, // Format of t.MarshalText() and t.MarshalJSON()
"2006-01-02 15:04:05 -0700 MST", // Date format used by AWS for CreateTime on ASGs
time.RFC3339Nano, // Format of t.MarshalText() and t.MarshalJSON()
time.RFC3339,
}
for _, f := range formats {
Expand Down
9 changes: 6 additions & 3 deletions pkg/config/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,22 @@ func TestUnmarshalFilter(t *testing.T) {
},
{
yaml: `{"type":"dateOlderThan","value":"0"}`,
match: []string{strconv.Itoa(int(future.Unix())),
match: []string{
strconv.Itoa(int(future.Unix())),
future.Format("2006-01-02"),
future.Format("2006/01/02"),
future.Format("2006-01-02T15:04:05Z"),
future.Format("2006-01-02 15:04:05.000 +0000 UTC"),
future.Format(time.RFC3339Nano),
future.Format(time.RFC3339),
},
mismatch: []string{"",
mismatch: []string{
"",
strconv.Itoa(int(past.Unix())),
past.Format("2006-01-02"),
past.Format("2006/01/02"),
past.Format("2006-01-02T15:04:05Z"),
past.Format("2006-01-02 15:04:05.14 -0700 MST"),
past.Format(time.RFC3339Nano),
past.Format(time.RFC3339),
},
Expand Down Expand Up @@ -98,5 +102,4 @@ func TestUnmarshalFilter(t *testing.T) {
}
})
}

}
53 changes: 53 additions & 0 deletions resources/appconfig-applications.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package resources

import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/appconfig"
"github.com/rebuy-de/aws-nuke/v2/pkg/types"
)

type AppConfigApplication struct {
svc *appconfig.AppConfig
id *string
name *string
}

func init() {
register("AppConfigApplication", ListAppConfigApplications)
}

func ListAppConfigApplications(sess *session.Session) ([]Resource, error) {
svc := appconfig.New(sess)
resources := []Resource{}
params := &appconfig.ListApplicationsInput{
MaxResults: aws.Int64(50),
}
err := svc.ListApplicationsPages(params, func(page *appconfig.ListApplicationsOutput, lastPage bool) bool {
for _, item := range page.Items {
resources = append(resources, &AppConfigApplication{
svc: svc,
id: item.Id,
name: item.Name,
})
}
return true
})
if err != nil {
return nil, err
}
return resources, nil
}

func (f *AppConfigApplication) Remove() error {
_, err := f.svc.DeleteApplication(&appconfig.DeleteApplicationInput{
ApplicationId: f.id,
})
return err
}

func (f *AppConfigApplication) Properties() types.Properties {
return types.NewProperties().
Set("ID", f.id).
Set("Name", f.name)
}
70 changes: 70 additions & 0 deletions resources/appconfig-configurationprofiles.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package resources

import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/appconfig"
"github.com/rebuy-de/aws-nuke/v2/pkg/types"
"github.com/sirupsen/logrus"
)

type AppConfigConfigurationProfile struct {
svc *appconfig.AppConfig
applicationId *string
id *string
name *string
}

func init() {
register("AppConfigConfigurationProfile", ListAppConfigConfigurationProfiles)
}

func ListAppConfigConfigurationProfiles(sess *session.Session) ([]Resource, error) {
svc := appconfig.New(sess)
resources := []Resource{}
applications, err := ListAppConfigApplications(sess)
if err != nil {
return nil, err
}
for _, applicationResource := range applications {
application, ok := applicationResource.(*AppConfigApplication)
if !ok {
logrus.Errorf("Unable to cast AppConfigApplication.")
continue
}
params := &appconfig.ListConfigurationProfilesInput{
ApplicationId: application.id,
MaxResults: aws.Int64(50),
}
err := svc.ListConfigurationProfilesPages(params, func(page *appconfig.ListConfigurationProfilesOutput, lastPage bool) bool {
for _, item := range page.Items {
resources = append(resources, &AppConfigConfigurationProfile{
svc: svc,
applicationId: application.id,
id: item.Id,
name: item.Name,
})
}
return true
})
if err != nil {
return nil, err
}
}
return resources, nil
}

func (f *AppConfigConfigurationProfile) Remove() error {
_, err := f.svc.DeleteConfigurationProfile(&appconfig.DeleteConfigurationProfileInput{
ApplicationId: f.applicationId,
ConfigurationProfileId: f.id,
})
return err
}

func (f *AppConfigConfigurationProfile) Properties() types.Properties {
return types.NewProperties().
Set("ApplicationID", f.applicationId).
Set("ID", f.id).
Set("Name", f.name)
}
Loading