Destroy Pipeline #77
This file contains hidden or 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
| name: Destroy Pipeline | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [main] | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_REGION: us-east-1 | |
| IMAGE_NAME_VALUE_1: openems-ui | |
| IMAGE_NAME_VALUE_2: openems-backend | |
| # IMAGE_NAME_VALUE_3: openems-db | |
| IMAGE_NAME_VALUE_4: odoo | |
| # IMAGE_NAME_VALUE_5: odoo-db | |
| IMAGE_NAME_VALUE_6: openems-edge | |
| TERRAFORM_ACTION: destroy | |
| ECS_TD: .github/workflows/openems-deployment-td.json | |
| ECS_SERVICE: openems-deployment-service | |
| ECS_CLUSTER: openems-deployment-cluster | |
| jobs: | |
| # Configure AWS credentials | |
| configure_aws_credentials: | |
| name: Configure AWS credentials | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ env.AWS_REGION }} | |
| # Destroy AWS infrastructure | |
| destroy_aws_infrastructure: | |
| name: Build AWS infrastructure | |
| needs: configure_aws_credentials | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Terraform | |
| uses: hashicorp/setup-terraform@v2 | |
| with: | |
| terraform_version: 1.14.1 | |
| - name: Run Terraform initialize | |
| working-directory: ./iac | |
| run: terraform init | |
| - name: Run Terraform apply/destroy | |
| working-directory: ./iac | |
| run: terraform ${{ env.TERRAFORM_ACTION }} -auto-approve |