Skip to content

Commit f890bb2

Browse files
author
nichollri
committed
Added support for multiple SGs to main module
1 parent 2b9a784 commit f890bb2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Terraform/deploy-fsx-ontap/module/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ resource "aws_fsx_ontap_file_system" "terraform-fsxn" {
1414
preferred_subnet_id = var.subnets["primarysub"]
1515

1616
storage_capacity = var.capacity_size_gb
17-
security_group_ids = var.create_sg ? [element(aws_security_group.fsx_sg[*].id, 0)] : [var.security_group_id]
17+
security_group_ids = var.create_sg ? [element(aws_security_group.fsx_sg[*].id, 0)] : var.security_group_ids
1818
deployment_type = var.deployment_type
1919
throughput_capacity_per_ha_pair = var.throughput_in_MBps
2020
ha_pairs = var.ha_pairs
@@ -41,7 +41,7 @@ resource "aws_fsx_ontap_file_system" "terraform-fsxn" {
4141
error_message = "You must specify EITHER cidr_block OR source_sg_id when creating a security group, not both."
4242
}
4343
precondition {
44-
condition = var.create_sg || var.security_group_id != ""
44+
condition = var.create_sg || length(var.security_group_ids) > 0
4545
error_message = "You must specify a security group ID when not creating a security group."
4646
}
4747
}

Terraform/deploy-fsx-ontap/module/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ variable "create_sg" {
174174
default = true
175175
}
176176

177-
variable "security_group_id" {
178-
description = "If you are not creating the security group, provide the ID of the security group to be used."
179-
type = string
180-
default = ""
177+
variable "security_group_ids" {
178+
description = "If you are not creating the security group, provide a list of IDs of the security groups to be used."
179+
type = list(string)
180+
default = []
181181
}
182182

183183
variable "security_group_name_prefix" {

0 commit comments

Comments
 (0)