Closed ryanking closed 5 days ago
To make this work, i manually updated my BUILD files to:
terraform_module(dependencies=[".terraform.lock.hcl"])
file(name="lock",source=".terraform.lock.hcl")
I guess you meant:
terraform_module(dependencies=[":lock"])
file(name="lock",source=".terraform.lock.hcl")
Yeah just came here to correct that. Posted before I tested. :)
The lock file could be added as an additional glob for the sources
field on terraform_module
. https://github.com/pantsbuild/pants/blob/a42dd729e9fbdc79e95116bef5e7e722be32ec04/src/python/pants/backend/terraform/target_types.py#L19
We implemented Terraform lockfile functionality in #20303 , but it uses magic to grab the lockfile directly instead of having a target for it. Because there's no real target, it won't show up in --changed-since
. The Python backend generates targets for its lockfiles with a synthetic target. I think that could work here. One difference is that Python pulls the list of resolves from PythonSetup, but Terraform pulls it by enumerating modules.
Using synthetic targets could work, as long as they don't need data about other targets when being generated. i.e. if enumerating modules is about files on disk, rather than discovering targets?
When
tailor
is run for a terraform workspace, only the code is captured by the default.We use pants' support for terraform just to track changes in our terraform monorepo. Because lock files are not captured, lockfile-only changes will not show up in our CI runs.
Pants version 2.9.0
OS Mac & linux