Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/CONFIG-VARS.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ When `storage_type=ha` and `storage_type_backend=ontap`, an [AWS FSx for NetApp
<!--| Name | Description | Type | Default | Notes | -->
| <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> |
| :--- | :--- | :--- | :--- | :--- |
| 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`. |
| 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`. |
| 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. |
| 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. |
| aws_fsx_ontap_fsxadmin_password | The ONTAP administrative password for the fsxadmin user. | string | "v3RyS3cretPa$sw0rd" | |
Expand Down
22 changes: 18 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -759,18 +759,32 @@ variable "enable_efs_encryption" {
default = false
}

# The FSx filesystem availability zone deployment type. Supports MULTI_AZ_1 and SINGLE_AZ_1
# The FSx filesystem availability zone deployment type. Supports MULTI_AZ_1, MULTI_AZ_2, SINGLE_AZ_1, and SINGLE_AZ_2
variable "aws_fsx_ontap_deployment_type" {
description = "The FSx filesystem availability zone deployment type. Supports MULTI_AZ_1 and SINGLE_AZ_1"
description = "The FSx filesystem availability zone deployment type. Supports MULTI_AZ_1, MULTI_AZ_2, SINGLE_AZ_1, and SINGLE_AZ_2."
type = string
default = "SINGLE_AZ_1"

validation {
condition = contains(["single_az_1", "multi_az_1"], lower(var.aws_fsx_ontap_deployment_type))
error_message = "ERROR: Supported values for `fsx_ontap_deployment_type` are - SINGLE_AZ_1, MULTI_AZ_1."
condition = contains(["single_az_1", "single_az_2", "multi_az_1", "multi_az_2"], lower(var.aws_fsx_ontap_deployment_type))
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."
}
}

# HA pair count (only for deployment types SINGLE_AZ_2 or MULTI_AZ_2).
variable "aws_fsx_ontap_file_system_ha_pairs" {
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."
type = number
default = 1
}

# Throughput per HA pair in MB/s (only for deployment types SINGLE_AZ_2 or MULTI_AZ_2).
variable "aws_fsx_ontap_file_system_throughput_capacity_per_ha_pair" {
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."
type = number
default = 384
}

# The ONTAP administrative password for the fsxadmin user that you can use to administer your file system using the ONTAP CLI and REST API.
variable "aws_fsx_ontap_fsxadmin_password" {
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."
Expand Down
11 changes: 9 additions & 2 deletions vms.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ locals {
: local.storage_type_backend == "efs" ? "/"
: local.storage_type_backend == "ontap" ? "/ontap" : "/export"
)
# Flag to distinguish FSx ONTAP Gen2 deployment types
fsx_is_gen2 = contains(["SINGLE_AZ_2", "MULTI_AZ_2"], var.aws_fsx_ontap_deployment_type)
}

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

# If deployment_type is SINGLE_AZ_1 then subnet_ids should have 1 subnet ID
# If deployment_type is MULTI_AZ_1 then subnet_ids should have 2 subnet IDs, there is a 2 subnet ID maximum
subnet_ids = var.aws_fsx_ontap_deployment_type == "SINGLE_AZ_1" ? [module.vpc.private_subnets[0]] : module.vpc.private_subnets
throughput_capacity = var.aws_fsx_ontap_file_system_throughput_capacity
subnet_ids = contains(["SINGLE_AZ_1", "SINGLE_AZ_2"], var.aws_fsx_ontap_deployment_type) ? [module.vpc.private_subnets[0]] : module.vpc.private_subnets

# Gen1 uses throughput_capacity. Gen2 uses ha_pairs + throughput_capacity_per_ha_pair.
throughput_capacity = local.fsx_is_gen2 ? null : var.aws_fsx_ontap_file_system_throughput_capacity
throughput_capacity_per_ha_pair = local.fsx_is_gen2 ? var.aws_fsx_ontap_file_system_throughput_capacity_per_ha_pair : null
ha_pairs = local.fsx_is_gen2 ? var.aws_fsx_ontap_file_system_ha_pairs : null

preferred_subnet_id = module.vpc.private_subnets[0]
security_group_ids = [local.workers_security_group_id]
tags = merge(local.tags, { "Name" : "${var.prefix}-ontap-fs" })
Expand Down
Loading