Open ondrejbilcik opened 1 week ago
@ondrejbilcik can you please share us some example configs and the expected outcomes? This will help us troubleshoot. CC @channingdong
Sure. I set up some test configs to illustrate the issue:
I created the following schema:
{
"name": "Test",
"type": "record",
"namespace": "test.one",
"doc": "This is a test",
"fields": [
{
"name": "test1",
"type": "string",
"doc": "Random string to test the schema"
}
]
}
I updated the schema with the following:
{
"type": "record",
"name": "Test",
"namespace": "test.one",
"doc": "This is a test",
"fields": [
{
"name": "test1",
"type": "string",
"doc": "Random string to test the schema"
},
{
"name": "test2",
"type": "string",
"doc": "Random second string to test the schema",
"default": null
}
]
}
I'd like to revert the change from step two, the apply succeeds
Terraform will perform the following actions:
# module.schemas.confluent_schema.this["ondrej.test"] will be updated in-place
~ resource "confluent_schema" "this" {
id = "1/ondrej.test/latest"
~ schema = jsonencode(
~ {
~ fields = [
{
doc = "Random string to test the schema"
name = "test1"
type = "string"
},
- {
- default = null
- doc = "Random second string to test the schema"
- name = "test2"
- type = "string"
},
]
name = "Test"
# (3 unchanged attributes hidden)
}
)
# (6 unchanged attributes hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions? Terraform will perform the actions described above. Only 'yes' will be accepted to approve.
Enter a value: yes
module.schemas.confluent_schema.this["ondrej.test"]: Modifying... [id=1/ondrej.test/latest] module.schemas.confluent_schema.this["ondrej.test"]: Still modifying... [id=1/ondrej.test/latest, 10s elapsed] module.schemas.confluent_schema.this["ondrej.test"]: Modifications complete after 10s [id=1/ondrej.test/latest]
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.
As you can see below, the schema is still on version two. I would expect either the schema to revert to the previous version, or for terraform to throw an error stating that the change wasn't successfully applied.
![Screenshot 2024-06-19 at 15 47 30](https://github.com/confluentinc/terraform-provider-confluent/assets/52413046/0355c626-f715-4317-9882-47c7d9b9e5c3)
Let me know if you need any more data.
Cheers,
Ondrej
Hi,
We're running into an issue when reverting changes to a schema, when
terraform apply
succeeds however the schema does not revert to the previous version in the registry. We can work around this using an arbitrary version attribute, however theterraform apply
should still throw an error in cases when the attribute isn't changed and thus the change isn't applied to the schema.When TF_LOG=warn is set, the following warning is displayed when applying: