diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index 00eed0f..419bf78 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -9,21 +9,26 @@ permissions: contents: read jobs: - integration: - uses: ./.github/workflows/integration.yml - secrets: inherit +# integration: +# uses: ./.github/workflows/integration.yml +# secrets: inherit +# +# tf-plan: +# needs: [integration] +# uses: ./.github/workflows/tf-plan.yml +# secrets: inherit +# +# tf-apply: +# needs: [ integration, tf-plan ] +# uses: ./.github/workflows/tf-apply.yml +# secrets: inherit +# +# deploy: +# needs: [ integration, tf-plan, tf-apply ] +# uses: ./.github/workflows/deploy.yml +# secrets: inherit - tf-plan: - needs: [integration] - uses: ./.github/workflows/tf-plan.yml - secrets: inherit - - tf-apply: + tf-destroy: needs: [ integration, tf-plan ] - uses: ./.github/workflows/tf-apply.yml - secrets: inherit - - deploy: - needs: [ integration, tf-plan, tf-apply ] - uses: ./.github/workflows/deploy.yml + uses: ./.github/workflows/tf-destroy.yml secrets: inherit \ No newline at end of file diff --git a/.github/workflows/tf-destroy.yml b/.github/workflows/tf-destroy.yml new file mode 100644 index 0000000..94dec4e --- /dev/null +++ b/.github/workflows/tf-destroy.yml @@ -0,0 +1,48 @@ +name: 'Tf Destroy Flow' + +on: + workflow_call: + inputs: + environment: + description: 'App Env' + required: false + type: string + default: devel + working_directory: + description: 'App Path' + required: false + type: string + default: infrastructure/aws + + +permissions: + id-token: write + contents: read + +jobs: + tf-apply: + runs-on: ubuntu-latest + environment: ${{ inputs.environment }} + steps: + - name: Configure AWS + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_TF_ROLE }} + aws-region: us-east-1 + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v3 + + - name: TF init + working-directory: ${{ inputs.working_directory }} + run: | + terraform init + + - name: TF Destroy + working-directory: ${{ inputs.working_directory }} + run: | + terraform destroy --auto-approve +