Skip to content

Commit 7973715

Browse files
committed
feat: allow/support second generation FSx ONTAP filesystems
Signed-off-by: Jeff Owens <[email protected]>
1 parent 1936403 commit 7973715

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

docs/CONFIG-VARS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ When `storage_type=ha` and `storage_type_backend=ontap`, an [AWS FSx for NetApp
349349
<!--| Name | Description | Type | Default | Notes | -->
350350
| <div style="width:50px">Name</div> | <div style="width:150px">Description</div> | <div style="width:50px">Type</div> | <div style="width:75px">Default</div> | <div style="width:150px">Notes</div> |
351351
| :--- | :--- | :--- | :--- | :--- |
352-
| aws_fsx_ontap_deployment_type | The FSx file system availability zone deployment type. | string | SINGLE_AZ_1 | Supported values are `MULTI_AZ_1` and `SINGLE_AZ_1`. |
352+
| aws_fsx_ontap_deployment_type | The FSx file system availability zone deployment type. | string | SINGLE_AZ_1 | Supported values are `MULTI_AZ_1`, `MULTI_AZ_2`, `SINGLE_AZ_1`, and `SINGLE_AZ_2`. |
353353
| aws_fsx_ontap_file_system_storage_capacity | The storage capacity of the ONTAP file system in GiB. | number | 1024 | Valid values range from 1024 to 196608. |
354354
| aws_fsx_ontap_file_system_throughput_capacity | The throughput capacity of the ONTAP file system in MBps. | number | 256 | Valid values are 128, 256, 512, 1024, 2048 and 4096. |
355355
| aws_fsx_ontap_fsxadmin_password | The ONTAP administrative password for the fsxadmin user. | string | "v3RyS3cretPa$sw0rd" | |

variables.tf

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -759,18 +759,32 @@ variable "enable_efs_encryption" {
759759
default = false
760760
}
761761

762-
# The FSx filesystem availability zone deployment type. Supports MULTI_AZ_1 and SINGLE_AZ_1
762+
# The FSx filesystem availability zone deployment type. Supports MULTI_AZ_1, MULTI_AZ_2, SINGLE_AZ_1, and SINGLE_AZ_2
763763
variable "aws_fsx_ontap_deployment_type" {
764-
description = "The FSx filesystem availability zone deployment type. Supports MULTI_AZ_1 and SINGLE_AZ_1"
764+
description = "The FSx filesystem availability zone deployment type. Supports MULTI_AZ_1, MULTI_AZ_2, SINGLE_AZ_1, and SINGLE_AZ_2."
765765
type = string
766766
default = "SINGLE_AZ_1"
767767

768768
validation {
769-
condition = contains(["single_az_1", "multi_az_1"], lower(var.aws_fsx_ontap_deployment_type))
770-
error_message = "ERROR: Supported values for `fsx_ontap_deployment_type` are - SINGLE_AZ_1, MULTI_AZ_1."
769+
condition = contains(["single_az_1", "single_az_2", "multi_az_1", "multi_az_2"], lower(var.aws_fsx_ontap_deployment_type))
770+
error_message = "ERROR: Supported values for `aws_fsx_ontap_deployment_type` are SINGLE_AZ_1, SINGLE_AZ_2, MULTI_AZ_1, and MULTI_AZ_2."
771771
}
772772
}
773773

774+
# HA pair count (only for deployment types SINGLE_AZ_2 or MULTI_AZ_2).
775+
variable "aws_fsx_ontap_file_system_ha_pairs" {
776+
description = "Number of HA pairs (two-node sets) for FSx ONTAP when aws_fsx_ontap_deployment_type is SINGLE_AZ_2 or MULTI_AZ_2; increases aggregate capacity and performance."
777+
type = number
778+
default = 1
779+
}
780+
781+
# Throughput per HA pair in MB/s (only for deployment types SINGLE_AZ_2 or MULTI_AZ_2).
782+
variable "aws_fsx_ontap_file_system_throughput_capacity_per_ha_pair" {
783+
description = "Provisioned throughput (MB/s) per HA pair when aws_fsx_ontap_deployment_type is SINGLE_AZ_2 or MULTI_AZ_2; total throughput = value * aws_fsx_ontap_file_system_ha_pairs."
784+
type = number
785+
default = 384
786+
}
787+
774788
# The ONTAP administrative password for the fsxadmin user that you can use to administer your file system using the ONTAP CLI and REST API.
775789
variable "aws_fsx_ontap_fsxadmin_password" {
776790
description = "The ONTAP administrative password for the fsxadmin user that you can use to administer your file system using the ONTAP CLI and REST API."

vms.tf

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ locals {
1414
: local.storage_type_backend == "efs" ? "/"
1515
: local.storage_type_backend == "ontap" ? "/ontap" : "/export"
1616
)
17+
# Flag to distinguish FSx ONTAP Gen2 deployment types
18+
fsx_is_gen2 = contains(["SINGLE_AZ_2", "MULTI_AZ_2"], var.aws_fsx_ontap_deployment_type)
1719
}
1820

1921
# ONTAP File System - https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/fsx_ontap_file_system
@@ -29,8 +31,13 @@ resource "aws_fsx_ontap_file_system" "ontap-fs" {
2931

3032
# If deployment_type is SINGLE_AZ_1 then subnet_ids should have 1 subnet ID
3133
# If deployment_type is MULTI_AZ_1 then subnet_ids should have 2 subnet IDs, there is a 2 subnet ID maximum
32-
subnet_ids = var.aws_fsx_ontap_deployment_type == "SINGLE_AZ_1" ? [module.vpc.private_subnets[0]] : module.vpc.private_subnets
33-
throughput_capacity = var.aws_fsx_ontap_file_system_throughput_capacity
34+
subnet_ids = contains(["SINGLE_AZ_1", "SINGLE_AZ_2"], var.aws_fsx_ontap_deployment_type) ? [module.vpc.private_subnets[0]] : module.vpc.private_subnets
35+
36+
# Gen1 uses throughput_capacity. Gen2 uses ha_pairs + throughput_capacity_per_ha_pair.
37+
throughput_capacity = local.fsx_is_gen2 ? null : var.aws_fsx_ontap_file_system_throughput_capacity
38+
throughput_capacity_per_ha_pair = local.fsx_is_gen2 ? var.aws_fsx_ontap_file_system_throughput_capacity_per_ha_pair : null
39+
ha_pairs = local.fsx_is_gen2 ? var.aws_fsx_ontap_file_system_ha_pairs : null
40+
3441
preferred_subnet_id = module.vpc.private_subnets[0]
3542
security_group_ids = [local.workers_security_group_id]
3643
tags = merge(local.tags, { "Name" : "${var.prefix}-ontap-fs" })

0 commit comments

Comments
 (0)