Skip to content

Commit f638a72

Browse files
committed
add files with values for first basic test
1 parent ef807de commit f638a72

File tree

3 files changed

+142
-0
lines changed

3 files changed

+142
-0
lines changed

Terraform/fsxn-replicate/main.tf

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
terraform {
2+
required_providers {
3+
netapp-ontap = {
4+
source = "NetApp/netapp-ontap"
5+
version = "1.1.4"
6+
}
7+
8+
aws = {
9+
source = "hashicorp/aws"
10+
version = ">= 5.68.0"
11+
}
12+
}
13+
}
14+
15+
provider "aws" {
16+
region = var.secrets_aws_region
17+
}
18+
19+
data "aws_secretsmanager_secret_version" "ontap_prime_username_pass" {
20+
secret_id = var.username_pass_secrets_id
21+
}
22+
23+
data "aws_secretsmanager_secret_version" "ontap_dr_username_pass" {
24+
secret_id = var.dr_username_pass_secrets_id
25+
}
26+
27+
28+
provider "netapp-ontap" {
29+
# A connection profile defines how to interface with an ONTAP cluster or svm.
30+
# At least one is required.
31+
connection_profiles = [
32+
{
33+
name = "primary_clus"
34+
hostname = var.prime_hostname
35+
username = jsondecode(data.aws_secretsmanager_secret_version.ontap_prime_username_pass.secret_string)["username"]
36+
password = jsondecode(data.aws_secretsmanager_secret_version.ontap_prime_username_pass.secret_string)["password"]
37+
validate_certs = var.validate_certs
38+
},
39+
{
40+
name = "dr_clus"
41+
username = jsondecode(data.aws_secretsmanager_secret_version.ontap_dr_username_pass.secret_string)["username"]
42+
password = jsondecode(data.aws_secretsmanager_secret_version.ontap_dr_username_pass.secret_string)["password"]
43+
hostname = var.dr_hostname
44+
validate_certs = var.validate_certs
45+
},
46+
]
47+
}
48+
49+
data "netapp-ontap_storage_volume_data_source" "my_vol" {
50+
for_each = toset(var.list_of_volumes_to_replicate)
51+
cx_profile_name = "primary_clus"
52+
svm_name = var.prime_svm
53+
name = each.value
54+
}
55+
56+
resource "netapp-ontap_storage_volume_resource" "example" {
57+
cx_profile_name = "primary_clus"
58+
name = "rvwn_vol1_tf"
59+
svm_name = var.prime_svm
60+
aggregates = [
61+
{
62+
name = "aggr1"
63+
},
64+
]
65+
space_guarantee = "none"
66+
snapshot_policy = "default"
67+
space = {
68+
size = 100
69+
size_unit = "gb"
70+
logical_space = {
71+
enforcement = true
72+
reporting = true
73+
}
74+
}
75+
tiering = {
76+
policy_name = "auto"
77+
}
78+
nas = {
79+
export_policy_name = "default"
80+
security_style = "unix"
81+
junction_path = "/rvwn_vol1_tf"
82+
}
83+
}

Terraform/fsxn-replicate/output.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
output "volume_details" {
2+
value = {
3+
for key, volume in data.netapp-ontap_storage_volume_data_source.my_vol : key => {
4+
name = volume.name
5+
type = volume.type
6+
size = "${volume.space.size}${volume.space.size_unit}"
7+
}
8+
}
9+
description = "Details of the volumes including name, type, size, and size unit"
10+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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_svm" {
9+
description = "Name of svm for replication in the primary cluster."
10+
type = string
11+
default = "vs1cli"
12+
}
13+
14+
variable "secrets_aws_region" {
15+
description = "Region where the AWS secret for username/password reside"
16+
type = string
17+
default = "us-west-2"
18+
}
19+
20+
variable "username_pass_secrets_id" {
21+
description = "Name of secret ID in AWS secrets"
22+
type = string
23+
default = "rvwn_replicate_ontap_creds"
24+
}
25+
26+
variable "list_of_volumes_to_replicate" {
27+
description = "list of volumes to replicate to dr fsxn"
28+
type = list(string)
29+
default = ["cifs_share", "rvwn_from_bxp", "unix"]
30+
}
31+
32+
variable "dr_username_pass_secrets_id" {
33+
description = "Name of secret ID in AWS secrets"
34+
type = string
35+
default = "rvwn_replicate_ontap_creds"
36+
}
37+
38+
variable "dr_hostname" {
39+
description = "Hostname or IP address of disaster recovery cluster."
40+
type = string
41+
# Prod DR FSxN
42+
default = "198.19.254.83"
43+
}
44+
45+
variable "validate_certs" {
46+
description = "Do we validate the cluster certs (true or false)"
47+
type = string
48+
default = "false"
49+
}

0 commit comments

Comments
 (0)