resource_missing_tags: Ignore non-existent provider aliases #519
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #518
The
aws_resource_missing_tags
rule implicitly expects the provider declaration to be in the same module if a resource has aprovider
argument. However, In child modules, provider declarations are passed implicitly or explicitly from the root module. In this case, it is not possible to refer to the provider'sdefault_tags
in this module.https://developer.hashicorp.com/terraform/language/modules/develop/providers
The solution to this problem is to parse the provider declaration passed from the root module in module inspection. However, the current module inspection design has many limitations that unfortunately cannot be solved in this way. This issue is tracked in terraform-linters/tflint-plugin-sdk#193
As a workaround, if the provider declaration is missing in the module, rather than returning an error, ignore the default tags. Conservatively, some default tags might apply, so you could skip the inspection, but there are probably many cases where it's more convenient to simply ignore the default tags.