fix(iac/aws-lambda): preserve Function URL via moved block (followup to #574) - #730
Conversation
…via moved block The prior commit dropped `count` from aws_lambda_function_url.main. Without a `moved` block, terraform sees this as destroy + create, which generates a new Function URL host and breaks the dashboard (CORS origins, DASHBOARD_URL, frontend bundles all reference the old host). The `moved` block makes terraform treat it as a state-index update in-place instead. aws_lambda_permission.function_url retains its count expression (now `var.function_url_auth_type == "NONE" ? 1 : 0`), so its state address stays indexed and needs no moved block.
|
Warning Review limit reached
More reviews will be available in 13 minutes and 44 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
Adds a
movedblock to preserveaws_lambda_function_url.mainacross thecountremoval from #574.Why this is urgent
PR #574 merged commit
601318f49removedcount = var.enable_function_url ? 1 : 0fromaws_lambda_function_url.main. The terraform address changed fromaws_lambda_function_url.main[0]to bareaws_lambda_function_url.main. Existing state still holds the resource at[0]. Without amovedblock, the NEXTterraform applywould:https://33pz7pombdqwu3bdlxp4lqxyra0bsriy.lambda-url.us-east-1.on.aws)Cascading break:
lambda_allowed_originsingithub-dev.tfvarspins the old host -> CORS rejects the new URL until tfvars is updated AND re-appliedDASHBOARD_URLenv var pins the old host -> invite/reset emails carry dead linksFix
One-line
movedblock interraform/modules/compute/aws/lambda/main.tf:Terraform treats this as a state-index update, NOT a destroy/create. URL host preserved across apply.
Test plan
Land BEFORE next deploy
Once this merges, the next
terraform applyis safe. If a deploy happens between #574 merging and this PR landing, the dashboard breaks. Worth fast-tracking.