Replies: 3 comments
-
Requiring a Git repo for all module blocks seems to be more a "personal preference/tendency" than a "best practice." Modules with significant complexity or repetition may benefit from breaking functionality into child modules ( However, I do see a pattern in your example that I think we can discourage with high confidence: absolute paths. This comes directly from the Terraform Configuration Guide:
The module source docs don't acknowledge whether absolute paths are even supported:
It's reasonable to support them, particularly for generated config, but this is so rarely needed that I think we could enable this proposed rule by default. By default, modules should be portable, just like config. Optionally, we could also allow users to forbid ancestor source paths, i.e. I do plan on doing some work on module rules soon, terraform-linters/tflint#1176, possibly renaming |
Beta Was this translation helpful? Give feedback.
-
@bendrucker - I agree, verification if source path is not absolute is enough. There might be cases, when we would like to keep submodules - to gather related resources. If this feature (absolute path verification) is implemented please close this issue. |
Beta Was this translation helpful? Give feedback.
-
it would be useful instead of pinning to a just git based repo if you could variable-ize the URL?
i wanted to suggest this before I attempted to create a new rule just for validating the uri based on a configurable variable. |
Beta Was this translation helpful? Give feedback.
-
Hello Guys!
After a while of using terraform I spotted a tendency to push/commit changes, that for testing purposes points to my local path instead of git repo. I believie this rule is missing and might be useful in
TFLint
, forcing that all sources must point to remote repository.Following code would be evaluated as invalid:
Example of valid module:
Also property
clone_protocol
that check wheater source repo is cloned usinghttps
orssh
might be a valid featureBeta Was this translation helpful? Give feedback.
All reactions