Skip to content

Commit 09d6779

Browse files
author
nichollri
committed
preliminary steps, 2 regions, create dr-fsxn, new sg logic
1 parent 80cbd3a commit 09d6779

File tree

4 files changed

+149
-133
lines changed

4 files changed

+149
-133
lines changed

Terraform/fsxn-replicate/main.tf

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@ terraform {
1313
}
1414

1515
provider "aws" {
16-
region = var.secrets_aws_region
16+
region = var.dr_aws_region
17+
}
18+
19+
provider "aws" {
20+
alias = "prime-aws-region"
21+
region = var.prime_aws_region
1722
}
1823

1924
data "aws_secretsmanager_secret_version" "ontap_prime_username_pass" {
25+
provider = aws.prime-aws-region
2026
secret_id = var.username_pass_secrets_id
2127
}
2228

@@ -25,26 +31,20 @@ data "aws_secretsmanager_secret_version" "ontap_dr_username_pass" {
2531
}
2632

2733

28-
#provider "netapp-ontap" {
34+
provider "netapp-ontap" {
2935
# A connection profile defines how to interface with an ONTAP cluster or svm.
3036
# 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-
#}
37+
connection_profiles = [
38+
{
39+
name = "primary_clus"
40+
hostname = var.prime_hostname
41+
username = jsondecode(data.aws_secretsmanager_secret_version.ontap_prime_username_pass.secret_string)["username"]
42+
password = jsondecode(data.aws_secretsmanager_secret_version.ontap_prime_username_pass.secret_string)["password"]
43+
validate_certs = var.validate_certs
44+
}
45+
46+
]
47+
}
4848

4949
resource "aws_fsx_ontap_file_system" "terraform-fsxn" {
5050
subnet_ids = var.dr_fsx_deploy_type == "MULTI_AZ_1" || var.dr_fsx_deploy_type == "MULTI_AZ_2" ? [var.dr_fsx_subnets["primarysub"], var.dr_fsx_subnets["secondarysub"]] : [var.dr_fsx_subnets["primarysub"]]
@@ -81,38 +81,38 @@ resource "aws_fsx_ontap_storage_virtual_machine" "mysvm" {
8181
root_volume_security_style = var.dr_root_vol_sec_style
8282
}
8383

84-
#data "netapp-ontap_storage_volume_data_source" "my_vol" {
85-
# for_each = toset(var.list_of_volumes_to_replicate)
86-
# cx_profile_name = "primary_clus"
87-
# svm_name = var.prime_svm
88-
# name = each.value
89-
#}
84+
data "netapp-ontap_storage_volume_data_source" "my_vol" {
85+
for_each = toset(var.list_of_volumes_to_replicate)
86+
cx_profile_name = "primary_clus"
87+
svm_name = var.prime_svm
88+
name = each.value
89+
}
9090

91-
# resource "netapp-ontap_storage_volume_resource" "example" {
92-
# cx_profile_name = "primary_clus"
93-
# name = "rvwn_vol1_tf"
94-
# svm_name = var.prime_svm
95-
# aggregates = [
96-
# {
97-
# name = "aggr1"
98-
# },
99-
# ]
100-
# space_guarantee = "none"
101-
# snapshot_policy = "default"
102-
# space = {
103-
# size = 100
104-
# size_unit = "gb"
105-
# logical_space = {
106-
# enforcement = true
107-
# reporting = true
108-
# }
109-
# }
110-
# tiering = {
111-
# policy_name = "auto"
112-
# }
113-
# nas = {
114-
# export_policy_name = "default"
115-
# security_style = "unix"
116-
# junction_path = "/rvwn_vol1_tf"
117-
# }
118-
#}
91+
resource "netapp-ontap_storage_volume_resource" "example" {
92+
cx_profile_name = "primary_clus"
93+
name = "rvwn_vol1_tf"
94+
svm_name = var.prime_svm
95+
aggregates = [
96+
{
97+
name = "aggr1"
98+
},
99+
]
100+
space_guarantee = "none"
101+
snapshot_policy = "default"
102+
space = {
103+
size = 100
104+
size_unit = "gb"
105+
logical_space = {
106+
enforcement = true
107+
reporting = true
108+
}
109+
}
110+
tiering = {
111+
policy_name = "auto"
112+
}
113+
nas = {
114+
export_policy_name = "default"
115+
security_style = "unix"
116+
junction_path = "/rvwn_vol1_tf"
117+
}
118+
}

Terraform/fsxn-replicate/output.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +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-
#}
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+
}

0 commit comments

Comments
 (0)