<@U05NAUXQ3N0> Hi, we're trying to build ovh packa...
# package-authoring
q
@thankful-match-46035 Hi, we're trying to build ovh package for Scala SDK for Pulumi. There seems to be a field called
urn
in OVH schema which, as I believe, clashes with Pulumi's URN. Here's an example: https://www.pulumi.com/registry/packages/ovh/api-docs/cloudproject/project/ Is this a genuine naming clash or is OVH
urn
unified with Pulumi's URN somehow? We found out about this when our codegen exploded on naming clash on OVH package.
t
I don’t understand what is the issue? 🙂
l
I had some time for a quick check. In the TF provider, the
ovh_cloud_project
resource has a property
urn
. https://github.com/ovh/terraform-provider-ovh/blob/master/ovh/resource_cloud_project.go#L44-L47 The Pulumi resource model adds
urn
property consistently to each resource type. In this case, the TF
ovh_cloud_project.urn
property needs to be remapped to another name to not conflict with Pulumi's
urn
property. @enough-garden-22763 what is the correct code snippet that needs to be added to the
resources.go
file to have this property remapped/renamed?
t
(thanks ringo now I am understanding 🙂 )
q
yes, precisely, but the problem is in the schema itself here: https://github.com/ovh/pulumi-ovh/blob/main/provider/cmd/pulumi-resource-ovh/schema.json
search for
"urn"
there should be none fields with that name
l
@quaint-spring-93350 the
schema.json
file is generated from the
resources.go
since this is a TF-bridged provider. If we fix
resources.go
and regenerate, it should be ok in the regenerated
schema.json
.
q
ah, cool!
t
@limited-rainbow-51650 if you can help me where i can change the “urn” field in `resources.go`🙏
l
@thankful-match-46035 see earlier up where I asked input myself from @enough-garden-22763. After you have a fix, you should rebuild everything in the Pulumi provider and create a new release.
e
Copy code
"aws_api_gateway_authorizer": {
				Tok: awsResource(apigatewayMod, "Authorizer"),
				Fields: map[string]*tfbridge.SchemaInfo{
					"rest_api_id": {
						Name:     "restApi",
						Type:     "string",
						AltTypes: []tokens.Type{awsTypeDefaultFile(apigatewayMod, "RestApi")},
					},
				},
			},
https://github.com/pulumi/pulumi-aws/blob/6741aee58a981a6b2bcad6eeb497944d5f5b1523/provider/resources.go#L790-#L790 here's a quick example from pulumi-aws that tweaks the name of a field. I think the same could be used here to avoid the conflict on urn. Let me know if this helps.
t
so the field “urn” should be renamed to “URN” or the text “urn” is forbidden in lowercase and uppercase? 🙂
e
Hm, yes, "URN" would be good to try. It's difficult to reason through without trying because I suspect some language projections like C# might reject some casings. I think last time we had something like this we opted for "urn_".
q
same here, we add underscore suffix to reserved field names
alternatively, for readability, it could be
ovhUrn
as that's an OVH-specific identifier
t
it’s not an ovh urn it’s a cloud project urn 😉
So if i understand correctly, i need to do this modification in the
resource.go
file:
Copy code
"ovh_cloud_project": {
				Tok: ovhResource(cloudProjectMod, "Project"),
				Fields: map[string]*tfbridge.SchemaInfo{
					"urn": {
						Name: "ProjectURN",
					},
				},
			},
And, question, should I fix in all resources containing urn field or only coud_project?
v0.34.3 with the fix in progress 🤞