Skip to content

Commit 6a8486c

Browse files
author
nichollri
committed
added some snapmirror variables and improved README sections.
1 parent 81e8aa7 commit 6a8486c

File tree

4 files changed

+47
-10
lines changed

4 files changed

+47
-10
lines changed

Terraform/fsxn-replicate/DR_FSxN_variables.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,25 @@ variable "dr_snapmirror_policy_name" {
192192
type = string
193193
default = ""
194194
}
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+

Terraform/fsxn-replicate/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ These variables are to be filled in the terraform.tfvars file, please see instru
5555
| dr_username_pass_secrets_id | Name of the secrets ID in AWS secrets. The AWS Secret should has format of a key `username` where the value should be fsxadmin and a key `password` with the value being the password to be assigned to the destination FSx for ONTAP file system. | `string` | | Yes |
5656
| dr_vpc_id | The VPC ID where the DR FSx for ONTAP file system (and security group if this option is selected) will be created. | `string` | | Yes |
5757
| dr_snapmirror_policy_name | Name of snamirror policy to create. | `string` | | Yes |
58-
58+
| dr_transfer_schedule | The schedule used to update asynchronous relationships. | `string` | hourly | No |
59+
| dr_retention | Rules for Snapshot copy retention. See [Retention Schema] (https://registry.terraform.io/providers/NetApp/netapp-ontap/latest/docs/resources/snapmirror_policy_resource#retention) | `string` | 4 weekly, 2 daily | Yes |
5960
## Inputs (Security Group - DR Cluster)
6061

6162
| Name | Description | Type | Default | Required |

Terraform/fsxn-replicate/main.tf

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -173,21 +173,18 @@ resource "netapp-ontap_svm_peers_resource" "peer_svms" {
173173
]
174174
}
175175

176+
locals {
177+
dr_retention_parsed = jsondecode(var.dr_retention)
178+
}
179+
176180
resource "netapp-ontap_snapmirror_policy_resource" "snapmirror_policy_async" {
177181
# required to know which system to interface with
178182
cx_profile_name = var.dr_clus_name
179183
name = var.dr_snapmirror_policy_name
180184
svm_name = aws_fsx_ontap_storage_virtual_machine.mysvm.name
181185
type = "async"
182-
retention = [{
183-
label = "weekly"
184-
count = 2
185-
},
186-
{
187-
label = "daily",
188-
count = 7
189-
}
190-
]
186+
transfer_schedule_name = var.dr_transfer_schedule
187+
retention = local.dr_retention_parsed
191188
}
192189

193190

Terraform/fsxn-replicate/output.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,20 @@ output "dr_fsxn_system" {
2323
}
2424
description = "Cluster management IP address of the created DR cluster"
2525
}
26+
27+
#output "replication_relationships" {
28+
# value = {
29+
# full_data = netapp-ontap_snapmirror_resource.snapmirror
30+
# }
31+
# description = "Replication relationships"
32+
#}
33+
34+
output "snapmirror_details" {
35+
value = { for id, snapmirror in netapp-ontap_snapmirror_resource.snapmirror : id => {
36+
source_path = snapmirror.source_endpoint.path
37+
destination_path = snapmirror.destination_endpoint.path
38+
policy_name = snapmirror.policy.name
39+
}}
40+
description = "A map of all snapmirror details."
41+
}
42+

0 commit comments

Comments
 (0)