Skip to content

Commit

Permalink
[DOP-2327] Update fsx module to allow use of create/load module (#343)
Browse files Browse the repository at this point in the history
* Update fsx module version and add variables

* Change variable names

* Add fsx variables and change outputs

* Add fsx variable default value

* Update per_unit_storage_throughput default value

* Update per_unit_storage_throughput default value

* Rollback default values for fsx
  • Loading branch information
ltellesfl authored Nov 21, 2024
1 parent 6b8abf3 commit 548e1fb
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 15 deletions.
8 changes: 4 additions & 4 deletions ipa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ locals {
csi:
driver: fsx.csi.aws.com
volumeAttributes:
dnsname: ${module.fsx-storage[0].fsx-rwx.dns_name}
mountname: ${module.fsx-storage[0].fsx-rwx.mount_name}
volumeHandle: ${module.fsx-storage[0].fsx-rwx.id}
dnsname: ${module.fsx-storage[0].fsx_rwx_dns_name}
mountname: ${module.fsx-storage[0].fsx_rwx_mount_name}
volumeHandle: ${module.fsx-storage[0].fsx_rwx_id}
indicoStorageClass:
enabled: true
name: indico-sc
provisioner: fsx.csi.aws.com
parameters:
securityGroupIds: ${local.security_group_id}
subnetId: ${module.fsx-storage[0].fsx-rwx.subnet_ids[0]}
subnetId: ${module.fsx-storage[0].fsx_rwx_subnet_ids[0]}
EOF
] : []
storage_spec = var.include_fsx == true ? local.fsx_values : local.efs_values
Expand Down
16 changes: 13 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ module "efs-storage-local-registry" {
module "fsx-storage" {
count = var.include_fsx == true ? 1 : 0
source = "app.terraform.io/indico/indico-aws-fsx/mod"
version = "1.4.2"
version = "2.0.0"
label = var.label
additional_tags = var.additional_tags
region = var.region
Expand All @@ -297,7 +297,17 @@ module "fsx-storage" {
api_models_bucket = module.s3-storage.api_models_s3_bucket_name
kms_key = module.kms_key.key
per_unit_storage_throughput = var.per_unit_storage_throughput
deployment_type = var.fsx_deployment_type
include_rox = var.include_rox
fsx_type = var.fsx_type
fsx_rwx_id = var.fsx_rwx_id
fsx_rwx_subnet_ids = var.fsx_rwx_subnet_ids
fsx_rwx_security_group_ids = var.fsx_rwx_security_group_ids
fsx_rwx_dns_name = var.fsx_rwx_dns_name
fsx_rwx_mount_name = var.fsx_rwx_mount_name
fsx_rwx_arn = var.fsx_rwx_arn
fsx_rox_id = var.fsx_rox_id
fsx_rox_arn = var.fsx_rox_arn
}

module "cluster" {
Expand All @@ -319,7 +329,7 @@ module "cluster" {
cluster_node_policies = var.cluster_node_policies
eks_cluster_iam_role = var.eks_cluster_iam_role
eks_cluster_nodes_iam_role = "${var.label}-${var.region}-node-role"
fsx_arns = [var.include_rox ? module.fsx-storage[0].fsx-rox.arn : "", var.include_fsx == true ? module.fsx-storage[0].fsx-rwx.arn : ""]
fsx_arns = [var.include_rox ? module.fsx-storage[0].fsx_rox_arn : "", var.include_fsx == true ? module.fsx-storage[0].fsx_rwx_arn : ""]
kms_key_arn = module.kms_key.key_arn
az_count = var.az_count
key_pair = aws_key_pair.kp.key_name
Expand Down Expand Up @@ -468,7 +478,7 @@ module "argo-registration" {
}

locals {
security_group_id = var.include_fsx == true ? tolist(module.fsx-storage[0].fsx-rwx.security_group_ids)[0] : ""
security_group_id = var.include_fsx == true ? tolist(module.fsx-storage[0].fsx_rwx_security_group_ids)[0] : ""
cluster_name = var.label
dns_zone_name = var.dns_zone_name == "" ? lower("${var.aws_account}.${var.domain_suffix}") : var.dns_zone_name
dns_name = var.domain_host == "" ? lower("${var.label}.${var.region}.${local.dns_zone_name}") : var.domain_host
Expand Down
16 changes: 8 additions & 8 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ output "efs_filesystem_id" {
description = "ID of the EFS filesystem"
value = var.include_efs == true ? module.efs-storage[0].efs_filesystem_id : ""
}
output "fsx-rwx" {
output "fsx_rwx_id" {
description = "Read write filesystem"
value = var.include_fsx == true ? module.fsx-storage[0].fsx-rwx : null
value = var.include_fsx == true ? module.fsx-storage[0].fsx_rwx_id : null
}

output "fsx-rox" {
output "fsx_rox_id" {
description = "Read only filesystem"
value = var.include_rox ? module.fsx-storage[0].fsx-rox : ""
value = var.include_rox ? module.fsx-storage[0].fsx_rox_id : ""
}

output "key_pem" {
Expand All @@ -36,19 +36,19 @@ output "key_pem" {
}

output "fsx_storage_fsx_rwx_dns_name" {
value = var.include_fsx == true ? module.fsx-storage[0].fsx-rwx.dns_name : ""
value = var.include_fsx == true ? module.fsx-storage[0].fsx_rwx_dns_name : ""
}

output "fsx_storage_fsx_rwx_mount_name" {
value = var.include_fsx == true ? module.fsx-storage[0].fsx-rwx.mount_name : ""
value = var.include_fsx == true ? module.fsx-storage[0].fsx_rwx_mount_name : ""
}

output "fsx_storage_fsx_rwx_volume_handle" {
value = var.include_fsx == true ? module.fsx-storage[0].fsx-rwx.id : ""
value = var.include_fsx == true ? module.fsx-storage[0].fsx_rwx_id : ""
}

output "fsx_storage_fsx_rwx_subnet_id" {
value = var.include_fsx == true ? module.fsx-storage[0].fsx-rwx.subnet_ids[0] : ""
value = var.include_fsx == true ? module.fsx-storage[0].fsx_rwx_subnet_ids[0] : ""
}

output "cluster_name" {
Expand Down
63 changes: 63 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1051,3 +1051,66 @@ variable "instance_volume_type" {
default = "gp2"
description = "The type of EBS volume to attach to the cluster nodes"
}

variable "fsx_deployment_type" {
type = string
default = "PERSISTENT_1"
description = "The deployment type to launch"
}

variable "fsx_type" {
type = string
default = "create"
validation {
condition = var.fsx_type == "create" || var.fsx_type == "load"
error_message = "${var.fsx_type} not valid. Type must be either create or load"
}
}

variable "fsx_rwx_id" {
description = "ID of the existing FSx Lustre file system for RWX"
type = string
default = null
}

variable "fsx_rwx_subnet_ids" {
description = "Subnet IDs for the RWX FSx Lustre file system"
type = list(string)
default = []
}

variable "fsx_rwx_security_group_ids" {
description = "Security group IDs for the RWX FSx Lustre file system"
type = list(string)
default = []
}

variable "fsx_rwx_dns_name" {
description = "DNS name for the RWX FSx Lustre file system"
type = string
default = null
}

variable "fsx_rwx_mount_name" {
description = "Mount name for the RWX FSx Lustre file system"
type = string
default = null
}

variable "fsx_rwx_arn" {
description = "ARN of the RWX FSx Lustre file system"
type = string
default = null
}

variable "fsx_rox_id" {
description = "ID of the existing FSx Lustre file system for ROX"
type = string
default = null
}

variable "fsx_rox_arn" {
description = "ARN of the ROX FSx Lustre file system"
type = string
default = null
}

0 comments on commit 548e1fb

Please sign in to comment.