Skip to content

Commit dc18f81

Browse files
author
nichollri
committed
added snapmirror policy and broke out variables.tf into two files
1 parent 48a3481 commit dc18f81

File tree

4 files changed

+88
-70
lines changed

4 files changed

+88
-70
lines changed

Terraform/fsxn-replicate/variables.tf renamed to Terraform/fsxn-replicate/DR_FSxN_variables.tf

Lines changed: 11 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,15 @@
1-
variable "prime_hostname" {
2-
description = "Hostname or IP address of primary cluster."
3-
type = string
4-
# Development FSxN
5-
default = "198.19.253.210"
6-
}
7-
8-
variable "prime_fsxid" {
9-
description = "FSx ID of the primary cluster."
10-
type = string
11-
# Development FSxN
12-
default = "fs-020de2687bd98ccf7"
13-
}
14-
15-
variable "prime_clus_name" {
16-
description = "This is the name of the cluster given for ONTAP TF connection profile. This is a user creatred value, that can be any string. It is referenced in many ONTAP TF resources."
17-
type = string
18-
default = "primary_clus"
19-
}
20-
21-
variable "prime_svm" {
22-
description = "Name of svm for replication in the primary cluster."
23-
type = string
24-
default = "vs1cli"
25-
}
26-
27-
variable "prime_cluster_vserver" {
28-
description = "Name of cluster vserver for inter cluster lifs in the primary cluster. This can be found by running network interface show on the source cluster"
29-
type = string
30-
default = "FsxId020de2687bd98ccf7"
31-
}
32-
33-
variable "prime_aws_region" {
34-
description = "AWS regionfor the Primary ONTAP FSxN"
35-
type = string
36-
default = "us-west-2"
37-
}
1+
# Variables for the Disaster Recovery FSxN system to be created.
382

393
variable "dr_aws_region" {
404
description = "AWS regionfor the Secondary(DR) ONTAP FSxN"
415
type = string
42-
default = "us-west-2"
43-
}
44-
45-
variable "username_pass_secrets_id" {
46-
description = "Name of secret ID in AWS secrets"
47-
type = string
48-
default = "rvwn_replicate_ontap_creds"
49-
}
50-
51-
variable "list_of_volumes_to_replicate" {
52-
description = "list of volumes to replicate to dr fsxn"
53-
type = list(string)
54-
default = ["cifs_share", "rvwn_from_bxp", "rvwn_voltb", "rvwn_volmb"]
6+
default = ""
557
}
568

579
variable "dr_fsx_name" {
5810
description = "The name to assign to the destination FSxN file system."
5911
type = string
60-
default = "terraform-dr-fsxn"
12+
default = ""
6113
}
6214

6315
variable "dr_clus_name" {
@@ -80,15 +32,15 @@ variable "dr_fsx_subnets" {
8032
description = "The primary subnet ID, and secondary subnet ID if you are deploying in a Multi AZ environment, file system will be accessible from. For MULTI_AZ deployment types both subnets are required. For SINGLE_AZ deployment type, only the primary subnet is used."
8133
type = map(any)
8234
default = {
83-
"primarysub" = "subnet-8fba81f8"
35+
"primarysub" = "subnet-11111111"
8436
"secondarysub" = "subnet-33333333"
8537
}
8638
}
8739

8840
variable "dr_fsx_capacity_size_gb" {
8941
description = "The storage capacity in GiBs of the FSxN file system. Valid values between 1024 (1 TiB) and 1048576 (1 PiB). Gen 1 deployment types are limited to 192 TiB. Gen 2 Multi AZ is limited to 512 TiB. Gen 2 Single AZ is limited to 1 PiB."
9042
type = number
91-
default = 2048
43+
default = 1024
9244
validation {
9345
condition = var.dr_fsx_capacity_size_gb >= 1024 && var.dr_fsx_capacity_size_gb <= 1048576
9446
error_message = "Invalid capacity size. Valid values are between 1024 (1TiB) and 1045876 (1 PiB)."
@@ -170,7 +122,7 @@ variable "dr_daily_backup_start_time" {
170122
variable "dr_svm_name" {
171123
description = "The name of the Storage Virtual Machine"
172124
type = string
173-
default = "fsx-dr"
125+
default = ""
174126
}
175127

176128
variable "dr_root_vol_sec_style" {
@@ -226,17 +178,17 @@ variable "dr_source_sg_id" {
226178
variable "dr_vpc_id" {
227179
description = "The VPC ID where the DR FSxN and security group will be created."
228180
type = string
229-
default = "vpc-445d4f21"
181+
default = ""
230182
}
231183

232184
variable "dr_username_pass_secrets_id" {
233185
description = "Name of secret ID in AWS secrets"
234186
type = string
235-
default = "rvwn_replicate_ontap_creds_dr"
187+
default = ""
236188
}
237189

238-
variable "validate_certs" {
239-
description = "Do we validate the cluster certs (true or false)"
190+
variable "dr_snapmirror_policy_name" {
191+
description = "Name of snamirror policy to create"
240192
type = string
241-
default = "false"
193+
default = ""
242194
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
variable "prime_hostname" {
2+
description = "Hostname or IP address of primary cluster."
3+
type = string
4+
default = ""
5+
}
6+
7+
variable "prime_fsxid" {
8+
description = "FSx ID of the primary cluster."
9+
type = string
10+
default = ""
11+
}
12+
13+
variable "prime_clus_name" {
14+
description = "This is the name of the cluster given for ONTAP TF connection profile. This is a user creatred value, that can be any string. It is referenced in many ONTAP TF resources."
15+
type = string
16+
default = "primary_clus"
17+
}
18+
19+
variable "prime_svm" {
20+
description = "Name of svm for replication in the primary cluster."
21+
type = string
22+
default = ""
23+
}
24+
25+
variable "prime_cluster_vserver" {
26+
description = "Name of cluster vserver for inter cluster lifs in the primary cluster. This can be found by running network interface show on the source cluster. It will be formatted like this FsxIdxxxxxxxx"
27+
type = string
28+
default = ""
29+
}
30+
31+
variable "prime_aws_region" {
32+
description = "AWS regionfor the Primary ONTAP FSxN"
33+
type = string
34+
default = ""
35+
}
36+
37+
variable "username_pass_secrets_id" {
38+
description = "Name of secret ID in AWS secrets"
39+
type = string
40+
default = ""
41+
}
42+
43+
variable "list_of_volumes_to_replicate" {
44+
description = "list of volumes to replicate to dr fsxn"
45+
type = list(string)
46+
default = []
47+
}
48+
49+
variable "validate_certs" {
50+
description = "Do we validate the cluster certs (true or false)"
51+
type = string
52+
default = "false"
53+
}

Terraform/fsxn-replicate/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This repository contains a method to take an existing FSxN system and replicate
77

88
You will need to define some key characteristics of your destination FSxN cluster to be created, such as deployment type and througput, full list below. You also will need to define the source SVM and list of volumes to replicate, and replication parameters.
99

10-
These values can be found in the following .tfvars files: Primary_FSxN_variables.tfvar and DR_FSxN_variables.tfvar
10+
These values can be found in the following variables files: Primary_FSxN_variables.tf and DR_FSxN_variables.tf
1111

1212

1313

Terraform/fsxn-replicate/main.tf

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,6 @@ resource "aws_fsx_ontap_volume" "dp_volumes" {
122122
skip_final_backup = true
123123
}
124124

125-
resource "aws_fsx_ontap_volume" "test_src" {
126-
storage_virtual_machine_id = aws_fsx_ontap_storage_virtual_machine.mysvm.id
127-
name = "volx_src"
128-
ontap_volume_type = "RW"
129-
size_in_megabytes = 1024
130-
junction_path = "/volx_src"
131-
storage_efficiency_enabled = true
132-
}
133-
134125
# Now that we have the DP volumes created on the newly deployed destination cluster,
135126
# let's get the intercluster LIFs so we can peer the clusters.
136127

@@ -181,6 +172,24 @@ resource "netapp-ontap_svm_peers_resource" "peer_svms" {
181172
]
182173
}
183174

175+
resource "netapp-ontap_snapmirror_policy_resource" "snapmirror_policy_async" {
176+
# required to know which system to interface with
177+
cx_profile_name = var.dr_clus_name
178+
name = var.dr_snapmirror_policy_name
179+
svm_name = aws_fsx_ontap_storage_virtual_machine.mysvm.name
180+
type = "async"
181+
retention = [{
182+
label = "weekly"
183+
count = 2
184+
},
185+
{
186+
label = "daily",
187+
count = 7
188+
}
189+
]
190+
}
191+
192+
184193
resource "netapp-ontap_snapmirror_resource" "snapmirror" {
185194
for_each = data.netapp-ontap_storage_volume_data_source.src_vols
186195
cx_profile_name = var.dr_clus_name
@@ -190,7 +199,11 @@ resource "netapp-ontap_snapmirror_resource" "snapmirror" {
190199
destination_endpoint = {
191200
path = join(":",[aws_fsx_ontap_storage_virtual_machine.mysvm.name, "${each.value.name}_dp"])
192201
}
202+
policy = {
203+
name = netapp-ontap_snapmirror_policy_resource.snapmirror_policy_async.name
204+
}
193205
depends_on = [
194-
netapp-ontap_svm_peers_resource.peer_svms
206+
netapp-ontap_svm_peers_resource.peer_svms,
207+
aws_fsx_ontap_volume.dp_volumes
195208
]
196209
}

0 commit comments

Comments
 (0)