Skip to content

AWS / Destroy

AWS / Destroy #529

# Copyright (C) Nicolas Lamirault <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
---
name: AWS / Destroy
on: # yamllint disable-line rule:truthy
workflow_dispatch:
inputs:
env:
description: 'Environment'
required: true
default: 'staging'
tf_version:
description: "Terraform version"
required: true
# datasource=github-tags depName=hashicorp/terraform
default: '1.2.2'
schedule:
- cron: "0 23 * * *"
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
#############################################################################
# Orga
aws_access_analyzer:
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete Bastion"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/access-analyzer/orga
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/access-analyzer/orga
aws_security_hub:
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete Security Hub"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/security-hub/orga
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/security-hub/orga
aws_guardduty:
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete GuardDuty"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/guardduty/orga
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/guardduty/orga
aws_cloudtrail:
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete Cloudtrail"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/cloudtrail/orga
- name: Terraform Apply
run: terraform destroy -auto-approve
working-directory: terraform/aws/cloudtrail/orga
aws_config:
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete Cloudtrail"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/config/orga
- name: Terraform Apply
run: terraform destroy -auto-approve
working-directory: terraform/aws/config/orga
#############################################################################
# Audit Account
#############################################################################
# Logging Account
#############################################################################
# Shared Account
aws_shared_chatbot:
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete ChatBot / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/chatbot/shared
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/chatbot/shared
aws_shared_ecr:
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete Shared ECR / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/ecr/shared
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/ecr/shared
#############################################################################
# Core Staging Account
aws_notifications:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- run: |
echo "Delete Notifications / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/notifications/${{ github.event.inputs.env }}
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/notifications/${{ github.event.inputs.env }}
aws_ecr:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- run: |
echo "Delete ECR / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/ecr/${{ github.event.inputs.env }}
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/ecr/${{ github.event.inputs.env }}
aws_observability:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- run: |
echo "Delete Observability stack / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/observability/${{ github.event.inputs.env }}
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/observability/${{ github.event.inputs.env }}
aws_external_dns:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- run: |
echo "Delete External DNS / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/external-dns/${{ github.event.inputs.env }}
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/external-dns/${{ github.event.inputs.env }}
aws_cert_manager:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- run: |
echo "Delete Cert-Manager / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/cert-manager/${{ github.event.inputs.env }}
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/cert-manager/${{ github.event.inputs.env }}
# aws_teleport:
# runs-on: ubuntu-latest
# continue-on-error: true
# steps:
# - run: |
# echo "Delete Teleport / ${{ github.event.inputs.env }}"
# - name: Checkout
# uses: actions/checkout@v3
# - name: Setup Terraform
# uses: hashicorp/setup-terraform@v2
# with:
# terraform_version: ${{ github.event.inputs.tf_version }}
# cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# # - name: Configure AWS credentials
# # uses: aws-actions/configure-aws-credentials@v1
# # with:
# # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# # aws-region: ${{ secrets.AWS_REGION_STAGING }}
# - name: Terraform Init
# run: terraform init -upgrade
# working-directory: terraform/aws/teleport/${{ github.event.inputs.env }}
# - name: Terraform Destroy
# run: terraform destroy -auto-approve
# working-directory: terraform/aws/teleport/${{ github.event.inputs.env }}
aws_bastion:
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete Bastion / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/bastion/${{ github.event.inputs.env }}
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/bastion/${{ github.event.inputs.env }}
aws_eks:
needs:
- aws_observability
- aws_notifications
- aws_ecr
- aws_external_dns
- aws_velero

Check failure on line 492 in .github/workflows/tf-undeploy-aws.yml

View workflow run for this annotation

GitHub Actions / AWS / Destroy

Invalid workflow file

The workflow is not valid. .github/workflows/tf-undeploy-aws.yml (Line: 492, Col: 7): Job 'aws_eks' depends on unknown job 'aws_velero'. .github/workflows/tf-undeploy-aws.yml (Line: 493, Col: 7): Job 'aws_eks' depends on unknown job 'aws_vector'.
- aws_vector
- aws_cert_manager
# - aws_teleport
- aws_bastion
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete EKS / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/eks/${{ github.event.inputs.env }}
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/eks/${{ github.event.inputs.env }}
aws_alb:
needs: aws_eks
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete Bastion / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/alb/${{ github.event.inputs.env }}
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/alb/${{ github.event.inputs.env }}
aws_waf:
needs: aws_eks
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete GuardDuty / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/waf/${{ github.event.inputs.env }}
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/waf/${{ github.event.inputs.env }}
# aws_secrets:
# needs: aws_eks
# runs-on: ubuntu-latest
# steps:
# - run: |
# echo "Delete GuardDuty / ${{ github.event.inputs.env }}"
# - name: Checkout
# uses: actions/checkout@v3
# - name: Setup Terraform
# uses: hashicorp/setup-terraform@v2
# with:
# terraform_version: ${{ github.event.inputs.tf_version }}
# cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# # - name: Configure AWS credentials
# # uses: aws-actions/configure-aws-credentials@v1
# # with:
# # aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# # aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# # aws-region: ${{ secrets.AWS_REGION_STAGING }}
# - name: Terraform Init
# run: terraform init -upgrade
# working-directory: terraform/aws/secrets/${{ github.event.inputs.env }}
# - name: Terraform Destroy
# run: terraform destroy -auto-approve
# working-directory: terraform/aws/secrets/${{ github.event.inputs.env }}
aws_vpc:
needs:
- aws_eks
- aws_bastion
- aws_alb
- aws_shared_chatbot
- aws_waf
# - aws_secrets
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete VPC / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/vpc/${{ github.event.inputs.env }}
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/vpc/${{ github.event.inputs.env }}
aws_elastic_ip_internet_gateway:
needs: aws_vpc
runs-on: ubuntu-latest
steps:
- run: |
echo "Delete Elastic IP for Internet Gateway / ${{ github.event.inputs.env }}"
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ github.event.inputs.tf_version }}
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }}
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }}
# aws-region: ${{ secrets.AWS_REGION_STAGING }}
- name: Terraform Init
run: terraform init -upgrade
working-directory: terraform/aws/elastic-ips/internet-gateway/${{ github.event.inputs.env }}
- name: Terraform Destroy
run: terraform destroy -auto-approve
working-directory: terraform/aws/elastic-ips/internet-gateway/${{ github.event.inputs.env }}