Skip to content

Commit 33ff088

Browse files
committed
fix(clickpipes): add stopped attribute as a remediation to stuck Terraform plan
Current implementation uses `state` attribute in two-way interaction: for status feedback and control on ClickPipe lifecycle by stopping/starting ingestion. This does not work well in Terraform. Produced state must be equal to plan, meaning, API could return different ClickPipe state, but Terraform would error with unexpected state value for `state` attribute. This was remediated by introducing an extra condition in `syncClickPipeState` disallowing to persist back to the state if received value was `Failed` or `InternalError`. This was a workaround to not get Terraform complain on provider implementation. In fact, it was a wrong logic, and it has only hidden a root cause of problem. This PR splits status feedback and lifecycle control into two separate attributes: - `state` attribute will be changed to a read-only reporting an actual state back. **This is considered as a breaking change, and will require user to remove `state` from theirs Terraform plan.** - `stopped` attribute will allow control on pipe state. **If you had your `state = Stopped` previously, you will have to set `stopped = true`.** This change is necessary to fix a control over pipe's configuration regardless of a current pipe state. `clickhouse_clickpipe` resource is in alpha builds only. It's considered safe to proceed with this change. Additionally, post-apply status confirmation logic is fixed to retry backoff wait max to 120s.
1 parent 949b0cd commit 33ff088

File tree

19 files changed

+112
-97
lines changed

19 files changed

+112
-97
lines changed

examples/clickpipe/externally_managed_table/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ resource "clickhouse_clickpipe" "kafka_confluent" {
4646
replicas = 1
4747
}
4848

49-
state = "Running"
49+
5050

5151
source = {
5252
kafka = {

examples/clickpipe/kafka_azure_eventhub/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ resource "clickhouse_clickpipe" "kafka_azure_eventhub" {
2424
replicas = 1
2525
}
2626

27-
state = "Running"
27+
2828

2929
source = {
3030
kafka = {

examples/clickpipe/kafka_confluent/main.tf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ resource "clickhouse_clickpipe" "kafka_confluent" {
2828
replicas = 1
2929
}
3030

31-
state = "Running"
32-
3331
source = {
3432
kafka = {
3533
type = "confluent"

examples/clickpipe/kafka_msk_iam_role/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ resource "clickhouse_clickpipe" "kafka_msk" {
2323
replicas = 1
2424
}
2525

26-
state = "Running"
26+
2727

2828
source = {
2929
kafka = {

examples/clickpipe/kafka_msk_iam_user/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ resource "clickhouse_clickpipe" "kafka_msk" {
2828
replicas = 1
2929
}
3030

31-
state = "Running"
31+
3232

3333
source = {
3434
kafka = {

examples/clickpipe/kafka_offset_strategy/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ resource "clickhouse_clickpipe" "kafka_offset_strategy" {
2828
replicas = 1
2929
}
3030

31-
state = "Running"
31+
3232

3333
source = {
3434
kafka = {

examples/clickpipe/kafka_redpanda_scram/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ resource "clickhouse_clickpipe" "kafka_redpanda" {
2828
replicas = 1
2929
}
3030

31-
state = "Running"
31+
3232

3333
source = {
3434
kafka = {

examples/clickpipe/kafka_schema_registry/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ resource "clickhouse_clickpipe" "kafka_schema_registry" {
3939
replicas = 1
4040
}
4141

42-
state = "Running"
42+
4343

4444
source = {
4545
kafka = {

examples/clickpipe/multiple_pipes_example/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ resource "clickhouse_clickpipe" "multiple" {
3232
replica_memory_gb = 1.0
3333
}
3434

35-
state = "Running"
35+
3636

3737
source = {
3838
kafka = {

examples/clickpipe/object_storage_azure_blob/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ variable "azure_path" {
2323
resource "clickhouse_clickpipe" "azure_blob" {
2424
name = "Azure Blob Storage 🚀 ClickPipe"
2525
service_id = var.service_id
26-
state = "Running"
26+
2727
source = {
2828
object_storage = {
2929
type = "azureblobstorage"

0 commit comments

Comments
 (0)