Skip to content

increase wait time for DNS cert - #49

Merged
paigewilliams merged 1 commit into
mainfrom
extend-cert-loop-time
Jun 8, 2026
Merged

increase wait time for DNS cert#49
paigewilliams merged 1 commit into
mainfrom
extend-cert-loop-time

Conversation

@paigewilliams

Copy link
Copy Markdown
Contributor

increasing wait time for prod deploy

Copilot AI left a comment

Copy link
Copy Markdown

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 increases the DNS propagation wait window in the EC2 user-data bootstrap script so production deploys have more time for the domain’s A record to point at the instance before requesting a Let’s Encrypt certificate.

Changes:

  • Increase DNS resolution polling loop iterations from 20 to 2880 (with 30s sleeps, up to 24 hours total).
Comments suppressed due to low confidence (1)

infra/user_data.tftpl:109

  • The DNS wait loop now allows up to 24h (2880 * 30s) but still proceeds to certbot even if DNS never resolves to the instance IP. That can cause long/hung deployments and confusing certificate failures. Consider making the timeout explicit, using a resolver available by default (avoid dig dependency), and aborting with a non-zero exit code if the expected IP is not observed within the timeout.
for i in $(seq 1 2880); do
  RESOLVED_IP=$(dig +short ${domain_name} | tail -1)
  if [ "$RESOLVED_IP" = "$EXPECTED_IP" ]; then
    echo "DNS resolved correctly to $EXPECTED_IP"
    break
  fi
  echo "Waiting for DNS... (got $RESOLVED_IP, want $EXPECTED_IP)"
  sleep 30
done

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@paigewilliams
paigewilliams merged commit 02238ec into main Jun 8, 2026
1 check passed
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.

2 participants