terraform icon indicating copy to clipboard operation
terraform copied to clipboard

stacks: Make path.module and path.root relative, to match documentation

Open nfagerlund opened this issue 2 weeks ago • 1 comments

Previously, we were just handing off the absolute path produced by the sourcebundle struct. But that's no good, because the value doesn't stay consistent between plan and apply when running under tfc-agent. (It uses working directories named after the unique job ID.) It also doesn't match the documentation, which describes these as relative paths. This was preventing people from uploading module-provided files to create aws lambda functions, for example.

This commit addresses that by converting the source-bundle provided module path to a relative path (relative to Terraform's working directory). In tfc-agent for stacks runs, that ends up being the directory directly above the sourcebundle directory, and all the paths below that are consistent between plan and apply.

Fixes: jira IPL-8856

Target Release

Would it be okay to backport this? It's affecting customers in the wild, and there are a few other PRs in flight (@DanielMSchmidt 's) that seem patch-worthy.

1.14.2

Rollback Plan

  • [ ] If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

No.

CHANGELOG entry

  • [x] This change is user-facing and I added a changelog entry.
    • but lemme know if I didn't do it right. It's in the 1.14 dir because I'm hoping for a backport.
  • [ ] This change is not user-facing.

nfagerlund avatar Dec 09 '25 23:12 nfagerlund

Sounds good, we should backport it and make it part of 1.14.3 👍

DanielMSchmidt avatar Dec 11 '25 09:12 DanielMSchmidt

Does this PR fix https://github.com/hashicorp/terraform/issues/38005?

crw avatar Dec 15 '25 19:12 crw

@crw No, to the best of my understanding it doesn't have anything to do with that request at all.

nfagerlund avatar Dec 15 '25 19:12 nfagerlund