@@ -99,7 +99,7 @@ resource "netapp-ontap_storage_volume_resource" "volloop" {
9999 for_each = data. netapp-ontap_storage_volume_data_source . my_vol
100100 cx_profile_name = " dr_clus"
101101 name = " ${ each . value . name } _dp"
102- type = " DP "
102+ type = " dp "
103103 svm_name = aws_fsx_ontap_storage_virtual_machine. mysvm . name
104104 aggregates = [
105105 {
@@ -124,3 +124,46 @@ resource "netapp-ontap_storage_volume_resource" "volloop" {
124124 # junction_path = join("", ["/",each.value.name])
125125 }
126126}
127+
128+ # Now that we have the DP volumes created on the newly deployed destination cluster,
129+ # let's get the intercluster LIFs so we can peer the clusters.
130+
131+ # For existing FSx ONTAP cluster
132+ data "netapp-ontap_networking_ip_interfaces_data_source" "primary_intercluster_lifs" {
133+ cx_profile_name = " primary_clus"
134+ filter = {
135+ svm_name = var.prime_svm
136+ name = " inter*" # Filter to only get intercluster LIFs
137+ }
138+ }
139+
140+ # For newly created FSx ONTAP cluster
141+ data "netapp-ontap_networking_ip_interfaces_data_source" "dr_intercluster_lifs" {
142+ cx_profile_name = " dr_clus"
143+ filter = {
144+ svm_name = aws_fsx_ontap_storage_virtual_machine.mysvm.name
145+ name = " inter*" # Filter to only get intercluster LIFs
146+ }
147+ }
148+
149+
150+ # Now udse the LIF names and IP addresses to peer the clusters
151+
152+ resource "netapp-ontap_cluster_peers_resource" "cluster_peer" {
153+ cx_profile_name = " primary_clus" # Source cluster profile
154+ peer_cx_profile_name = " dr_clus" # Destination (peer) cluster profile
155+
156+ remote = {
157+ # Destination cluster (DR) intercluster LIF IPs
158+ ip_addresses = [for lif in data . netapp-ontap_networking_ip_interfaces_data_source . dr_intercluster_lifs . ip_interfaces : lif . ip_address ]
159+ }
160+
161+ source_details = {
162+ # Source cluster (primary) intercluster LIF IPs
163+ ip_addresses = [for lif in data . netapp-ontap_networking_ip_interfaces_data_source . primary_intercluster_lifs . ip_interfaces : lif . ip_address ]
164+ }
165+
166+ # Optional: Add authentication, passphrase or any other required settings
167+ # passphrase = var.cluster_peer_passphrase # Optional, if you use passphrase for peering
168+ peer_applications = [" snapmirror" ]
169+ }
0 commit comments