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

Differentiate raw and inferred 1-part source string #3

Merged
merged 2 commits into from
Apr 12, 2021

Conversation

radeksimko
Copy link
Member

@radeksimko radeksimko commented Apr 7, 2021

Hi @hashicorp/terraform-core 👋🏻
This (currently internal, but soon to be published) library is basically a 1-to-1 copy of what's currently in core:

The only minor change is internal tfdiags package replaced with custom error type. All the diagnostics from the address parser were sourceless anyway.


This PR is related to our conversation we had some time ago on Slack about what does ParseProviderSourceString do with 1-part source string, such as aws. In core's case it is parsed as hashicorp/aws.

Because this is IMO highly context-dependent I decided to introduce another parsing function - ParseRawProviderSourceString which instead treats 1-part source string as legacy, i.e. aws is parsed as -/aws.

I also updated the readme to add some context on where and when to use which function.

With all that in mind the old ParseProviderSourceString is the new ParseAndInferProviderSourceString and is intended to be functionally equivalent. As such it should also allow you to adopt this library when it is published even in core.

I'm open to suggestions, especially around the function names.


This PR unblocks hashicorp/terraform-schema#35

@radeksimko radeksimko requested a review from a team April 7, 2021 10:36
Copy link
Contributor

@alisdair alisdair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I spotted a typo in a comment, but otherwise ✅

provider.go Outdated Show resolved Hide resolved
Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>
@radeksimko radeksimko merged commit e0cb718 into main Apr 12, 2021
@radeksimko radeksimko deleted the f-raw-vs-inferred branch April 12, 2021 06:46
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.

2 participants