Skip to content

fix(infra): fix deploy doctor sed portability and ec2 describe-vpcs check#1311

Open
ShaanNarendran wants to merge 1 commit into
mainfrom
fix/terraform-deploy-doctor
Open

fix(infra): fix deploy doctor sed portability and ec2 describe-vpcs check#1311
ShaanNarendran wants to merge 1 commit into
mainfrom
fix/terraform-deploy-doctor

Conversation

@ShaanNarendran
Copy link
Copy Markdown
Contributor

Purpose / Description

Fixes two bugs in deploy.sh that caused false-positive failures during the prod deployment validation:

  1. get_tfvar() regex used \s* which is not supported by BSD sed (macOS) or some minimal Linux environments. Values like region = "us-east-1" were not extracted, causing "region not set" errors even when set correctly.

  2. The EC2/VPC permission check used aws ec2 describe-vpcs --max-results 1 but describe-vpcs does not support --max-results. The invalid parameter caused the AWS CLI to error, which the script misreported as "Cannot access EC2/VPC (check IAM permissions)" even with AdministratorAccess.

Fixes

  • Fixes deploy doctor false failures reported during Appian prod deployment

Approach

  • Replace \s* with [ ]* in sed for POSIX portability
  • Replace --max-results 1 with --query to validate EC2 access without unsupported flags

How Has This Been Tested?

  • Verified sed extraction works on macOS BSD sed: echo 'region = "us-east-1"' | sed 's/.*=[ ]*"\(.*\)"/\1/' outputs us-east-1
  • bash -n syntax check passes
  • The failing tfvars from the Appian deployment (region, image_tag, license_key all set) would now parse correctly

Checklist

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)

…heck

Two bugs in deploy.sh causing false failures:

1. get_tfvar() used \s* which is not portable (BSD sed on macOS
   and some Linux distros do not support it). Replaced with [ ]*.

2. aws ec2 describe-vpcs does not support --max-results. The
   invalid parameter caused the command to fail, which the script
   misreported as a permissions error. Use --query instead.
@github-actions
Copy link
Copy Markdown

⚠️ Deprecation Warning: The deny-licenses option is deprecated for possible removal in the next major release. For more information, see issue 997.

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant