Skip to content

Commit

Permalink
Added support for multiple SGs to main module
Browse files Browse the repository at this point in the history
  • Loading branch information
nichollri committed Aug 30, 2024
1 parent 2b9a784 commit f890bb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Terraform/deploy-fsx-ontap/module/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resource "aws_fsx_ontap_file_system" "terraform-fsxn" {
preferred_subnet_id = var.subnets["primarysub"]

storage_capacity = var.capacity_size_gb
security_group_ids = var.create_sg ? [element(aws_security_group.fsx_sg[*].id, 0)] : [var.security_group_id]
security_group_ids = var.create_sg ? [element(aws_security_group.fsx_sg[*].id, 0)] : var.security_group_ids
deployment_type = var.deployment_type
throughput_capacity_per_ha_pair = var.throughput_in_MBps
ha_pairs = var.ha_pairs
Expand All @@ -41,7 +41,7 @@ resource "aws_fsx_ontap_file_system" "terraform-fsxn" {
error_message = "You must specify EITHER cidr_block OR source_sg_id when creating a security group, not both."
}
precondition {
condition = var.create_sg || var.security_group_id != ""
condition = var.create_sg || length(var.security_group_ids) > 0
error_message = "You must specify a security group ID when not creating a security group."
}
}
Expand Down
8 changes: 4 additions & 4 deletions Terraform/deploy-fsx-ontap/module/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ variable "create_sg" {
default = true
}

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

variable "security_group_name_prefix" {
Expand Down

0 comments on commit f890bb2

Please sign in to comment.