Skip to content

fix(aws): derive AMI name prefix from var.prefix#2115

Merged
sitole merged 2 commits intoe2b-dev:mainfrom
ya-luotao:fix/aws-ami-prefix-mismatch
Mar 13, 2026
Merged

fix(aws): derive AMI name prefix from var.prefix#2115
sitole merged 2 commits intoe2b-dev:mainfrom
ya-luotao:fix/aws-ami-prefix-mismatch

Conversation

@ya-luotao
Copy link
Contributor

Summary

  • Bug: Packer names AMIs as ${prefix}orch-<timestamp>, but all Terraform node pool modules hardcode image_family_prefix = "e2b-orch-". Any custom PREFIX (e.g. e2bdev-) causes terraform plan to fail with "Your query returned no results" when looking up AMIs.
  • Fix: Introduce local.ami_family_prefix = "${var.prefix}orch-" and use it for all 5 node pools (control_server, api, client, clickhouse, build). Remove the 4 now-unused *_image_family_prefix variables from variables.tf.
  • Bonus fix: build_image_family_prefix was never passed from main.tf to the cluster module — it silently fell back to the submodule's hardcoded default. Now explicitly wired.

Test plan

  • With PREFIX=e2b- (default): terraform plan still finds AMIs named e2b-orch-* — no behavior change
  • With PREFIX=e2bdev- (custom): terraform plan now correctly looks for e2bdev-orch-* AMIs

🤖 Generated with Claude Code

The Packer template names AMIs as "${var.prefix}orch-<timestamp>", but
all node pool modules had image_family_prefix hardcoded to "e2b-orch-".
This breaks AMI lookup for any custom PREFIX (e.g. "e2bdev-" produces
"e2bdev-orch-" AMIs that Terraform can't find).

Introduce local.ami_family_prefix computed from var.prefix and use it
for all node pools. Also wire build_image_family_prefix which was
previously missing from main.tf (silently falling back to the hardcoded
default in the submodule).

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Copy link
Member

@sitole sitole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make it back compatible by changing value TF vars to empty string and then locally evaluate clickhouse_image_family_prefix = var.clickhouse_image_family_prefix == "" ? locals.ami_family_prefix : var.clickhouse_image_family_prefix we still need to be able to override ami for each node pool separately.

Per review: restore image_family_prefix variables with default="" and
use conditional evaluation so each node pool can still be overridden
independently. When empty (default), falls back to local.ami_family_prefix
derived from var.prefix.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@ValentaTomas ValentaTomas removed their request for review March 12, 2026 17:38
@ValentaTomas ValentaTomas removed their assignment Mar 12, 2026
@sitole sitole self-requested a review March 13, 2026 08:24
@sitole sitole merged commit 0efd5c4 into e2b-dev:main Mar 13, 2026
30 checks 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.

3 participants