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

resource_missing_tags: Ignore non-existent provider aliases #519

Merged
merged 1 commit into from
Jul 22, 2023

Conversation

wata727
Copy link
Member

@wata727 wata727 commented Jul 22, 2023

Fixes #518

The aws_resource_missing_tags rule implicitly expects the provider declaration to be in the same module if a resource has a provider 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's default_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.

@wata727 wata727 merged commit 0f212c5 into master Jul 22, 2023
@wata727 wata727 deleted the ignore_non_existent_aliases branch July 22, 2023 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant