Skip to content

Commit d0e94d0

Browse files
feat: Add Terraform destroy step to GitHub Actions workflow and update README for redeploy behavior
1 parent fee45fc commit d0e94d0

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.github/workflows/deploy.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,16 @@ jobs:
138138
run: |
139139
terraform init -input=false
140140
141+
- name: Terraform destroy existing instance
142+
if: ${{ matrix.deployer == 'terraform' }}
143+
working-directory: ${{ matrix.path }}
144+
shell: bash
145+
env:
146+
TF_IN_AUTOMATION: 1
147+
run: |
148+
terraform destroy -input=false -auto-approve -target=aws_instance.mediamtx || true
149+
terraform destroy -input=false -auto-approve -target=aws_eip_association.mediamtx || true
150+
141151
- name: Terraform apply
142152
if: ${{ matrix.deployer == 'terraform' }}
143153
working-directory: ${{ matrix.path }}

infra/terraform/media_relay/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This module provisions everything required to host the relay on a single EC2 ins
1111
- Optional Caddy reverse proxy that fetches Let's Encrypt certificates for the supplied domain and fronts the Mediamtx HTTP/WebRTC endpoints.
1212
- Elastic IP associated with the instance for a stable ingress point.
1313
- If you supply `existing_eip_allocation_id`, the module reuses that Elastic IP instead of allocating a new one.
14+
- The GitHub Actions workflow destroys the EC2 instance (and its EIP association) prior to each redeploy. Without an `existing_eip_allocation_id`, a fresh Elastic IP is allocated on every run.
1415

1516
You can optionally set `vpc_id`, `subnet_id`, or `key_name` to place the instance in a specific network or enable SSH access.
1617

0 commit comments

Comments
 (0)