@@ -540,6 +540,97 @@ resource "ibm_cos_bucket_lifecycle_configuration" "lifecycle" {
540540 }
541541}
542542```
543+
544+ ## Bucket Backup
545+
546+ Provides 2 seperate resources - ` ibm_cos_backup_vault ` and ` ibm_cos_backup_policy ` to manage the backup policies and the backup vaults to store the backup of a COS bucket.
547+
548+ ## Example usage
549+
550+ ``` terraform
551+ resource "ibm_cos_bucket" "backup-source-bucket" {
552+ bucket_name = "bucket-name"
553+ resource_instance_id = "cos_instance_id"
554+ cross_region_location = "us"
555+ storage_class = "standard"
556+ object_versioning {
557+ enable = true
558+ }
559+
560+ }
561+
562+
563+ resource "ibm_cos_backup_vault" "backup-vault" {
564+ backup_vault_name = "backup_vault_name"
565+ service_instance_id = "cos_instance_id to create backup vault"
566+ region = "us"
567+ activity_tracking_management_events = true
568+ metrics_monitoring_usage_metrics = true
569+ kms_key_crn = "crn:v1:staging:public:kms:us-south:a/997xxxxxxxxxxxxxxxxxxxxxx54:5xxxxxxxa-fxxb-4xx8-9xx4-f1xxxxxxxxx5:key:af5667d5-dxx5-4xxf-8xxf-exxxxxxxf1d"
570+ }
571+
572+
573+ resource "ibm_iam_authorization_policy" "policy" {
574+ roles = [
575+ "Backup Manager", "Writer"
576+ ]
577+ subject_attributes {
578+ name = "accountId"
579+ value = "account_id of the cos account"
580+ }
581+ subject_attributes {
582+ name = "serviceName"
583+ value = "cloud-object-storage"
584+ }
585+ subject_attributes {
586+ name = "serviceInstance"
587+ value = "exxxxx34-xxxx-xxxx-xxxx-d6xxxxxxxx9"
588+ }
589+ subject_attributes {
590+ name = "resource"
591+ value = "source-bucket-name"
592+ }
593+ subject_attributes {
594+ name = "resourceType"
595+ value = "bucket"
596+ }
597+ resource_attributes {
598+ name = "accountId"
599+ operator = "stringEquals"
600+ value = "account id of the cos account of backup vault"
601+ }
602+ resource_attributes {
603+ name = "serviceName"
604+ operator = "stringEquals"
605+ value = "cloud-object-storage"
606+ }
607+ resource_attributes {
608+ name = "serviceInstance"
609+ operator = "stringEquals"
610+ value = "exxxxx34-xxxx-xxxx-xxxx-d6xxxxxxxx9"
611+ }
612+ resource_attributes {
613+ name = "resource"
614+ operator = "stringEquals"
615+ value = "backup-vault-name"
616+ }
617+ resource_attributes {
618+ name = "resourceType"
619+ operator = "stringEquals"
620+ value = "backup-vault"
621+ }
622+ }
623+
624+ resource "ibm_cos_backup_policy" "policy" {
625+ bucket_crn = ibm_cos_bucket.bucket.crn
626+ initial_delete_after_days = 2
627+ policy_name = "policy_name"
628+ target_backup_vault_crn = ibm_cos_backup_vault.backup-vault.backup_vault_crn
629+ backup_type = "continuous"
630+ }
631+
632+ ```
633+
543634<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
544635
545636## Requirements
@@ -625,5 +716,14 @@ resource "ibm_cos_bucket_lifecycle_configuration" "lifecycle" {
625716| object_size_greater_than | Expiration rule will be applicable to the objects having size greater than specified value of his argument. | ` int ` | No
626717| object_size_less_than | Expiration rule will be applicable to the objects having size lesser than specified value of his argument. | ` int ` | No
627718| tag | Expiration rule will be applicable to the objects having the key-value tags specified by this attribute. | ` object ` | Yes
628-
719+ | backup_vault_name | Name of the backup vault. | ` string ` | Yes |
720+ | service_instance_id | CRN of the COS instance where the backup vault is to be created. | ` string ` | Yes |
721+ | activity_tracking_management_events | Whether to send notification for the management events for backup vault. | ` bool ` | No |
722+ | metrics_monitoring_usage_metrics | Whether usage metrics are collected for this backup vault. | ` bool ` | No |
723+ | kms_key_crn | Crn of the Key protect root. | ` string ` | No |
724+ | bucket_crn | CRN of the source bucket. | ` string ` | Yes |
725+ | initial_delete_after_days | Number of days after which the data contained within the RecoveryRange will be deleted. | ` int ` | Yes |
726+ | policy_name | Name of the policy. | ` string ` | Yes |
727+ | backup_type | Backup type. Currently only ` continuous ` is supported. | ` string ` | Yes |
728+ | target_backup_vault_crn | CRN of the target backup vault. | ` string ` | Yes |
629729{: caption="inputs"}
0 commit comments