Skip to content

feat(build): support mount symlink in terraform build#8854

Merged
roger-zhangg merged 4 commits intodevelopfrom
fix_tf_mount
Mar 26, 2026
Merged

feat(build): support mount symlink in terraform build#8854
roger-zhangg merged 4 commits intodevelopfrom
fix_tf_mount

Conversation

@roger-zhangg
Copy link
Copy Markdown
Member

@roger-zhangg roger-zhangg commented Mar 26, 2026

What

Thread the --mount-symlinks flag through the Terraform build pipeline so that zip artifacts containing symlinks can be extracted during sam build --hook-name terraform --mount-symlinks.

How

  • copy_terraform_built_artifacts.py: Added --mount-symlinks CLI flag
  • makefile_generator.py: Makefile recipe includes $(SAM_CLI_MOUNT_SYMLINKS_FLAG) placeholder
  • app_builder.py: Replaces placeholder in per-build Makefile copy before invoking builder (race-safe)
  • build_integ_base.py: Added mount_symlinks to get_command_list()

Tests

  • Script-level, integ, and unit tests included

Thread the --mount-symlinks flag through the Terraform build pipeline so
that zip artifacts containing symlinks (e.g. absolute symlinks) can be
extracted during sam build --hook-name terraform.

Changes:
- copy_terraform_built_artifacts.py: Add --mount-symlinks CLI flag and
  pass it to unzip()
- makefile_generator.py: Include $(SAM_CLI_MOUNT_SYMLINKS_FLAG)
  placeholder in the Makefile recipe
- app_builder.py: Replace the placeholder with --mount-symlinks in the
  Makefile before invoking the builder (per-build, race-safe)
- build_integ_base.py: Add mount_symlinks parameter to get_command_list

Tests:
- Script-level tests for symlink zip extraction with/without flag
- E2E integration test with sam build --hook-name terraform
- Unit test for makefile recipe generation
@roger-zhangg roger-zhangg requested a review from a team as a code owner March 26, 2026 21:21
@github-actions github-actions bot added area/build sam build command pr/internal labels Mar 26, 2026
@roger-zhangg
Copy link
Copy Markdown
Member Author

roger-zhangg commented Mar 26, 2026

valerena
valerena previously approved these changes Mar 26, 2026
skip_prepare_infra,
plan_file,
project_root_dir,
mount_symlinks=_read_parameter_value("mount_symlinks", opts, ctx, False),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not really important, but just for consistency I would put the _read_parameter_value call in line 93 and then do just mount_symlinks=mount_symlinks, here.

@roger-zhangg roger-zhangg enabled auto-merge March 26, 2026 23:00
@roger-zhangg roger-zhangg added this pull request to the merge queue Mar 26, 2026
Merged via the queue into develop with commit 34da7c8 Mar 26, 2026
46 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build sam build command pr/internal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants