Error Using Backup_start_time In Clickhouse_service
Introduction
When creating or updating a clickhouse_service
resource in Terraform, you may encounter an error when using the backup_start_time
attribute in conjunction with backup_period_in_hours
. This issue can occur both when creating a new resource and when updating an existing one to use backup_period_in_hours
instead of backup_retention_period_in_hours
. In this article, we will explore the error message, provide examples of the issue, and discuss possible solutions.
Error Message
The error message returned by Terraform when using backup_start_time
with backup_period_in_hours
is:
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to module.provisional_regional_r0.module.clickhouse[0].clickhouse_service.service, provider
│ "provider[\"registry.terraform.io/clickhouse/clickhouse\"]" produced an unexpected new value: .backup_configuration.backup_period_in_hours: was
│ cty.NumberIntVal(24), but now null.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
Example: Net New
Let's consider an example of creating a new clickhouse_service
resource with backup_start_time
and backup_period_in_hours
:
resource "clickhouse_service" "service" {
...
backup_configuration = {
backup_period_in_hours = 24
backup_retention_period_in_hours = 24
backup_start_time = "02:00"
}
}
When you run terraform apply
, you may encounter the following error:
❯ terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# clickhouse_service.service will be created
+ resource "clickhouse_service" "service" {
+ backup_configuration = {
+ backup_period_in_hours = 24
+ backup_retention_period_in_hours = 24
+ backup_start_time = "02:00"
}
...
}
Plan: 1 to add, 0 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
clickhouse_service.service: Creating...
clickhouse_service.service: Still creating... ...
â•·
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to clickhouse_service.service, provider "provider[\"registry.terraform.io/clickhouse/clickhouse\"]" produced an unexpected new value:
│ .backup_configuration.backup_period_in_hours: was cty.NumberIntVal(24), but now null.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
Example: Update Existing
Let's consider an example of updating an existing clickhouse_service
resource to use backup_start_time
with backup_period_in_hours
:
-
Original configuration:
resource "clickhouse_service" "service" { ... backup_configuration = { backup_period_in_hours = 24 backup_retention_period_in_hours = 24 } }
2. Apply successful...
3. Update configuration:
```hcl
resource "clickhouse_service" "service" {
...
backup_configuration = {
backup_period_in_hours = 24
backup_start_time = "02:00"
}
}
-
Apply fails:
❯ terraform apply clickhouse_service.service: Refreshing state... [id=xxx]
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place
Terraform will perform the following actions:
~ resource "clickhouse_service" "service" ~ backup_configuration = { + backup_start_time = "02 ... }
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
clickhouse_service.service: Modifying... [id=xxx] ╷ │ Error: Provider produced inconsistent result after apply │ │ When applying changes to clickhouse_service.service, provider "provider["registry.terraform.io/clickhouse/clickhouse"]" produced an unexpected new value: │ .backup_configuration.backup_period_in_hours: was cty.NumberIntVal(24), but now null. │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker.
**Conclusion**
----------
In conclusion, the error using `backup_start_time` in `clickhouse_service` is a known issue in the ClickHouse provider for Terraform. When creating or updating a `clickhouse_service` resource, you may encounter an error when using `backup_start_time` with `backup_period_in_hours`. This issue can occur both when creating a new resource and when updating an existing one to use `backup_period_in_hours` instead of `backup_retention_period_in_hours`. To resolve this issue, you can report the bug in the provider's own issue tracker or use alternative configuration options.
**Workaround**
-------------
As a workaround, you can use the `backup_retention_period_in_hours` attribute instead of `backup_period_in_hours` when using `backup_start_time`. This will allow you to create or update a `clickhouse_service` resource without encountering the error.
```hcl
resource "clickhouse_service" "service" {
...
backup_configuration = {
backup_retention_period_in_hours = 24
backup_start_time = "02:00"
}
}
Q: What is the error using backup_start_time in clickhouse_service?
A: The error using backup_start_time
in clickhouse_service
is a known issue in the ClickHouse provider for Terraform. When creating or updating a clickhouse_service
resource, you may encounter an error when using backup_start_time
with backup_period_in_hours
. This issue can occur both when creating a new resource and when updating an existing one to use backup_period_in_hours
instead of backup_retention_period_in_hours
.
Q: What is the error message?
A: The error message returned by Terraform when using backup_start_time
with backup_period_in_hours
is:
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to module.provisional_regional_r0.module.clickhouse[0].clickhouse_service.service, provider
│ "provider[\"registry.terraform.io/clickhouse/clickhouse\"]" produced an unexpected new value: .backup_configuration.backup_period_in_hours: was
│ cty.NumberIntVal(24), but now null.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
Q: What are the possible causes of this error?
A: The possible causes of this error are:
- Using
backup_start_time
withbackup_period_in_hours
in aclickhouse_service
resource. - Updating an existing
clickhouse_service
resource to usebackup_period_in_hours
instead ofbackup_retention_period_in_hours
. - Creating a new
clickhouse_service
resource withbackup_start_time
andbackup_period_in_hours
.
Q: How can I resolve this error?
A: To resolve this error, you can:
- Report the bug in the provider's own issue tracker.
- Use alternative configuration options, such as
backup_retention_period_in_hours
instead ofbackup_period_in_hours
. - Use a workaround, such as setting
backup_period_in_hours
to a value of 0.
Q: What is the workaround for this error?
A: The workaround for this error is to use the backup_retention_period_in_hours
attribute instead of backup_period_in_hours
when using backup_start_time
. This will allow you to create or update a clickhouse_service
resource without encountering the error.
resource "clickhouse_service" "service" {
...
backup_configuration = {
backup_retention_period_in_hours = 24
backup_start_time = "02:00"
}
}
Q: Is this error specific to Terraform?
A: No, this error is not specific to Terraform. It is a known issue in the ClickHouse provider for Terraform.
Q: How can I prevent this error from occurring in the future?
A: To prevent this error from occurring in the future, you can:
- Use the
backup_retention_period_in_hours
attribute instead ofbackup_period_in_hours
when usingbackup_start_time
. - Report the bug in the provider's own issue tracker to ensure that it is addressed in future releases.
- Use a workaround, such as setting
backup_period_in_hours
to a value of 0.