Skip to content

Commit 23ae9a6

Browse files
authored
Merge pull request #203 from NetApp/rvwn_tf_rep
SnapMirror with Terraform
2 parents 3cec50d + 79ff957 commit 23ae9a6

File tree

9 files changed

+1037
-0
lines changed

9 files changed

+1037
-0
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
/Terraform/deploy-fsx-ontap-sqlserver/ @varunrai
2121
/Terraform/deploy-fsx-ontap-fileshare-access/ @varunrai
2222
/Terraform/deploy-fsx-ontap/ @kcantrel
23+
/Terraform/fsxn-replicate/ @nichollri

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ Have a great idea? We'd love to hear it! Please email us at [ng-fsxn-github-samp
1818

1919
* [AI](/AI)
2020
* [GenAI ChatBot application sample](/AI/GenAI-ChatBot-application-sample)
21+
* [Anisble](/Ansible)
22+
* [FSx ONTAP inventory report](/Ansible/fsx_inventory_report)
23+
* [SnapMirror report](/Ansible/snapmirror_report)
2124
* [CloudFormation](/CloudFormation)
2225
* [deploy-fsx-ontap](/CloudFormation/deploy-fsx-ontap)
2326
* [EKS](/EKS)
@@ -39,6 +42,7 @@ Have a great idea? We'd love to hear it! Please email us at [ng-fsxn-github-samp
3942
* [k8s applications non-stdout logs collection into ELK](/Solutions/EKS-logs-to-ELK)
4043
* [Terraform](/Terraform)
4144
* [FSx ONTAP deployment using Terraform](/Terraform/deploy-fsx-ontap)
45+
* [FSx ONTAP Replication](/Terraform/fsxn-replication)
4246
* [Deployment of SQL Server on EC2 with FSx ONTAP](/Terraform/deploy-fsx-ontap-sqlserver)
4347
* [Deployment of FSx ONTAP with VPN for File Share Access](/Terraform/deploy-fsx-ontap-fileshare-access)
4448

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# Variables for the Disaster Recovery FSx for ONTAP file system to be created.
2+
3+
variable "dr_aws_region" {
4+
description = "AWS region where you want the Secondary(DR) FSx for ONTAP file system."
5+
type = string
6+
default = ""
7+
}
8+
9+
variable "dr_fsx_name" {
10+
description = "The name to assign to the destination FSx for ONTAP file system."
11+
type = string
12+
default = ""
13+
}
14+
15+
variable "dr_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 = "dr_clus"
19+
}
20+
21+
variable "dr_fsx_deploy_type" {
22+
description = "The file system deployment type. Supported values are 'MULTI_AZ_1', 'SINGLE_AZ_1', 'MULTI_AZ_2', and 'SINGLE_AZ_2'. MULTI_AZ_1 and SINGLE_AZ_1 are Gen 1. MULTI_AZ_2 and SINGLE_AZ_2 are Gen 2."
23+
type = string
24+
default = "SINGLE_AZ_1"
25+
validation {
26+
condition = contains(["MULTI_AZ_1", "SINGLE_AZ_1", "MULTI_AZ_2", "SINGLE_AZ_2"], var.dr_fsx_deploy_type)
27+
error_message = "Invalid deployment type. Valid values are MULTI_AZ_1, SINGLE_AZ_1, MULTI_AZ_2 or SINGLE_AZ_2."
28+
}
29+
}
30+
31+
variable "dr_fsx_subnets" {
32+
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."
33+
type = map(any)
34+
default = {
35+
"primarysub" = "subnet-11111111"
36+
"secondarysub" = "subnet-33333333"
37+
}
38+
}
39+
40+
variable "dr_fsx_capacity_size_gb" {
41+
description = "The storage capacity in GiBs of the FSx for ONTAP 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."
42+
type = number
43+
default = 1024
44+
validation {
45+
condition = var.dr_fsx_capacity_size_gb >= 1024 && var.dr_fsx_capacity_size_gb <= 1048576
46+
error_message = "Invalid capacity size. Valid values are between 1024 (1TiB) and 1045876 (1 PiB)."
47+
}
48+
}
49+
50+
variable "dr_fsx_tput_in_MBps" {
51+
description = "The throughput capacity (in MBps) for the file system. Valid values are 128, 256, 512, 1024, 2048, and 4096 for Gen 1, and 384, 768, 1536, 3072 and 6144 for Gen 2."
52+
type = string
53+
default = "128"
54+
validation {
55+
condition = contains(["128", "256", "384", "512", "768", "1024", "1536", "2048", "3072", "4086", "6144"], var.dr_fsx_tput_in_MBps)
56+
error_message = "Invalid throughput value. Valid values are 128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4086, 6144."
57+
}
58+
}
59+
60+
variable "dr_ha_pairs" {
61+
description = "The number of HA pairs in the file system. Valid values are from 1 through 12. Only single AZ Gen 2 deployment type supports more than 1 HA pair."
62+
type = number
63+
default = 1
64+
validation {
65+
condition = var.dr_ha_pairs >= 1 && var.dr_ha_pairs <= 12
66+
error_message = "Invalid number of HA pairs. Valid values are from 1 through 12."
67+
}
68+
}
69+
70+
variable "dr_endpoint_ip_address_range" {
71+
description = "The IP address range that the FSx for ONTAP file system will be accessible from. This is only used for Multi AZ deployment types and must be left a null for Single AZ deployment types."
72+
type = string
73+
default = null
74+
}
75+
76+
variable "dr_route_table_ids" {
77+
description = "An array of routing table IDs that will be modified to allow access to the FSx for ONTAP file system. This is only used for Multi AZ deployment types and must be left as null for Single AZ deployment types."
78+
type = list(string)
79+
default = []
80+
}
81+
82+
variable "dr_disk_iops_configuration" {
83+
description = "The SSD IOPS configuration for the file system. Valid modes are 'AUTOMATIC' (3 iops per GB provisioned) or 'USER_PROVISIONED'. NOTE: Due to a bug in the AWS FSx provider, if you want AUTOMATIC, then leave this variable empty. If you want USER_PROVISIONED, then add a 'mode=USER_PROVISIONED' (with USER_PROVISIONED enclosed in double quotes) and 'iops=number' where number is between 1 and 160000."
84+
type = map(any)
85+
default = {}
86+
}
87+
88+
variable "dr_tags" {
89+
description = "Tags to be applied to the FSx for ONTAP file system. The format is '{Name1 = value, Name2 = value}' where value should be enclosed in double quotes."
90+
type = map(any)
91+
default = {}
92+
}
93+
94+
variable "dr_maintenance_start_time" {
95+
description = "The preferred start time to perform weekly maintenance, in UTC time zone. The format is 'D:HH:MM' format. D is the day of the week, where 1=Monday and 7=Sunday."
96+
type = string
97+
default = "7:00:00"
98+
}
99+
100+
variable "dr_kms_key_id" {
101+
description = "ARN for the KMS Key to encrypt the file system at rest. Defaults to an AWS managed KMS Key."
102+
type = string
103+
default = null
104+
}
105+
106+
variable "dr_backup_retention_days" {
107+
description = "The number of days to retain automatic backups. Setting this to 0 disables automatic backups. You can retain automatic backups for a maximum of 90 days."
108+
type = number
109+
default = 0
110+
validation {
111+
condition = var.dr_backup_retention_days >= 0 && var.dr_backup_retention_days <= 90
112+
error_message = "Invalid backup retention days. Valid values are between 0 and 90."
113+
}
114+
}
115+
116+
variable "dr_daily_backup_start_time" {
117+
description = "A recurring daily time, in the format HH:MM. HH is the zero-padded hour of the day (0-23), and MM is the zero-padded minute of the hour. Requires automatic_backup_retention_days to be set."
118+
type = string
119+
default = "00:00"
120+
}
121+
122+
variable "dr_svm_name" {
123+
description = "The name of the Storage Virtual Machine"
124+
type = string
125+
default = "fsx_dr"
126+
}
127+
128+
variable "dr_root_vol_sec_style" {
129+
description = "Specifies the root volume security style, Valid values are UNIX, NTFS, and MIXED (although MIXED is not recommended). All volumes created under this SVM will inherit the root security style unless the security style is specified on the volume."
130+
type = string
131+
default = "UNIX"
132+
}
133+
134+
/*
135+
* These last set of variables have to do with a security group that can be optionally
136+
* created. The security group will have all the ingress rules that will allow access
137+
* to all the protocols that an FSx for ONTAP file system supports (e.g. SMB, NFS, etc). See the security_groups.tf
138+
* for more information.
139+
*
140+
* If you decide to create the security group, you can specify either the CIDR block to
141+
* be used as the source to the ingress rules OR the ID of a security group to be used as
142+
* the source to the ingress rules. You can't specify both.
143+
*
144+
* If you decide not to create the security group, you must set the security_group_id to
145+
* the ID of the security group that you want to use.
146+
*
147+
*/
148+
variable "dr_create_sg" {
149+
description = "Determines whether the Security Group should be created as part of this deployment or not."
150+
type = bool
151+
default = true
152+
}
153+
154+
variable "dr_security_group_ids" {
155+
description = "If you are not creating the security group, provide a list of IDs of security groups to be used."
156+
type = list(string)
157+
default = []
158+
}
159+
160+
variable "dr_security_group_name_prefix" {
161+
description = "The prefix to the security group name that will be created."
162+
type = string
163+
default = "fsxn-sg"
164+
}
165+
166+
variable "dr_cidr_for_sg" {
167+
description = "The cidr block to be used for the created security ingress rules. Set to an empty string if you want to use the source_sg_id as the source."
168+
type = string
169+
default = "10.0.0.0/8"
170+
}
171+
172+
variable "dr_source_sg_id" {
173+
description = "The ID of the security group to allow access to the FSx for ONTAP file system. Set to an empty string if you want to use the cidr_for_sg as the source."
174+
type = string
175+
default = ""
176+
}
177+
178+
variable "dr_vpc_id" {
179+
description = "The VPC ID where the DR FSx for ONTAP file system and security group will be created."
180+
type = string
181+
default = ""
182+
}
183+
184+
variable "dr_username_pass_secrets_id" {
185+
description = "Name of secret ID in AWS secrets. This secret needs to be in the same region as the DR FSx for ONTAP file system."
186+
type = string
187+
default = ""
188+
}
189+
190+
variable "dr_snapmirror_policy_name" {
191+
description = "Name of snamirror policy to create"
192+
type = string
193+
default = ""
194+
}
195+
196+
variable "dr_transfer_schedule" {
197+
description = "The schedule used to update asynchronous relationships."
198+
type = string
199+
default = "hourly"
200+
}
201+
202+
variable "dr_retention" {
203+
description = "Rules for Snapshot copy retention."
204+
type = string
205+
default = <<-EOF
206+
[{
207+
"label": "weekly",
208+
"count": 4
209+
},
210+
{
211+
"label": "daily",
212+
"count": 7
213+
}]
214+
EOF
215+
}
216+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
variable "prime_fsxid" {
2+
description = "FSx for ONTAP file system ID of the primary cluster."
3+
type = string
4+
default = ""
5+
}
6+
7+
variable "prime_clus_name" {
8+
description = "This is the name of the cluster given for ONTAP TerraForm connection profile. This is a user creatred value, that can be any string. It is referenced in many ONTAP TF resources."
9+
type = string
10+
default = "primary_clus"
11+
}
12+
13+
variable "prime_svm" {
14+
description = "Name of svm for replication in the primary cluster."
15+
type = string
16+
default = ""
17+
}
18+
19+
variable "prime_cluster_vserver" {
20+
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 (network interface show -services default-intercluster). It will be formatted like this FsxIdxxxxxxxx"
21+
type = string
22+
default = ""
23+
}
24+
25+
variable "prime_aws_region" {
26+
description = "AWS regionfor the Primary FSx for ONTAP file system"
27+
type = string
28+
default = ""
29+
}
30+
31+
variable "username_pass_secrets_id" {
32+
description = "Name of secret ID in AWS secrets. This secret needs to be in the same region as the Primary FSx for ONTAP file system."
33+
type = string
34+
default = ""
35+
}
36+
37+
variable "list_of_volumes_to_replicate" {
38+
description = "list of volumes to replicate to dr fsxn"
39+
type = list(string)
40+
default = []
41+
}
42+
43+
variable "validate_certs" {
44+
description = "Do we validate the cluster certs (true or false). If true then ONTAP requires valid, non-self signed SSL certificates."
45+
type = string
46+
default = "false"
47+
}

0 commit comments

Comments
 (0)