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 attribute lookup for dependent schemas #25

Merged
merged 1 commit into from
Mar 16, 2021

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Mar 11, 2021

This fixes a conversion function which was previously not covered by tests.

This bug in combination with another bug hashicorp/terraform-schema#28 caused the dependent schemas of resource or data block to be looked up basically freely without the provider attribute being considered.

In other words most of the time it looked like everything is working fine, but there were some configurations being misinterpreted, e.g.

terraform {
  required_providers {
    rand = {
      source  = "hashicorp/random"
      version = "3.0.0"
    }
  }
}

resource "random_string" "name" {
  provider = rand
}

It is true that providers of hashicorp (default) namespace do not require explicit required_providers entry, however if they do have one, it should be respected.

Here due to the combination of the two bugs we would look up hashicorp/random schema for random_string resource block, but that provider really isn't supposed to be available under that name. It requires explicit association.

@radeksimko radeksimko force-pushed the b-fix-attribute-dependencies branch from 7b99971 to eabe7a9 Compare March 14, 2021 10:07
@radeksimko radeksimko marked this pull request as ready for review March 15, 2021 08:54
@radeksimko radeksimko requested a review from a team March 15, 2021 09:06
@radeksimko radeksimko added the bug Something isn't working label Mar 15, 2021
@radeksimko radeksimko merged commit 55fe46d into main Mar 16, 2021
@radeksimko radeksimko deleted the b-fix-attribute-dependencies branch March 16, 2021 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants