Azure / Destroy #481
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: Azure / Destroy | |
on: # yamllint disable-line rule:truthy | |
workflow_dispatch: | |
inputs: | |
env: | |
description: 'Environment' | |
required: true | |
default: 'dev' | |
tf_version: | |
description: "Terraform version" | |
required: true | |
# datasource=github-tags depName=hashicorp/terraform | |
default: '1.4.6' | |
schedule: | |
- cron: "0 23 * * *" | |
# env: | |
# ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID_DEV }} | |
# ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET_DEV }} | |
# ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID_DEV }} | |
# ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID_DEV }} | |
permissions: | |
contents: read | |
jobs: | |
observability: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- run: | | |
echo "Delete Observability / ${{ 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: Terraform Init | |
run: terraform init -upgrade | |
working-directory: terraform/azure/observability/${{ github.event.inputs.env }} | |
- name: Terraform Destroy | |
run: terraform destroy -auto-approve | |
working-directory: terraform/azure/observability/${{ github.event.inputs.env }} | |
velero: | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- run: | | |
echo "Delete Velero / ${{ 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: Terraform Init | |
run: terraform init -upgrade | |
working-directory: terraform/azure/velero/${{ github.event.inputs.env }} | |
- name: Terraform Destroy | |
run: terraform destroy -auto-approve | |
working-directory: terraform/azure/velero/${{ github.event.inputs.env }} | |
azure_secrets: | |
needs: | |
- observability | |
- velero | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "Delete AKS / ${{ 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: Terraform Init | |
run: terraform init -upgrade | |
working-directory: terraform/azure/secrets/${{ github.event.inputs.env }} | |
- name: Terraform Destroy | |
run: terraform destroy -auto-approve | |
working-directory: terraform/azure/secrets/${{ github.event.inputs.env }} | |
azure_aks: | |
needs: | |
- observability | |
- velero | |
- azure_secrets | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "Delete AKS / ${{ 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: Terraform Init | |
run: terraform init -upgrade | |
working-directory: terraform/azure/aks/${{ github.event.inputs.env }} | |
- name: Terraform Destroy | |
run: terraform destroy -auto-approve | |
working-directory: terraform/azure/aks/${{ github.event.inputs.env }} | |
env: | |
TF_VAR_authorized_ip_ranges: "[\"${{ secrets.HOME_IP_ADDRESS }}\"]" | |
azure_nat_gateway: | |
needs: azure_aks | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "Delete NAT 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: Terraform Init | |
run: terraform init -upgrade | |
working-directory: terraform/azure/nat-gateway/${{ github.event.inputs.env }} | |
- name: Terraform Destroy | |
run: terraform destroy -auto-approve | |
working-directory: terraform/azure/nat-gateway/${{ github.event.inputs.env }} | |
azure_application_gateway: | |
needs: azure_aks | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "Delete Application 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: Terraform Init | |
run: terraform init -upgrade | |
working-directory: terraform/azure/application-gateway/${{ github.event.inputs.env }} | |
- name: Terraform Destroy | |
run: terraform destroy -auto-approve | |
working-directory: terraform/azure/application-gateway/${{ github.event.inputs.env }} | |
azure_peering: | |
needs: | |
- azure_aks | |
- azure_nat_gateway | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "Delete Azure Virtual Network Peering / ${{ 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: Terraform Init | |
run: terraform init -upgrade | |
working-directory: terraform/azure/peering/${{ github.event.inputs.env }} | |
- name: Terraform Destroy | |
run: terraform destroy -auto-approve | |
working-directory: terraform/azure/peering/${{ github.event.inputs.env }} | |
azure_bastion: | |
needs: azure_peering | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "Delete Azure Bastion / network" | |
- 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: Terraform Init | |
run: terraform init -upgrade | |
working-directory: terraform/azure/bastion/network | |
- name: Terraform Destroy | |
run: terraform destroy -auto-approve | |
working-directory: terraform/azure/bastion/network | |
azure_firewall: | |
needs: azure_peering | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "Delete Azure Firewall / network" | |
- 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: Terraform Init | |
run: terraform init -upgrade | |
working-directory: terraform/azure/firewall/network | |
- name: Terraform Destroy | |
run: terraform destroy -auto-approve | |
working-directory: terraform/azure/firewall/network | |
azure_hub: | |
needs: | |
- azure_firewall | |
- azure_bastion | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "Delete VNet / network" | |
- 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: Terraform Init | |
run: terraform init -upgrade | |
working-directory: terraform/azure/hub/network | |
- name: Terraform Destroy | |
run: terraform destroy -auto-approve | |
working-directory: terraform/azure/hub/network | |
azure_vnet: | |
needs: | |
- azure_aks | |
- azure_nat_gateway | |
- azure_bastion | |
- azure_firewall | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
echo "Delete VNet / ${{ 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: Terraform Init | |
run: terraform init -upgrade | |
working-directory: terraform/azure/vnet/${{ github.event.inputs.env }} | |
- name: Terraform Destroy | |
run: terraform destroy -auto-approve | |
working-directory: terraform/azure/vnet/${{ github.event.inputs.env }} |