fix(clickpipes): add stopped attribute as a remediation to stuck Terraform plan
#383
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current implementation uses
stateattribute 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
stateattribute.This was remediated by introducing an extra condition in
syncClickPipeStatedisallowing to persist back to the state if received value wasFailedorInternalError. 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:
stateattribute will be changed to a read-only reporting an actual state back. This is considered as a breaking change, and will require user to removestatefrom theirs Terraform plan.stoppedattribute will allow control on pipe state. If you had yourstate = Stoppedpreviously, you will have to setstopped = true.This change is necessary to fix a control over pipe's configuration regardless of a current pipe state.
clickhouse_clickpiperesource 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