Hey folks, I’ve been using pants for building/pack...
# general
g
Hey folks, I’ve been using pants for building/packing projects, and I realised that there’s also an experimental backend for terraform (validation and what not), however I’ve run into a problem where
pants tailor --check update-build-files
is updating my
BUILD
file with some comment text for the terraform module
Copy code
# NOTE: Sources restricted from the default for terraform_modules due to conflict with...
This was working yesterday, so I’m not sure what’s changed. Has anyone else experienced this?
h
Hi, welcome! I wonder if this is https://github.com/pantsbuild/pants/issues/14787
g
I think it is similar, basically I get this when run from a directory where
./pants
is, and under this the directory you can see in the command results in
Copy code
./pants tailor services/dev/example-service
16:26:12.43 [WARN] Unmatched glob from services/dev/example-service:tf_mods0's `sources` field: "services/dev/example-service/services/dev/example-service/**/*.tf"

Do the file(s) exist? If so, check if the file(s) are in your `.gitignore` or the global `pants_ignore` option, which may result in Pants not being able to see the file(s) even though they exist on disk. Refer to <https://www.pantsbuild.org/v2.10/docs/troubleshooting#pants-cannot-find-a-file-in-your-project>.
16:26:12.43 [WARN] Unmatched glob from services/dev/example-service:tf_mods1's `sources` field: "services/dev/example-service/services/dev/example-service/**/*.tf"

Created services/dev/example-service/BUILD:
  - Add terraform_modules target tf_mods
Then if I run;
Copy code
./pants tailor --check
Would update services/dev/example-service/BUILD:
  - Add terraform_modules target tf_mods0

To fix `tailor` failures, run `./pants tailor`.
And it will just keep going if I
tailor
again adding targets for
tf_mods1
,
tf_mods2
etc, almost like it’s stuck in some loop
h
That sounds indeed like a bug. Would you be willing to please add to the issue with this? It will help to make sure that we solve both cases. In the meantime, I recommend disabling tailor for these paths so that you can work around the problem. You can manually add the target instead.
[tailor].ignore_paths
https://www.pantsbuild.org/docs/create-initial-build-files
g
Will do, thank you @hundreds-father-404!
❤️ 1
h
@fast-nail-55400 what is the current recommendation for how to manually add the target? Should people be using terraform modules with an S or the singular version?an
f
I haven’t resolved what we want to do there. Namely should we remove
terraform_modules
in favor of tailor writing a
terraform_module
target in each directory?
👍 1
there’s probably a bug in the logic that decides to add a
terraform_modules