Skip to content

Commit f78a81f

Browse files
authored
Merge pull request #185 from NetApp/rvwn_sg_list
Added support for multiple SGs to main module
2 parents f34fc47 + c1fe6b4 commit f78a81f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Terraform/deploy-fsx-ontap/module/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ terraform apply
236236
| route_table_ids | An array of routing table IDs that will be modified to allow access to the FSxN file system. This is only used for Multi AZ deployment types and must be left as null for Single AZ deployment types. | `list(string)` | `null` | no |
237237
| secret_name_prefix | The prefix to the secret name that will be created that will contain the FSxN passwords (system, and SVM). | `string` | `"fsxn-secret"` | no |
238238
| secrets_region | The AWS region where the secrets for the FSxN file system and SVM will be deployed. | `string` | `""` | no |
239-
| security_group_id | If you are not creating the security group, provide the ID of the security group to be used. | `string` | `""` | no |
239+
| security_group_ids | If you are not creating the security group, provide a list of IDs of the security groups to be used. | `list(string)` | `[]` | no |
240240
| security_group_name_prefix | The prefix to the security group name that will be created. | `string` | `"fsxn-sg"` | no |
241241
| source_sg_id | The ID of the security group to allow access to the FSxN file system. Set to an empty string if you want to use the cidr_for_sg as the source. | `string` | `""` | no |
242242
| svm_name | name of the Storage Virtual Machine, (a.k.a. vserver). | `string` | `"fsx"` | no |

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)