Skip to content

Commit b82ac65

Browse files
authored
feat: added fix to logic that determines the "endpoint"<br>- updated chart and image versions to 7.2.16<br>- updated the default namespace to "ibm-brs-data-source-connector" (NOTE: If you are upgrading from a previous release, this will be a disruptive change. to prevent disruption, explicitly set the dsc_namespace input back to "data-source-connector") (#7)
1 parent 6906b4d commit b82ac65

File tree

7 files changed

+85
-40
lines changed

7 files changed

+85
-40
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ You need the following permissions to run this module:
154154
| <a name="input_connection_id"></a> [connection\_id](#input\_connection\_id) | Connection ID for the backup service | `string` | n/a | yes |
155155
| <a name="input_dsc_chart"></a> [dsc\_chart](#input\_dsc\_chart) | Name of the Data Source connector Helm chart. | `string` | `"cohesity-dsc-chart"` | no |
156156
| <a name="input_dsc_chart_location"></a> [dsc\_chart\_location](#input\_dsc\_chart\_location) | OCI registry location of the Data Source Connector Helm chart. | `string` | `"oci://icr.io/ext/brs"` | no |
157-
| <a name="input_dsc_chart_version"></a> [dsc\_chart\_version](#input\_dsc\_chart\_version) | Version of the Data Source Connector Helm chart to deploy. | `string` | `"7.2.15-release-20250721-6aa24701"` | no |
158-
| <a name="input_dsc_image_version"></a> [dsc\_image\_version](#input\_dsc\_image\_version) | Container image for the Data Source Connector. | `string` | `"icr.io/ext/brs/cohesity-data-source-connector_7.2.15-release-20250721:6aa24701@sha256:e23ce2167e62395f2b01d77cf63fee497c5fe786f03c06a62b00313e465ef837"` | no |
157+
| <a name="input_dsc_chart_version"></a> [dsc\_chart\_version](#input\_dsc\_chart\_version) | Version of the Data Source Connector Helm chart to deploy. | `string` | `"7.2.16-release-20251014-fbc7ff85"` | no |
158+
| <a name="input_dsc_image_version"></a> [dsc\_image\_version](#input\_dsc\_image\_version) | Container image for the Data Source Connector. | `string` | `"icr.io/ext/brs/cohesity-data-source-connector:7.2.16@sha256:2674c764ca46310aef3adb733d950f7786d9bf560bf72c22cff52370e77e29b5"` | no |
159159
| <a name="input_dsc_name"></a> [dsc\_name](#input\_dsc\_name) | Release name for the Data Source Connector Helm deployment. | `string` | `"dsc"` | no |
160-
| <a name="input_dsc_namespace"></a> [dsc\_namespace](#input\_dsc\_namespace) | The cluster namespace where the Data Source Connector will be installed. Will be created if it does not exist. | `string` | `"data-source-connector"` | no |
160+
| <a name="input_dsc_namespace"></a> [dsc\_namespace](#input\_dsc\_namespace) | The cluster namespace where the Data Source Connector will be installed. Will be created if it does not exist. | `string` | `"ibm-brs-data-source-connector"` | no |
161161
| <a name="input_dsc_registration_token"></a> [dsc\_registration\_token](#input\_dsc\_registration\_token) | Registration token generated in the Backup & Recovery Service UI when adding a cluster data source. | `string` | n/a | yes |
162162
| <a name="input_dsc_replicas"></a> [dsc\_replicas](#input\_dsc\_replicas) | Number of Data Source Connector podsto run.<br/>Recommended values:<br/> • 3 – for high availability across multiple nodes/zones (strongly recommended in production)<br/> • 1 – only for dev/test or single-node clusters | `number` | `1` | no |
163163
| <a name="input_kube_type"></a> [kube\_type](#input\_kube\_type) | Specify the type of target cluster for the backup and recovery. Accepted values are `openshift` or `kubernetes`. | `string` | `"openshift"` | no |
164164
| <a name="input_policy"></a> [policy](#input\_policy) | The backup schedule and retentions of a Protection Policy. | <pre>object({<br/> name = string<br/> schedule = object({<br/> unit = string # Minutes, Hours, Days, Weeks, Months, Years, Runs<br/> frequency = number # required when unit is Minutes/Hours/Days<br/><br/> # Optional extra layers (allowed even when unit = Minutes)<br/> minute_schedule = optional(object({ frequency = number }))<br/> hour_schedule = optional(object({ frequency = number }))<br/> day_schedule = optional(object({ frequency = number }))<br/> week_schedule = optional(object({ day_of_week = list(string) }))<br/> month_schedule = optional(object({<br/> day_of_week = optional(list(string))<br/> week_of_month = optional(string) # First, Second, Third, Fourth, Last<br/> day_of_month = optional(number)<br/> }))<br/> year_schedule = optional(object({ day_of_year = string })) # First, Last<br/> })<br/><br/> retention = object({<br/> duration = number<br/> unit = string # Days, Weeks, Months, Years<br/><br/> data_lock_config = optional(object({<br/> mode = string # Compliance, Administrative<br/> unit = string # Days, Weeks, Months, Years<br/> duration = number<br/> enable_worm_on_external_target = optional(bool, false)<br/> }))<br/> })<br/><br/> use_default_backup_target = optional(bool, true)<br/> })</pre> | <pre>{<br/> "name": "default-policy",<br/> "retention": {<br/> "duration": 4,<br/> "unit": "Weeks"<br/> },<br/> "schedule": {<br/> "frequency": 6,<br/> "unit": "Hours"<br/> },<br/> "use_default_backup_target": true<br/>}</pre> | no |
165-
| <a name="input_registration_images"></a> [registration\_images](#input\_registration\_images) | The images required for backup and recovery registration. | <pre>object({<br/> data_mover = string<br/> velero = string<br/> velero_aws_plugin = string<br/> velero_openshift_plugin = string<br/> init_container = optional(string, null)<br/> })</pre> | <pre>{<br/> "data_mover": "icr.io/ext/brs/cohesity-datamover:7.2.15-p2@sha256:6d1c55ec9d3f4a08cab7595b3d70d489e53c8f5ca310c141da5068755a46a282",<br/> "velero": "icr.io/ext/brs/velero:7.2.15-p2@sha256:1a5ee2393f0b1063ef095246d304c1ec4648c3af6a47261325ef039256a4a041",<br/> "velero_aws_plugin": "icr.io/ext/brs/velero-plugin-for-aws:7.2.15-p2@sha256:dbcd35bcbf0d4c7deeae67b7dfd55c4fa51880b61307d71eeea3e9e84a370e13",<br/> "velero_openshift_plugin": "icr.io/ext/brs/velero-plugin-for-openshift:7.2.15-p2@sha256:6b643edcb920ad379c9ef1e2cca112a2ad0a1d55987f9c27af4022f7e3b19552"<br/>}</pre> | no |
165+
| <a name="input_registration_images"></a> [registration\_images](#input\_registration\_images) | The images required for backup and recovery registration. | <pre>object({<br/> data_mover = string<br/> velero = string<br/> velero_aws_plugin = string<br/> velero_openshift_plugin = string<br/> init_container = optional(string, null)<br/> })</pre> | <pre>{<br/> "data_mover": "icr.io/ext/brs/cohesity-datamover:7.2.16@sha256:f7fa1cfbb74e469117d553c02deedf6f4a35b3a61647028a9424be346fc3eb09",<br/> "velero": "icr.io/ext/brs/velero:7.2.16@sha256:1a5ee2393f0b1063ef095246d304c1ec4648c3af6a47261325ef039256a4a041",<br/> "velero_aws_plugin": "icr.io/ext/brs/velero-plugin-for-aws:7.2.16@sha256:dbcd35bcbf0d4c7deeae67b7dfd55c4fa51880b61307d71eeea3e9e84a370e13",<br/> "velero_openshift_plugin": "icr.io/ext/brs/velero-plugin-for-openshift:7.2.16@sha256:6b643edcb920ad379c9ef1e2cca112a2ad0a1d55987f9c27af4022f7e3b19552"<br/>}</pre> | no |
166166
| <a name="input_registration_name"></a> [registration\_name](#input\_registration\_name) | Name of the registration. | `string` | n/a | yes |
167167
| <a name="input_wait_till"></a> [wait\_till](#input\_wait\_till) | To avoid long wait times when you run your Terraform code, you can specify the stage when you want Terraform to mark the cluster resource creation as completed. Depending on what stage you choose, the cluster creation might not be fully completed and continues to run in the background. However, your Terraform code can continue to run without waiting for the cluster to be fully created. Supported args are `MasterNodeReady`, `OneWorkerNodeReady`, `IngressReady` and `Normal` | `string` | `"Normal"` | no |
168168
| <a name="input_wait_till_timeout"></a> [wait\_till\_timeout](#input\_wait\_till\_timeout) | Timeout for wait\_till in minutes. | `number` | `90` | no |

examples/kubernetes/main.tf

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,44 @@ module "resource_group" {
1818
########################################################################################################################
1919

2020
resource "ibm_is_vpc" "vpc" {
21+
count = var.cluster_name_id == null ? 1 : 0
2122
name = "${var.prefix}-vpc"
2223
resource_group = module.resource_group.resource_group_id
2324
address_prefix_management = "auto"
2425
tags = var.resource_tags
2526
}
2627

2728
resource "ibm_is_public_gateway" "gateway" {
29+
count = var.cluster_name_id == null ? 1 : 0
2830
name = "${var.prefix}-gateway-1"
29-
vpc = ibm_is_vpc.vpc.id
31+
vpc = ibm_is_vpc.vpc[0].id
3032
resource_group = module.resource_group.resource_group_id
3133
zone = "${var.region}-1"
3234
}
3335

3436
resource "ibm_is_subnet" "subnet_zone_1" {
37+
count = var.cluster_name_id == null ? 1 : 0
3538
name = "${var.prefix}-subnet-1"
36-
vpc = ibm_is_vpc.vpc.id
39+
vpc = ibm_is_vpc.vpc[0].id
3740
resource_group = module.resource_group.resource_group_id
3841
zone = "${var.region}-1"
3942
total_ipv4_address_count = 256
40-
public_gateway = ibm_is_public_gateway.gateway.id
43+
public_gateway = ibm_is_public_gateway.gateway[0].id
4144
}
4245

4346
##############################################################################
4447
# Create a Kubernetes cluster with 3 worker nodes
4548
##############################################################################
4649

4750
resource "ibm_container_vpc_cluster" "cluster" {
51+
count = var.cluster_name_id == null ? 1 : 0
4852
name = "${var.prefix}-cluster"
49-
vpc_id = ibm_is_vpc.vpc.id
53+
vpc_id = ibm_is_vpc.vpc[0].id
5054
flavor = "bx2.4x16"
5155
resource_group_id = module.resource_group.resource_group_id
5256
worker_count = 2
5357
zones {
54-
subnet_id = ibm_is_subnet.subnet_zone_1.id
58+
subnet_id = ibm_is_subnet.subnet_zone_1[0].id
5559
name = "${var.region}-1"
5660
}
5761
wait_till = "IngressReady"
@@ -60,8 +64,13 @@ resource "ibm_container_vpc_cluster" "cluster" {
6064
disable_outbound_traffic_protection = true
6165
}
6266

67+
data "ibm_container_vpc_cluster" "cluster" {
68+
name = var.cluster_name_id != null ? var.cluster_name_id : ibm_container_vpc_cluster.cluster[0].name
69+
resource_group_id = module.resource_group.resource_group_id
70+
}
71+
6372
data "ibm_container_cluster_config" "cluster_config" {
64-
cluster_name_id = ibm_container_vpc_cluster.cluster.id
73+
cluster_name_id = data.ibm_container_vpc_cluster.cluster.id
6574
resource_group_id = module.resource_group.resource_group_id
6675
admin = true
6776
}
@@ -96,18 +105,20 @@ module "backup_recovery_instance" {
96105

97106

98107
module "backup_recover_protect_ocp" {
99-
source = "../.."
100-
cluster_id = ibm_container_vpc_cluster.cluster.id
101-
cluster_resource_group_id = module.resource_group.resource_group_id
102-
dsc_registration_token = module.backup_recovery_instance.registration_token
103-
kube_type = "kubernetes"
104-
connection_id = module.backup_recovery_instance.connection_id
108+
source = "../.."
109+
cluster_id = data.ibm_container_vpc_cluster.cluster.id
110+
cluster_resource_group_id = module.resource_group.resource_group_id
111+
cluster_config_endpoint_type = "private"
112+
add_dsc_rules_to_cluster_sg = false
113+
dsc_registration_token = module.backup_recovery_instance.registration_token
114+
kube_type = "kubernetes"
115+
connection_id = module.backup_recovery_instance.connection_id
105116
# --- B&R Instance ---
106117
brs_instance_guid = module.backup_recovery_instance.brs_instance_guid
107118
brs_instance_region = var.region
108119
brs_endpoint_type = "public"
109120
brs_tenant_id = module.backup_recovery_instance.tenant_id
110-
registration_name = ibm_container_vpc_cluster.cluster.name
121+
registration_name = data.ibm_container_vpc_cluster.cluster.name
111122
# --- Backup Policy ---
112123
policy = {
113124
name = "${var.prefix}-retention"

examples/kubernetes/variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,14 @@ variable "region" {
3333
description = "Region where resources are created."
3434
default = "us-east"
3535
}
36+
37+
variable "cluster_name_id" {
38+
type = string
39+
description = <<EOT
40+
Name or ID of the existing Kubernetes cluster to protect.
41+
If left empty (null, which is the default), this example will automatically create a new VPC
42+
and provision a Kubernetes cluster for you.
43+
If you provide a value, the module will use that existing cluster instead of creating a new one.
44+
EOT
45+
default = null
46+
}

examples/openshift/main.tf

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,29 @@ module "resource_group" {
1818
########################################################################################################################
1919

2020
resource "ibm_is_vpc" "vpc" {
21+
count = var.cluster_name_id == null ? 1 : 0
2122
name = "${var.prefix}-vpc"
2223
resource_group = module.resource_group.resource_group_id
2324
address_prefix_management = "auto"
2425
tags = var.resource_tags
2526
}
2627

2728
resource "ibm_is_public_gateway" "gateway" {
29+
count = var.cluster_name_id == null ? 1 : 0
2830
name = "${var.prefix}-gateway-1"
29-
vpc = ibm_is_vpc.vpc.id
31+
vpc = ibm_is_vpc.vpc[0].id
3032
resource_group = module.resource_group.resource_group_id
3133
zone = "${var.region}-1"
3234
}
3335

3436
resource "ibm_is_subnet" "subnet_zone_1" {
37+
count = var.cluster_name_id == null ? 1 : 0
3538
name = "${var.prefix}-subnet-1"
36-
vpc = ibm_is_vpc.vpc.id
39+
vpc = ibm_is_vpc.vpc[0].id
3740
resource_group = module.resource_group.resource_group_id
3841
zone = "${var.region}-1"
3942
total_ipv4_address_count = 256
40-
public_gateway = ibm_is_public_gateway.gateway.id
43+
public_gateway = ibm_is_public_gateway.gateway[0].id
4144
}
4245

4346
########################################################################################################################
@@ -48,9 +51,9 @@ locals {
4851
cluster_vpc_subnets = {
4952
default = [
5053
{
51-
id = ibm_is_subnet.subnet_zone_1.id
52-
cidr_block = ibm_is_subnet.subnet_zone_1.ipv4_cidr_block
53-
zone = ibm_is_subnet.subnet_zone_1.zone
54+
id = ibm_is_subnet.subnet_zone_1[0].id
55+
cidr_block = ibm_is_subnet.subnet_zone_1[0].ipv4_cidr_block
56+
zone = ibm_is_subnet.subnet_zone_1[0].zone
5457
}
5558
]
5659
}
@@ -67,23 +70,30 @@ locals {
6770
}
6871

6972
module "ocp_base" {
73+
count = var.cluster_name_id == null ? 1 : 0
7074
source = "terraform-ibm-modules/base-ocp-vpc/ibm"
7175
version = "3.71.3"
7276
resource_group_id = module.resource_group.resource_group_id
7377
region = var.region
7478
tags = var.resource_tags
7579
cluster_name = "${var.prefix}-cluster"
7680
force_delete_storage = true
77-
vpc_id = ibm_is_vpc.vpc.id
81+
vpc_id = ibm_is_vpc.vpc[0].id
7882
vpc_subnets = local.cluster_vpc_subnets
7983
ocp_version = var.ocp_version
8084
worker_pools = local.worker_pools
8185
access_tags = var.access_tags
8286
ocp_entitlement = var.ocp_entitlement
8387
}
8488

89+
data "ibm_container_vpc_cluster" "cluster" {
90+
count = var.cluster_name_id == null ? 0 : 1
91+
name = var.cluster_name_id != null ? var.cluster_name_id : module.ocp_base[0].cluster_name
92+
resource_group_id = module.resource_group.resource_group_id
93+
}
94+
8595
data "ibm_container_cluster_config" "cluster_config" {
86-
cluster_name_id = module.ocp_base.cluster_id
96+
cluster_name_id = var.cluster_name_id == null ? module.ocp_base[0].cluster_id : data.ibm_container_vpc_cluster.cluster[0].name
8797
resource_group_id = module.resource_group.resource_group_id
8898
admin = true
8999
}
@@ -118,18 +128,20 @@ module "backup_recovery_instance" {
118128

119129

120130
module "backup_recover_protect_ocp" {
121-
source = "../.."
122-
cluster_id = module.ocp_base.cluster_id
123-
cluster_resource_group_id = module.resource_group.resource_group_id
124-
dsc_registration_token = module.backup_recovery_instance.registration_token
125-
kube_type = "openshift"
126-
connection_id = module.backup_recovery_instance.connection_id
131+
source = "../.."
132+
cluster_id = var.cluster_name_id == null ? module.ocp_base[0].cluster_id : data.ibm_container_vpc_cluster.cluster[0].id
133+
cluster_resource_group_id = module.resource_group.resource_group_id
134+
cluster_config_endpoint_type = "private"
135+
add_dsc_rules_to_cluster_sg = false
136+
dsc_registration_token = module.backup_recovery_instance.registration_token
137+
kube_type = "openshift"
138+
connection_id = module.backup_recovery_instance.connection_id
127139
# --- B&R Instance ---
128140
brs_instance_guid = module.backup_recovery_instance.brs_instance_guid
129141
brs_instance_region = var.region
130142
brs_endpoint_type = "public"
131143
brs_tenant_id = module.backup_recovery_instance.tenant_id
132-
registration_name = module.ocp_base.cluster_name
144+
registration_name = var.cluster_name_id == null ? module.ocp_base[0].cluster_name : data.ibm_container_vpc_cluster.cluster[0].name
133145
# --- Backup Policy ---
134146
policy = {
135147
name = "${var.prefix}-retention"

examples/openshift/variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,14 @@ variable "ocp_entitlement" {
5151
description = "Value that is applied to the entitlements for OCP cluster provisioning"
5252
default = null
5353
}
54+
55+
variable "cluster_name_id" {
56+
type = string
57+
description = <<EOT
58+
Name or ID of the existing OpenShift cluster to protect.
59+
If left empty (null, which is the default), this example will automatically create a new VPC
60+
and provision a OpenShift cluster for you.
61+
If you provide a value, the module will use that existing cluster instead of creating a new one.
62+
EOT
63+
default = null
64+
}

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ resource "ibm_backup_recovery_source_registration" "source_registration" {
128128
connection_id = var.connection_id
129129
name = var.registration_name
130130
kubernetes_params {
131-
endpoint = var.cluster_config_endpoint_type == "private" || data.ibm_container_vpc_cluster.cluster.private_service_endpoint ? data.ibm_container_vpc_cluster.cluster.private_service_endpoint_url : data.ibm_container_vpc_cluster.cluster.public_service_endpoint_url
131+
endpoint = var.cluster_config_endpoint_type == "private" && data.ibm_container_vpc_cluster.cluster.private_service_endpoint ? data.ibm_container_vpc_cluster.cluster.private_service_endpoint_url : data.ibm_container_vpc_cluster.cluster.public_service_endpoint_url
132132
kubernetes_distribution = var.kube_type == "openshift" ? "kROKS" : "kIKS"
133133
data_mover_image_location = var.registration_images.data_mover
134134
velero_image_location = var.registration_images.velero

0 commit comments

Comments
 (0)