Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alias argument for confluent_subject_config resource #350

Open
AS-auxmoney opened this issue Jan 26, 2024 · 7 comments
Open

Alias argument for confluent_subject_config resource #350

AS-auxmoney opened this issue Jan 26, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@AS-auxmoney
Copy link

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.

@linouk23
Copy link
Collaborator

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?

@AS-auxmoney
Copy link
Author

AS-auxmoney commented Jan 26, 2024

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 linouk23 added the enhancement New feature or request label Feb 20, 2024
@AS-auxmoney
Copy link
Author

@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.

@linouk23
Copy link
Collaborator

@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.

@AS-auxmoney
Copy link
Author

@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.

@linouk23
Copy link
Collaborator

Nice! As long as it's available in the API, we can definitely add it to confluent_subject_config 👍

@AS-auxmoney
Copy link
Author

@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:

  • Subject foo-something-long-bla exists
  • you want to create an alias bar, so that the schema behind the subject foo-something-long-bla is also available for the subject bar

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants