fix: prevent crash for legacy provider lookups #481
Merged
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 #479
This accounts for a case where users don't have explicit provider requirement in their configuration, but use Terraform 0.13+ (which outputs provider schemas with new addresses).
Generally
ProviderSchema()
is not meant to ever returnnil, nil
, which other logic interraform-schema
relies on:https://github.com/hashicorp/terraform-schema/blob/ad0461b4382716039f6d35e8fd9bd8599458285c/schema/schema_merge.go#L70-L77
I also added some extra logging in "hot paths" which users are likely to hit and where knowing more may aid debugging in the future.
Legacy addresses will unfortunately not be eliminated in the near future, despite how we refer to them (legacy) as there's currently no plan for making explicit
source
argument required in Terraform v1.We can guide people to help eliminate it #480 and convert legacy addresses ourselves #458
Regardless though we need to be able to deal with such legacy addresses in the meantime.