Skip to content

fix(iac/aws-lambda): preserve Function URL via moved block (followup to #574) - #730

Merged
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/lambda-function-url-moved-block
May 26, 2026
Merged

fix(iac/aws-lambda): preserve Function URL via moved block (followup to #574)#730
cristim merged 1 commit into
feat/multicloud-web-frontendfrom
fix/lambda-function-url-moved-block

Conversation

@cristim

@cristim cristim commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

Adds a moved block to preserve aws_lambda_function_url.main across the count removal from #574.

Why this is urgent

PR #574 merged commit 601318f49 removed count = var.enable_function_url ? 1 : 0 from aws_lambda_function_url.main. The terraform address changed from aws_lambda_function_url.main[0] to bare aws_lambda_function_url.main. Existing state still holds the resource at [0]. Without a moved block, the NEXT terraform apply would:

  • DESTROY the existing Function URL (current dev: https://33pz7pombdqwu3bdlxp4lqxyra0bsriy.lambda-url.us-east-1.on.aws)
  • CREATE a new Function URL with a brand-new random host

Cascading break:

  • lambda_allowed_origins in github-dev.tfvars pins the old host -> CORS rejects the new URL until tfvars is updated AND re-applied
  • DASHBOARD_URL env var pins the old host -> invite/reset emails carry dead links
  • Frontend bundles that bake the URL point to nothing
  • Any external integration on the URL host breaks

Fix

One-line moved block in terraform/modules/compute/aws/lambda/main.tf:

moved {
  from = aws_lambda_function_url.main[0]
  to   = aws_lambda_function_url.main
}

Terraform treats this as a state-index update, NOT a destroy/create. URL host preserved across apply.

Test plan

  • terraform validate clean on both module + env layer
  • terraform fmt clean
  • No semantic change to deployed resources; ONLY a state-address rename

Land BEFORE next deploy

Once this merges, the next terraform apply is safe. If a deploy happens between #574 merging and this PR landing, the dashboard breaks. Worth fast-tracking.

…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.
@cristim cristim added triaged Item has been triaged priority/p0 Drop everything; same-day fix severity/high Significant harm urgency/now Drop other things impact/all-users Affects every user effort/xs Trivial / one-liner type/bug Defect labels May 26, 2026
@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@cristim, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 49cb9c5e-e3ec-43be-93b5-dbcbec2ef886

📥 Commits

Reviewing files that changed from the base of the PR and between f65998a and 2fb3dc0.

📒 Files selected for processing (1)
  • terraform/modules/compute/aws/lambda/main.tf
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/lambda-function-url-moved-block

Comment @coderabbitai help to get the list of available commands and usage tips.

@cristim

cristim commented May 26, 2026

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
cristim merged commit 1200e08 into feat/multicloud-web-frontend May 26, 2026
4 checks passed
@cristim
cristim deleted the fix/lambda-function-url-moved-block branch June 3, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/xs Trivial / one-liner impact/all-users Affects every user priority/p0 Drop everything; same-day fix severity/high Significant harm triaged Item has been triaged type/bug Defect urgency/now Drop other things

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant