Open AS-auxmoney opened 5 months ago
Thank you for creating this issue @AS-auxmoney!
Could you also share an example of you you'd want it to look like in TF?
Hi @linouk23, thanks for the fast response.
I guess something like this:
resource "confluent_subject_config" "example" {
schema_registry_cluster {
id = confluent_schema_registry_region.essentials.id
}
rest_endpoint = confluent_schema_registry_cluster.essentials.rest_endpoint
subject_name = "topic_name-event_name-value"
alias = "event_name"
...
}
@linouk23 Btw, are you open to contributions? I have already implemented some features for another provider (with another github account, this is my work account), therefore I am quite confident about this feature.
@AS-auxmoney all contributions are very welcome!
I've got a quick question: Is this alias
attribute available in SR API as well? Ideally we want all clients (TF, CLI, UI, etc) to have unified experience.
@linouk23 To my knowledge, it is only available through the SR API and not at all through CLI or UI:
And there is no way to look up all existing alias, it is only possible to look up, if a specific alias exist.
Nice! As long as it's available in the API, we can definitely add it to confluent_subject_config
👍
@linouk23 I got a deeper look into this matter and this is way more complicated than expected. The problem: You are not supposed to set an alias on an existing subject, but you are supposed to set an alias and reference it to the existing subject.
Example:
Wrong:
curl --request PUT --url 0.0.0.0:8081/config/foo-something-long-bla --data '{"alias":"bar"}' --header 'content-type: application/octet-stream'
Correct:
curl --request PUT --url 0.0.0.0:8081/config/bar --data '{"alias":"foo-something-long-bla"}' --header 'content-type: application/octet-stream'
Only then the same is returned in both cases
curl 0.0.0.0:8081/subjects/foo-something-long-bla/versions/1
curl 0.0.0.0:8081/subjects/bar/versions/1
So, lets come to the actual problem. The ccloud SDK is implemented in the wrong way for the alias feature. When naively using createConfigRequest.SetAlias(alias)
from the SDK (as I have done), then the wrong request is made to the SR API. An alias is set, but it does not work.
Please add the alias argument to the resource confluent_subject_config, so it will be possible to define aliases for schema subject names. See https://docs.confluent.io/platform/current/schema-registry/fundamentals/index.html#subject-aliases for details.
If welcomed, I can work on a pull request.