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: Allow aiven provider to compile without fork #742

Merged
merged 1 commit into from
Jan 26, 2023

Conversation

AaronFriel
Copy link
Contributor

@AaronFriel AaronFriel commented Jan 26, 2023

Attempting to use the upstream provider directly fails due to the assert removed here.

I believe this change is safe to make, despite affecting all providers, as the assert causes tfgen to panic. No provider was previously allowed to use double underscores, therefore no backwards incompatible change can be caused by this.

Background:

The Aiven provider has data sources such as:

  • pg_partman_bgw__dot__interval (String)
  • pg_partman_bgw__dot__role (String)
  • pg_stat_statements__dot__track (String)
    (Copied from their changelog.)

The upstream provider uses a pair of routines to map . to __dot__ and vice versa, and the patch in our fork of Aiven modifies that mapping to avoid double underscores:

pulumi/terraform-provider-aiven@296d9e0d

By allowing the bridge to generate the name, the upstream provider can be used without requiring the fork. The casing behavior is preserved, and __dot__ is cased exactly as _dot_ was before.

@AaronFriel AaronFriel force-pushed the friel/allow__double__underscore branch from 06eb24d to 70901f5 Compare January 26, 2023 02:32
@github-actions
Copy link

Diff for pulumi-azuread with merge commit b5a519a

@github-actions
Copy link

Diff for pulumi-random with merge commit 0e3da10

@github-actions
Copy link

Diff for pulumi-random with merge commit b5a519a

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 0e3da10

@github-actions
Copy link

Diff for pulumi-gcp with merge commit b5a519a

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 0e3da10

@github-actions
Copy link

Diff for pulumi-azure with merge commit b5a519a

@github-actions
Copy link

Diff for pulumi-azure with merge commit 0e3da10

Copy link
Member

@iwahbe iwahbe left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines -105 to -106
// skip underscores and make sure the next one is capitalized.
contract.Assertf(!nextCap, "Unexpected duplicate underscore: %v", name)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Might be nice to have a comment explaining that we will ignore duplicate _.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

Attempting to use the upstream provider directly fails due to the assert removed
here.

I believe this change is safe to make, despite affecting all providers, as the
assert causes tfgen to panic. No provider was previously allowed to use double
underscores, therefore no backwards incompatible change can be caused by this.

Background:

The Aiven provider has data sources such as:

> - `pg_partman_bgw__dot__interval` (String)
> - `pg_partman_bgw__dot__role` (String)
> - `pg_stat_statements__dot__track` (String)
(Copied from their changelog.)

The upstream provider uses a pair of routines to map `.` to `__dot__` and vice
versa, and the patch in our fork of Aiven modifies that mapping to avoid double
underscores:

pulumi/terraform-provider-aiven@296d9e0d

By allowing the bridge to generate the name, the upstream provider can be used
without requiring the fork. The casing behavior is preserved, and `__dot__` is
cased exactly as `_dot_` was before.
@AaronFriel AaronFriel force-pushed the friel/allow__double__underscore branch from 70901f5 to 996d506 Compare January 26, 2023 19:57
@AaronFriel AaronFriel merged commit 626180e into master Jan 26, 2023
@AaronFriel AaronFriel deleted the friel/allow__double__underscore branch January 26, 2023 19:57
@github-actions
Copy link

Diff for pulumi-random with merge commit 9974297

@github-actions
Copy link

Diff for pulumi-azuread with merge commit 9974297

@github-actions
Copy link

Diff for pulumi-gcp with merge commit 9974297

@github-actions
Copy link

Diff for pulumi-azure with merge commit 9974297

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