Skip to content

Commit 304f7a6

Browse files
author
nichollri
committed
successful cluster peer, read IC LIFs from AWS FSxN provider
1 parent 775e73d commit 304f7a6

File tree

3 files changed

+36
-14
lines changed

3 files changed

+36
-14
lines changed

Terraform/fsxn-replicate/main.tf

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,24 +147,28 @@ data "netapp-ontap_networking_ip_interfaces_data_source" "dr_intercluster_lifs"
147147
}
148148
}
149149

150+
# For now let's try to get the source and destination IC LIFs via AWS TF provider.
151+
data "aws_fsx_ontap_file_system" "source_fsxn" {
152+
id = var.prime_fsxid
153+
}
150154

151155
# Now udse the LIF names and IP addresses to peer the clusters
152156

153-
# resource "netapp-ontap_cluster_peers_resource" "cluster_peer" {
154-
# cx_profile_name = "primary_clus" # Source cluster profile
155-
# peer_cx_profile_name = "dr_clus" # Destination (peer) cluster profile
156-
#
157-
# remote = {
158-
# # Destination cluster (DR) intercluster LIF IPs
159-
# ip_addresses = [for lif in data.netapp-ontap_networking_ip_interfaces_data_source.dr_intercluster_lifs.ip_interfaces : lif.ip_address]
160-
# }
157+
resource "netapp-ontap_cluster_peers_resource" "cluster_peer" {
158+
cx_profile_name = "primary_clus" # Source cluster profile
159+
peer_cx_profile_name = "dr_clus" # Destination (peer) cluster profile
161160

162-
# source_details = {
163-
# Source cluster (primary) intercluster LIF IPs
164-
# ip_addresses = [for lif in data.netapp-ontap_networking_ip_interfaces_data_source.primary_intercluster_lifs.ip_interfaces : lif.ip_address]
165-
# }
161+
remote = {
162+
# Destination cluster (DR) intercluster LIF IPs
163+
ip_addresses = aws_fsx_ontap_file_system.terraform-fsxn.endpoints[0].intercluster[0].ip_addresses
164+
}
165+
166+
source_details = {
167+
# Source cluster (primary) intercluster LIF IPs
168+
ip_addresses = data.aws_fsx_ontap_file_system.source_fsxn.endpoints[0].intercluster[0].ip_addresses
169+
}
166170

167171
# Optional: Add authentication, passphrase or any other required settings
168172
# passphrase = var.cluster_peer_passphrase # Optional, if you use passphrase for peering
169-
# peer_applications = ["snapmirror"]
170-
#}
173+
peer_applications = ["snapmirror"]
174+
}

Terraform/fsxn-replicate/output.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,14 @@ output "primary_intercluster_lifs_details" {
2626
description = "Intercluster LIF names and IP addresses for the primary existing cluster"
2727
}
2828

29+
output "data_from_aws_fsxn" {
30+
value = {
31+
intercluster = {
32+
# dns_name = data.aws_fsx_ontap_file_system.source_fsxn.endpoints[0].intercluster[0].dns_name
33+
# ip_addresses = data.aws_fsx_ontap_file_system.source_fsxn.endpoints[0].intercluster[0].ip_addresses
34+
all_of_it = data.aws_fsx_ontap_file_system.source_fsxn
35+
}
36+
}
37+
description = "All data from aws fsxn provider"
38+
}
39+

Terraform/fsxn-replicate/variables.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ variable "prime_hostname" {
55
default = "198.19.253.210"
66
}
77

8+
variable "prime_fsxid" {
9+
description = "FSx ID of the primary cluster."
10+
type = string
11+
# Development FSxN
12+
default = "fs-020de2687bd98ccf7"
13+
}
14+
815
variable "prime_svm" {
916
description = "Name of svm for replication in the primary cluster."
1017
type = string

0 commit comments

Comments
 (0)