-
Notifications
You must be signed in to change notification settings - Fork 0
fix: pause resume and delete old infra #156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR removes old infrastructure components and enables the pause/resume functionality for AWS resources. The changes focus on cleaning up unused CloudFront, WAF, and API Gateway infrastructure while making the pause/resume scripts more robust and idempotent.
- Removes CloudFront distributions, WAF configurations, and API Gateway modules from frontend and API infrastructure
- Enables the previously commented-out resume-resources-dev workflow job
- Enhances pause and resume scripts with better error handling and idempotent behavior
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
infrastructure/frontend/waf.tf | Removes WAF configuration for CloudFront |
infrastructure/frontend/cloudfront.tf | Removes entire CloudFront distribution setup including S3 buckets and logging |
infrastructure/api/waf.tf | Removes API WAF, CloudFront distribution, and logging configuration |
infrastructure/api/api-gateway.tf | Removes API Gateway module and related networking configurations |
.github/workflows/pr-open.yml | Enables resume-resources-dev job and updates deployment dependencies |
.github/scripts/resume.sh | Improves error handling, adds idempotent checks, and enhances resource status validation |
.github/scripts/pause.sh | Enhances script with better error handling, idempotent behavior, and clearer status reporting |
# Made idempotent - safe to run multiple times, checks resource existence before acting. | ||
|
||
set -e # Exit on error | ||
set -euo pipefail # Exit on error, undefined variables, and pipe failures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The script uses set -euo pipefail
but then frequently disables error exit with set +e
throughout the script. Consider using a more targeted approach like || true
for specific commands that are expected to potentially fail, rather than toggling the error handling mode repeatedly.
Copilot uses AI. Check for mistakes.
# Made idempotent - safe to run multiple times, checks resource existence before acting. | ||
|
||
set -e # Exit on error | ||
set -euo pipefail # Exit on error, undefined variables, and pipe failures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Similar to the resume script, this uses set -euo pipefail
but frequently toggles error handling with set +e
. Consider using || true
or command-specific error handling instead of repeatedly changing the global error handling behavior.
Copilot uses AI. Check for mistakes.
.github/scripts/resume.sh
Outdated
# Temporarily disable error exit for this check | ||
set +e | ||
local status=$(aws rds describe-db-clusters --db-cluster-identifier "${cluster_id}" --query 'DBClusters[0].Status' --output text 2>/dev/null) | ||
local exit_code=$? | ||
set -e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The AWS CLI command structure and error handling pattern is duplicated across multiple functions. Consider creating a helper function like safe_aws_command
that handles the set +e
/set -e
pattern and error checking consistently.
# Temporarily disable error exit for this check | |
set +e | |
local status=$(aws rds describe-db-clusters --db-cluster-identifier "${cluster_id}" --query 'DBClusters[0].Status' --output text 2>/dev/null) | |
local exit_code=$? | |
set -e | |
# Use safe_aws_command to execute AWS CLI command | |
local status | |
status=$(safe_aws_command "aws rds describe-db-clusters --db-cluster-identifier '${cluster_id}' --query 'DBClusters[0].Status' --output text") | |
local exit_code=$? |
Copilot uses AI. Check for mistakes.
No description provided.