Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow all file types in terraform check goal #21506

Open
frekw opened this issue Oct 7, 2024 · 1 comment · May be fixed by #21507
Open

Allow all file types in terraform check goal #21506

frekw opened this issue Oct 7, 2024 · 1 comment · May be fixed by #21507
Labels
backend: Terraform Terraform backend-related issues bug

Comments

@frekw
Copy link

frekw commented Oct 7, 2024

Describe the bug
Currently, the terraform backend only supports *.tf files. There are a lot of situations where other file types are necessary, such as when keeping configuration for some system in a .json or some other format, which is then read by the Terraform module.

I think it would be good to relax this constraint to support any and all filetypes, but keep the default to *.tf as to not have undesired consequences.

Pants version
2.21.0.rc0

OS
Linux

Additional info
n/a

@frekw frekw added the bug label Oct 7, 2024
frekw added a commit to frekw/pants that referenced this issue Oct 8, 2024
Closes pantsbuild#21506.

It's pretty common to want to include other types of files in a
Terraform module (such as json configuration, sql files and such) and
use them from Terraform by loading them via `file`.

Some examples from the repository I'm currently working on are: .json,
.sql, .zed (SpiceDB schema), so I think it makes sense to allow for any
file extensions here.
@frekw frekw linked a pull request Oct 8, 2024 that will close this issue
@huonw huonw added the backend: Terraform Terraform backend-related issues label Oct 8, 2024
@lilatomic
Copy link
Contributor

You can use a files or resources target for those types of files, and add that target as a dependency of the terraform_module. Something like:

resources(name="certs", sources=["*.cer", "*.crt"])
terraform_module(dependencies=[":certs"])

This is similar to other backends work, where the SourcesField subclass will pull in only the files that are in that language, and other files are pulled in with resources or files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend: Terraform Terraform backend-related issues bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants