Skip to content

Conversation

@jkaflik
Copy link
Contributor

@jkaflik jkaflik commented Sep 19, 2025

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 making it impossible to manage pipe configuration when it was Failed, 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.

resolves #382

@jkaflik jkaflik requested a review from a team as a code owner September 19, 2025 11:38
@jkaflik jkaflik requested a review from a team September 19, 2025 11:39
Copy link
Collaborator

@whites11 whites11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems ok

…rraform 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.
@jkaflik jkaflik force-pushed the kk/clickpipes-stopped-attribute branch from d8dd79f to 33ff088 Compare September 22, 2025 08:25
@ClickHouse ClickHouse deleted a comment from nikita-vanyasin Sep 22, 2025
@jkaflik jkaflik merged commit 9b4ddcb into main Sep 22, 2025
5 checks passed
@jkaflik jkaflik deleted the kk/clickpipes-stopped-attribute branch September 22, 2025 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clickpipe once in Failed state can't be managed via terraform

3 participants