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

fix: set source in required_providers #36

Merged
merged 1 commit into from
Feb 23, 2023
Merged

Conversation

bendrucker
Copy link
Contributor

What does this PR do?

Replaces the legacy required_providers declaration with {source, version}.

Motivation

Fixes warnings about implicit provider selection when passing in a provider instance to the module. Closes #31.

Limitations

Since Terraform continues to support this syntax for backward compatibility with 0.12, we need to enforce this separately. terraform-linters/tflint-ruleset-terraform#64 will allow us to detect and reject this syntax in the future.

Testing

I tried to write a test module but was unable to reproduce the originally reported warning on terraform validate:

module "m" {
  source = "../"

  observe_token = "id:secret"
  observe_customer = "12345"

  providers = {
    aws = aws.aliased
   }
}

provider "aws" {
  alias = "aliased"
}

Even if there were no reported issue/warning, we should still be setting source anyway.

@bendrucker bendrucker merged commit 1f27dca into main Feb 23, 2023
@bendrucker bendrucker deleted the required-providers-source branch February 23, 2023 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding a provider produces a warning, possibly due to missing source
2 participants