Closed noureddineseddik closed 3 years ago
Thanks @noureddineseddik,
when I started to implement this provider, I considered using the schema Id as the terraform Id. But the problem is that a schema Id is unique across the schema registry, but it can be used onto several subjects. For example, if you create a subject with a given schema content, and another subject with the same schema content, those 2 schemas will get the same schema Id. so you would end up with 2 subjects having the same terraform Id => fail
Then I considered separating the subjects and the schemas, having 2 terraform resources. But the SR Api does not offer a way to create a schema without a subject.
To be honest, given the SR Api current state, I don't see a way to handle this properly...
Do you have anything to add ?
Thanks, I missed that ID
part.
My proposition of having 2 terraform resources to handle the same subject does not make sense anyway.
Is it acceptable to always update a reference version to the latest referenced schema's one as currently implemented in that PR?
Nice contribution @noureddineseddik ! @arkiaconsulting we would be very interested to have this feature merged 💯
Here we go
Why do we need this
see #13
I tried to respect the existing codebase: reuse the same test cases, variable naming, ... This PR is pretty big, but it's mostly tests and documentation, could not find a way to split it. I can rework it if you think of something.
Manually sticking a version is actually harder than expected and is not covered (more on this below). In that PR, I propose to always update a reference version to the latest referenced schema's one.
What changed
DataSource with schema references support & tests:
references
exposed asoutput
value0.3.0
to0.3.1
to fetchreferences
from schema registryResource with schema references support & tests:
references
CustomizeDiff
schema function to explicitly set a version change on schema change and make dependencies aware of a version changed atplan
time (computed field)Examples and readme updated:
main.tf
required provider version to0.6
Sticking a reference to a specific version
This is my first terraform dev, but as I understand it, referencing a referenced resource schema in a given version while updating this referenced schema to a new version would require duplicating the resource, something like:
This is not possible with current implementation as the schema
subject
is used as a terraform schemaID
. One way I see could be to rely on schema id instead but that would introduce too many changes for that PR.Notes
terraform plan
&apply
confluentinc/cp-server:6.1.1
confluentinc/cp-schema-registry:6.1.1
confluentinc/cp-zookeeper:6.1.1