diff --git a/.cloudbees/aws-nuke/bp-tf-ci-nuke.yaml b/.cloudbees/aws-nuke/bp-tf-ci-nuke.yaml deleted file mode 100644 index 3198a3c6..00000000 --- a/.cloudbees/aws-nuke/bp-tf-ci-nuke.yaml +++ /dev/null @@ -1,141 +0,0 @@ -regions: -- us-east-1 -- us-west-2 -- global - -account-blocklist: -- "999999999999" # production - -# aws-nuke resource-types ==> to list supported resource types -resource-types: - targets: - - ACMCertificate - - CloudWatchLogsLogGroup - - DynamoDBTable - - EC2Instance - - EC2InternetGateway - - EC2LaunchTemplate - - EC2NATGateway - - EC2NetworkACL - - EC2RouteTable - - EC2SecurityGroup - - EC2Snapshot - - EC2Subnet - - EC2Volume - - ELBv2 - - ELBv2TargetGroup - - KMSKey - - KMSAlias - - RDSSnapshot - - S3Bucket - - SecretsManagerSecret - # - IAMPolicy - # - IAMInstanceProfile - -accounts: - 324005994172: - filters: - ACMCertificate: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - CloudWatchLogsLogGroup: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - DynamoDBTable: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - EC2Instance: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - EC2InternetGateway: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - EC2LaunchTemplate: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - EC2NATGateway: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - EC2NetworkACL: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - EC2RouteTable: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - EC2SecurityGroup: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - EC2Snapshot: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - EC2Subnet: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - EC2Volume: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - ELBv2: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - ELBv2TargetGroup: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - KMSKey: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - KMSAlias: - # - property: 'tag:cb-user' - # type: exact - # value: "cb-platform" - # invert: true - - property: 'Name' - type: contains - value: "-ci-" - invert: true - RDSSnapshot: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - S3Bucket: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true - SecretsManagerSecret: - - property: 'tag:cb-user' - type: exact - value: "cb-platform" - invert: true diff --git a/Makefile b/Makefile index 7885ecea..1435bc7c 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,6 @@ BP_AGENT_USER := bp-agent MKFILEDIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) CBCI_REPO ?= https://github.com/cloudbees/terraform-aws-cloudbees-ci-eks-addon.git CBCI_BRANCH ?= main -NUKE_DRY_RUN ?= true DESTROY_ONLY_APPS ?= false define helpers @@ -108,15 +107,6 @@ set-cbci-location: agentCheck guard-CBCI_REPO guard-CBCI_BRANCH @$(call helpers,set-cbci-location $(CBCI_REPO) $(CBCI_BRANCH)) @$(call helpers,INFO "Setting new Casc location to $(CBCI_REPO) $(CBCI_BRANCH) finished succesfully.") -.PHONY: run-aws-nuke -run-aws-nuke: ## Run aws nuke by https://github.com/rebuy-de/aws-nuke. Example: NUKE_DRY_RUN=true make run-aws-nuke -run-aws-nuke: guard-NUKE_DRY_RUN -ifeq ($(NUKE_DRY_RUN),false) - @$(call helpers,ask-confirmation "Running AWS Nuke to destroy selected resources.") -endif - @$(call helpers,run-aws-nuke $(NUKE_DRY_RUN)) - @$(call helpers,INFO "AWS nuke finished successfully with DRY_RUN=$(NUKE_DRY_RUN).") - ########################## # Global ########################## diff --git a/blueprints/helpers.sh b/blueprints/helpers.sh index 1dd87cd5..be7bc8dc 100755 --- a/blueprints/helpers.sh +++ b/blueprints/helpers.sh @@ -206,19 +206,3 @@ set-cbci-location () { sed -i "s|bundle: \".*/none-ha\"|bundle: \"$branch/none-ha\"|g" "$SCRIPTDIR/02-at-scale/cbci/casc/oc/items/root.yaml" sed -i "s|bundle: \".*/ha\"|bundle: \"$branch/ha\"|g" "$SCRIPTDIR/02-at-scale/cbci/casc/oc/items/root.yaml" } - -run-aws-nuke () { - local dry_run="$1" - local aws_nuke_file="$SCRIPTDIR/../.cloudbees/aws-nuke/bp-tf-ci-nuke.yaml" - local aws_nuke_file_log="$SCRIPTDIR/../.cloudbees/aws-nuke/aws-nuke.log" - if [ "$dry_run" == "true" ]; then - INFO "Running AWS Nuke in Dry Run Mode..." - rm "$aws_nuke_file_log" || INFO "No log file to remove." - aws-nuke -c "$aws_nuke_file" | tee "$aws_nuke_file_log" - INFO "Listing candidated resources to be deleted by using $aws_nuke_file" - grep "remove" "$aws_nuke_file_log" || INFO "No candidates to delete." - else - WARN "Running AWS Nuke in Not Dry Run Mode..." - aws-nuke -c "$aws_nuke_file" --no-dry-run - fi -}