Skip to content

Commit

Permalink
end test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hermann90 committed Nov 5, 2024
1 parent 4ada117 commit 1f36c4f
Showing 1 changed file with 58 additions and 53 deletions.
111 changes: 58 additions & 53 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,74 +16,79 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Auto stage
run: echo "Auto stage"

- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.9.8
# - name: Set up Terraform
# uses: hashicorp/setup-terraform@v3
# with:
# terraform_version: 1.9.8

- name: Install AWS CLI
uses: unfor19/install-aws-cli-action@v1
with:
version: 2
verbose: false
arch: amd64
# - name: Install AWS CLI
# uses: unfor19/install-aws-cli-action@v1
# with:
# version: 2
# verbose: false
# arch: amd64

- name: Terraform Init
run: terraform init
# - name: Terraform Init
# run: terraform init

- name: Terraform Apply
run: terraform apply -auto-approve
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
# - name: Terraform Apply
# run: terraform apply -auto-approve
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_REGION: us-west-2

- name: Output website URL
run: echo "Website URL is $(terraform output INFO)"
# - name: Output website URL
# run: echo "Website URL is $(terraform output INFO)"

- name: Cache Terraform State # Enregistre l'état entre les jobs apply et destroy
uses: actions/cache@v4
with:
path: .terraform
key: ${{ runner.os }}-terraform-${{ github.sha }}
restore-keys: |
${{ runner.os }}-terraform-
# - name: Cache Terraform State # Enregistre l'état entre les jobs apply et destroy
# uses: actions/cache@v4
# with:
# path: .terraform
# key: ${{ runner.os }}-terraform-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-terraform-

destroy:
runs-on: ubuntu-latest
environment: Prod-manual
#if: ${{ github.event_name == 'push' }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.9.8
- name: Manual stage
run: echo "${{ github.event_name == 'push' }}"
# - name: Set up Terraform
# uses: hashicorp/setup-terraform@v3
# with:
# terraform_version: 1.9.8

- name: Restore Terraform State # Restaure l'état sauvegardé
uses: actions/cache@v4
with:
path: .terraform
key: ${{ runner.os }}-terraform-${{ github.sha }}
restore-keys: |
${{ runner.os }}-terraform-
# - name: Restore Terraform State # Restaure l'état sauvegardé
# uses: actions/cache@v4
# with:
# path: .terraform
# key: ${{ runner.os }}-terraform-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-terraform-

- name: Terraform Init
run: terraform init
# - name: Terraform Init
# run: terraform init

- name: Install AWS CLI
uses: unfor19/install-aws-cli-action@v1
with:
version: 2
verbose: false
arch: amd64
# - name: Install AWS CLI
# uses: unfor19/install-aws-cli-action@v1
# with:
# version: 2
# verbose: false
# arch: amd64

- name: Terraform Destroy
run: terraform destroy -auto-approve
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
# - name: Terraform Destroy
# run: terraform destroy -auto-approve
# env:
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# AWS_REGION: us-west-2

0 comments on commit 1f36c4f

Please sign in to comment.