Skip to content

Commit 854092b

Browse files
committed
fix: Update clickhouse backup retention
1 parent 5c2cf78 commit 854092b

File tree

5 files changed

+21
-7
lines changed

5 files changed

+21
-7
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ https://docs.datafold.com/datafold-deployment/dedicated-cloud/aws
267267
| <a name="input_apply_major_upgrade"></a> [apply\_major\_upgrade](#input\_apply\_major\_upgrade) | Sets the flag to allow AWS to apply major upgrade on the maintenance plan schedule. | `bool` | `false` | no |
268268
| <a name="input_az_index"></a> [az\_index](#input\_az\_index) | Index of the availability zone | `number` | `0` | no |
269269
| <a name="input_backend_app_port"></a> [backend\_app\_port](#input\_backend\_app\_port) | The target port to use for the backend services | `number` | `80` | no |
270+
| <a name="input_backup_lifecycle_expiration_days"></a> [backup\_lifecycle\_expiration\_days](#input\_backup\_lifecycle\_expiration\_days) | Number of days after which clickhouse backup objects will expire and be deleted. | `number` | `6` | no |
270271
| <a name="input_ch_data_ebs_iops"></a> [ch\_data\_ebs\_iops](#input\_ch\_data\_ebs\_iops) | IOPS of EBS volume | `number` | `3000` | no |
271272
| <a name="input_ch_data_ebs_throughput"></a> [ch\_data\_ebs\_throughput](#input\_ch\_data\_ebs\_throughput) | Throughput of EBS volume | `number` | `1000` | no |
272273
| <a name="input_ch_logs_ebs_iops"></a> [ch\_logs\_ebs\_iops](#input\_ch\_logs\_ebs\_iops) | IOPS of EBS volume | `number` | `3000` | no |
@@ -366,7 +367,7 @@ https://docs.datafold.com/datafold-deployment/dedicated-cloud/aws
366367
| <a name="input_s3_clickhouse_backup_tags"></a> [s3\_clickhouse\_backup\_tags](#input\_s3\_clickhouse\_backup\_tags) | The extra tags to be applied to the S3 clickhouse backup bucket | `map(any)` | `{}` | no |
367368
| <a name="input_self_managed_node_grp_instance_type"></a> [self\_managed\_node\_grp\_instance\_type](#input\_self\_managed\_node\_grp\_instance\_type) | Ref. https://github.com/awslabs/amazon-eks-ami/blob/master/files/eni-max-pods.txt | `string` | `"THe instance type for the self managed node group."` | no |
368369
| <a name="input_self_managed_node_grps"></a> [self\_managed\_node\_grps](#input\_self\_managed\_node\_grps) | Ref. https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/latest/submodules/self-managed-node-group | `any` | `{}` | no |
369-
| <a name="input_service_account_prefix"></a> [service\_account\_prefix](#input\_service\_account\_prefix) | Prefix for service account names to match Helm chart naming (e.g., 'datafold-' for 'datafold-server', or '' for no prefix) | `string` | `"datafold-"` | no |
370+
| <a name="input_service_account_prefix"></a> [service\_account\_prefix](#input\_service\_account\_prefix) | Prefix for service account names to match Helm chart naming (e.g., 'datafold-' for 'datafold-server', or '' for no prefix) | `string` | `""` | no |
370371
| <a name="input_sg_tags"></a> [sg\_tags](#input\_sg\_tags) | The extra tags to be applied to the security group | `map(any)` | `{}` | no |
371372
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to apply to the general module | `any` | `{}` | no |
372373
| <a name="input_use_default_rds_kms_key"></a> [use\_default\_rds\_kms\_key](#input\_use\_default\_rds\_kms\_key) | Flag weither or not to use the default RDS KMS encryption key. Not recommended. | `bool` | `false` | no |

main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,11 @@ locals {
172172
module "clickhouse_backup" {
173173
source = "./modules/clickhouse_backup"
174174

175-
deployment_name = var.deployment_name
176-
clickhouse_s3_bucket = var.clickhouse_s3_bucket
177-
s3_clickhouse_backup_tags = var.s3_clickhouse_backup_tags
178-
s3_backup_bucket_name_override = var.s3_backup_bucket_name_override
175+
deployment_name = var.deployment_name
176+
clickhouse_s3_bucket = var.clickhouse_s3_bucket
177+
s3_clickhouse_backup_tags = var.s3_clickhouse_backup_tags
178+
s3_backup_bucket_name_override = var.s3_backup_bucket_name_override
179+
backup_lifecycle_expiration_days = var.backup_lifecycle_expiration_days
179180
}
180181

181182
locals {

modules/clickhouse_backup/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ resource "aws_s3_bucket_lifecycle_configuration" "clickhouse_backup" {
1616
bucket = aws_s3_bucket.clickhouse_backup.bucket
1717

1818
rule {
19-
id = "two_week_retention"
19+
id = "backup_retention"
2020
expiration {
21-
days = 14
21+
days = var.backup_lifecycle_expiration_days
2222
}
2323
filter {}
2424
status = "Enabled"

modules/clickhouse_backup/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,9 @@ variable "s3_backup_bucket_name_override" {
2323
default = ""
2424
description = "Bucket name override."
2525
}
26+
27+
variable "backup_lifecycle_expiration_days" {
28+
type = number
29+
default = 6
30+
description = "Number of days after which clickhouse backup objects will expire and be deleted."
31+
}

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,12 @@ variable "s3_backup_bucket_name_override" {
655655
description = "Bucket name override."
656656
}
657657

658+
variable "backup_lifecycle_expiration_days" {
659+
type = number
660+
default = 6
661+
description = "Number of days after which clickhouse backup objects will expire and be deleted."
662+
}
663+
658664
# ┏━┓┏━╸╺┳┓╻┏━┓
659665
# ┣┳┛┣╸ ┃┃┃┗━┓
660666
# ╹┗╸┗━╸╺┻┛╹┗━┛

0 commit comments

Comments
 (0)