@@ -25,59 +25,94 @@ data "aws_secretsmanager_secret_version" "ontap_dr_username_pass" {
2525}
2626
2727
28- provider "netapp-ontap" {
28+ # provider "netapp-ontap" {
2929 # A connection profile defines how to interface with an ONTAP cluster or svm.
3030 # 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- }
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+ # }
4848
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- }
49+ resource "aws_fsx_ontap_file_system" "terraform-fsxn" {
50+ 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" ]]
51+ preferred_subnet_id = var. dr_fsx_subnets [" primarysub" ]
52+
53+ storage_capacity = var. dr_fsx_capacity_size_gb
54+ security_group_ids = var. create_sg ? [element (aws_security_group. fsx_sg [* ]. id , 0 )] : var. security_group_ids
55+ deployment_type = var. dr_fsx_deploy_type
56+ throughput_capacity_per_ha_pair = var. dr_fsx_tput_in_MBps
57+ ha_pairs = var. dr_ha_pairs
58+ endpoint_ip_address_range = var. dr_endpoint_ip_address_range
59+ route_table_ids = var. dr_route_table_ids
60+ dynamic "disk_iops_configuration" {
61+ for_each = length (var. dr_disk_iops_configuration ) > 0 ? [var . dr_disk_iops_configuration ] : []
5562
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
63+ content {
64+ iops = try (disk_iops_configuration. value . iops , null )
65+ mode = try (disk_iops_configuration. value . mode , null )
7366 }
7467 }
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- }
68+
69+ tags = merge (var. dr_tags , {Name = var.dr_fsx_name})
70+ weekly_maintenance_start_time = var. dr_maintenance_start_time
71+ kms_key_id = var. dr_kms_key_id
72+ automatic_backup_retention_days = var. dr_backup_retention_days
73+ daily_automatic_backup_start_time = var. dr_backup_retention_days > 0 ? var. dr_daily_backup_start_time : null
74+ fsx_admin_password = jsondecode (data. aws_secretsmanager_secret_version . ontap_dr_username_pass . secret_string )[" password" ]
75+ }
76+
77+ # Define a storage virtual machine.
78+ resource "aws_fsx_ontap_storage_virtual_machine" "mysvm" {
79+ file_system_id = aws_fsx_ontap_file_system. terraform-fsxn . id
80+ name = var. dr_svm_name
81+ root_volume_security_style = var. dr_root_vol_sec_style
82+ }
83+
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+ # }
90+
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+ # }
0 commit comments