crossplane / terrajet

Generate Crossplane Providers from any Terraform Provider
https://crossplane.io
Apache License 2.0
289 stars 38 forks source link

Extend "SetIdentifierArgumentFn" interface to support additional parameters like "metadata.name" #280

Open ezgidemirel opened 2 years ago

ezgidemirel commented 2 years ago

What problem are you facing?

Currently, "SetIdentifierArgumentFn" functions can only take "spec.forProvider" and "external-name" parameters. I'd like to pass "metadata.name" field for configuring resources like AWS MQ broker. In this resource, "broker-name" is required and the external name is generated by the cloud provider.

How could Terrajet help solve your problem?

Providing an additional mechanism to configure jet-based resources.

muvaf commented 2 years ago

In this resource, "broker-name" is required and the external name is generated by the cloud provider.

How would metadata.name help in this case?

ezgidemirel commented 2 years ago

Instead of having a spec field called brokerName, I'd like to use metadata.name for XRM compliance.

muvaf commented 2 years ago

When a resource has a name but also queried by an assigned ID, I usually treat the name just like a tag or label since it's not used to identify the resource. XRM suggests that the external name, i.e. the identifier in the external system, should be defaulted to metadata.name so I think it should be fine to keep it in the schema as required. What do you think?

ytsarev commented 2 years ago

@muvaf I hit the same in https://github.com/crossplane-contrib/provider-jet-datadog/blob/main/examples/monitor/monitor.yaml#L8, I want to use metadata.name without semantical duplication in spec . At the same time I cannot use NameAsIdentifier as the resource is always identified by some integer number https://registry.terraform.io/providers/DataDog/datadog/latest/docs/resources/monitor#import