pulumi / pulumi-terraform-bridge

A library allowing Terraform providers to be bridged into Pulumi.
Apache License 2.0
199 stars 43 forks source link

Add ability to opt out of singularizing words on properties #2606

Open zbuchheit opened 1 week ago

zbuchheit commented 1 week ago

Hello!

Issue details

Currently if I have an array property the bridge will singularize it. It would be nice to be able to opt out of that functionality.

For example, if I have a field like ConfigValuesArgs array it would be converted to ConfigValueArgs

Affected area/feature

TF Bridge

iwahbe commented 1 week ago

@zbuchheit Do you know if the customer is interested in disabling this globally, or for specific fields or resources.


If they want to disable all type aware case manipulation, I think they can do this:

tfbridge.MustTraverseProperties(&prov, "disable-type-aware-naming",
        func(info tfbridge.PropertyVisitInfo) (tfbridge.PropertyVisitResult, error) {
            p := info.SchemaPath()
            step, ok := p[len(p)-1].(walk.GetAttrStep)
            if !ok {
                return tfbridge.PropertyVisitResult{}, nil
            }

            sInfo := info.SchemaInfo()
            if sInfo.Name != "" {
                return tfbridge.PropertyVisitResult{}, nil
            }
            sInfo.Name = tfbridge.TerraformToPulumiNameV2(step.Name, nil, nil)
            return tfbridge.PropertyVisitResult{HasEffect: true}, nil
        })
zbuchheit commented 4 days ago

I believe they would be interested in disabling this globally, but mainly the interest right now is for specific fields/resources.

They tried the above, but ended up with bunch of overriding non-existent field errors