Skip to content

Commit

Permalink
fix: Allow aiven provider to compile without fork
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AaronFriel committed Jan 26, 2023
1 parent 7062321 commit 70901f5
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions pkg/tfbridge/names.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

"github.com/gedex/inflector"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/contract"

shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim"
)
Expand Down Expand Up @@ -102,8 +101,6 @@ func TerraformToPulumiName(name string, sch shim.Schema, ps *SchemaInfo, upper b
casingActivated := false // tolerate leading underscores
for i, c := range name {
if c == '_' && casingActivated {
// skip underscores and make sure the next one is capitalized.
contract.Assertf(!nextCap, "Unexpected duplicate underscore: %v", name)
nextCap = true
} else {
if c != '_' && !casingActivated {
Expand Down

0 comments on commit 70901f5

Please sign in to comment.