Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
amaldonado17 committed Feb 15, 2024
1 parent 73a4c6b commit 516a987
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/terraform_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Terraform Deploy

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.14.11

- name: Terraform Init
run: terraform init

- name: Terraform Apply
run: terraform apply -auto-approve

- name: Get public IP
run: echo "Public IP: ${{ steps.set-outputs.outputs.public_ip }}"
id: set-outputs
env:
TF_STATE: ${{ secrets.TF_STATE }}

- name: Deploy to EC2
run: |
PUBLIC_IP=$(terraform output -json public_ip | jq -r '.')
echo "Deploying to EC2 at $PUBLIC_IP"
# Puedes agregar comandos adicionales para el despliegue, como copiar archivos, etc.
- name: Terraform Destroy (cleanup)
if: always()
run: terraform destroy -auto-approve
Empty file added notas.txt
Empty file.

0 comments on commit 516a987

Please sign in to comment.