Skip to content

Commit 5d357f6

Browse files
authored
Merge pull request #150 from NetApp/update_terraform_fsxn
Changed the name of some of the variables
2 parents 92b220f + bfbfa4e commit 5d357f6

File tree

4 files changed

+104
-87
lines changed

4 files changed

+104
-87
lines changed

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

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,26 +256,25 @@ terraform apply
256256
| Name | Description | Type | Default | Required |
257257
|------|-------------|------|---------|:--------:|
258258
| backup_retention_days | The number of days to retain automatic backups. Setting this to 0 disables automatic backups. You can retain automatic backups for a maximum of 90 days. | `number` | `0` | no |
259-
| cidr_for_sg | cidr block to be used for the created security ingress rules. | `string` | `"10.0.0.0/8"` | no |
259+
| capacity_size_gb | The storage capacity (GiB) of the FSxN file system. Valid values between 1024 and 196608 | `number` | `1024` | no |
260+
| cidr_for_sg | cidr block to be used for the created security ingress rules. Set to an empty string if you want to use the source_sg_id as the source. | `string` | `""` | no |
260261
| create_sg | Determines whether the SG should be deployed as part of this deployment or not. | `bool` | `true` | no |
261262
| daily_backup_start_time | A recurring daily time, in the format HH:MM. HH is the zero-padded hour of the day (0-23), and MM is the zero-padded minute of the hour. Requires automatic_backup_retention_days to be set. | `string` | `"00:00"` | no |
263+
| deployment_type | The filesystem deployment type. Supports MULTI_AZ_1 and SINGLE_AZ_1 | `string` | `"MULTI_AZ_1"` | no |
262264
| disk_iops_configuration | The SSD IOPS configuration for the file system. Valid modes are 'AUTOMATIC' (3 iops per GB provided) or 'USER_PROVISIONED'. NOTE: Due to a bug in the AWS FSx provider, if you want AUTOMATIC, then leave this variable empty. If you want USER_PROVIDEDED, then add a 'mode=USER_PROVISIONED' (with USER_PROVISIONED enclosed in doube quotes) and 'iops=number' where number is between 1 and 160000. | `map(any)` | `{}` | no |
263-
| fsx_capacity_size_gb | The storage capacity (GiB) of the FSxN file system. Valid values between 1024 and 196608 | `number` | `1024` | no |
264-
| fsx_deploy_type | The filesystem deployment type. Supports MULTI_AZ_1 and SINGLE_AZ_1 | `string` | `"MULTI_AZ_1"` | no |
265-
| fsx_maintenance_start_time | The preferred start time (in d:HH:MM format) to perform weekly maintenance, in the UTC time zone. | `string` | `"1:00:00"` | no |
266-
| fsx_name | The name to assigne to the FSxN file system. | `string` | `"fsx1"` | no |
267-
| fsx_secret_name | The name of the secure where the FSxN passwood is stored. | `string` | `""` | no |
268-
| fsx_subnets | The subnets from where the file system will be accessible from. For MULTI_AZ_1 deployment type, provide both primvary and secondary subnets. For SINGLE_AZ_1 deployment type, only the primary subnet is used. | `map(string)` | <pre>{<br> "primarysub": "subnet-111111111",<br> "secondarysub": "subnet-222222222"<br>}</pre> | no |
269-
| fsx_tput_in_MBps | The throughput capacity (in MBps) for the file system. Valid values are 128, 256, 512, 1024, 2048, and 4096. | `number` | `128` | no |
270265
| kms_key_id | ARN for the KMS Key to encrypt the file system at rest, Defaults to an AWS managed KMS Key. | `string` | `null` | no |
266+
| maintenance_start_time | The preferred start time (in d:HH:MM format) to perform weekly maintenance, in the UTC time zone. | `string` | `"1:00:00"` | no |
267+
| name | The name to assigne to the FSxN file system. | `string` | `"fsx1"` | no |
271268
| root_vol_sec_style | Specifies the root volume security style, Valid values are UNIX, NTFS, and MIXED (although MIXED is not recommended). All volumes created under this SVM will inherit the root security style unless the security style is specified on the volume. | `string` | `"UNIX"` | no |
272269
| route_table_ids | Specifies the VPC route tables in which your file system's endpoints will be created. You should specify all VPC route tables associated with the subnets in which your clients are located. By default, Amazon FSx selects your VPC's default route table. Note, this variable is only used for MULTI_AZ_1 type deployments. | `list(any)` | `null` | no |
270+
| secret_name | The name of the secure where the FSxN passwood is stored. | `string` | `""` | no |
273271
| security_group_id | If you are not creating the security group, provide the ID of the security group to be used. | `string` | `""` | no |
274-
| source_security_group_id | The ID of the security group to allow access to the FSxN file system. | `string` | `""` | no |
272+
| 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 |
273+
| subnets | The subnets from where the file system will be accessible from. For MULTI_AZ_1 deployment type, provide both primvary and secondary subnets. For SINGLE_AZ_1 deployment type, only the primary subnet is used. | `map(string)` | <pre>{<br> "primarysub": "subnet-111111111",<br> "secondarysub": "subnet-222222222"<br>}</pre> | no |
275274
| svm_name | The name of the Storage Virtual Machine, (a.k.a. vserver). | `string` | `"first_svm"` | no |
276275
| tags | Tags to be applied to the FSxN file system. | `map(any)` | `{}` | no |
276+
| throughput_in_MBps | The throughput capacity (in MBps) for the file system. Valid values are 128, 256, 512, 1024, 2048, and 4096. | `number` | `128` | no |
277277
| vol_info | Details for the volume creation | `map(any)` | <pre>{<br> "cooling_period": 31,<br> "copy_tags_to_backups": false,<br> "efficiency": true,<br> "junction_path": "/vol1",<br> "sec_style": "UNIX",<br> "size_mg": 1024,<br> "skip_final_backup": false,<br> "snapshot_policy": "default",<br> "tier_policy_name": "AUTO",<br> "vol_name": "vol1",<br> "vol_type": "RW"<br>}</pre> | no |
278-
| vol_snapshot_policy | Specifies the snapshot policy for the volume | `map(any)` | `null` | no |
279278
| vpc_id | The ID of the VPC in where the security group will be created. | `string` | `""` | no |
280279
281280
### Outputs

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@
1414

1515
resource "aws_fsx_ontap_file_system" "terraform-fsxn" {
1616
// REQUIRED PARAMETERS
17-
subnet_ids = (var.fsx_deploy_type == "MULTI_AZ_1" ? [var.fsx_subnets["primarysub"], var.fsx_subnets["secondarysub"]] : [var.fsx_subnets["primarysub"]])
18-
preferred_subnet_id = var.fsx_subnets["primarysub"]
17+
subnet_ids = (var.deployment_type == "MULTI_AZ_1" ? [var.subnets["primarysub"], var.subnets["secondarysub"]] : [var.subnets["primarysub"]])
18+
preferred_subnet_id = var.subnets["primarysub"]
1919

2020
// OPTIONAL PARAMETERS
21-
storage_capacity = var.fsx_capacity_size_gb
21+
storage_capacity = var.capacity_size_gb
2222
security_group_ids = var.create_sg ? [element(aws_security_group.fsx_sg.*.id, 0)] : [var.security_group_id]
23-
deployment_type = var.fsx_deploy_type
24-
throughput_capacity = var.fsx_tput_in_MBps
25-
weekly_maintenance_start_time = var.fsx_maintenance_start_time
23+
deployment_type = var.deployment_type
24+
throughput_capacity = var.throughput_in_MBps
25+
weekly_maintenance_start_time = var.maintenance_start_time
2626
kms_key_id = var.kms_key_id
2727
automatic_backup_retention_days = var.backup_retention_days
2828
daily_automatic_backup_start_time = var.daily_backup_start_time
2929
fsx_admin_password = data.aws_secretsmanager_secret_version.fsx_password.secret_string
30-
route_table_ids = (var.fsx_deploy_type == "MULTI_AZ_1" ? var.route_table_ids : null)
31-
tags = merge(var.tags, {Name = var.fsx_name })
30+
route_table_ids = (var.deployment_type == "MULTI_AZ_1" ? var.route_table_ids : null)
31+
tags = merge(var.tags, {Name = var.name })
3232
dynamic "disk_iops_configuration" {
3333
for_each = length(var.disk_iops_configuration) > 0 ? [var.disk_iops_configuration] : []
3434

@@ -40,8 +40,8 @@ resource "aws_fsx_ontap_file_system" "terraform-fsxn" {
4040

4141
lifecycle {
4242
precondition {
43-
condition = !var.create_sg || (var.cidr_for_sg != "" && var.source_security_group_id == "" || var.cidr_for_sg == "" && var.source_security_group_id != "")
44-
error_message = "You must specify EITHER cidr_block OR source_security_group_id when creating a security group, not both."
43+
condition = !var.create_sg || (var.cidr_for_sg != "" && var.source_sg_id == "" || var.cidr_for_sg == "" && var.source_sg_id != "")
44+
error_message = "You must specify EITHER cidr_block OR source_sg_id when creating a security group, not both."
4545
}
4646
precondition {
4747
condition = var.create_sg || var.security_group_id != ""
@@ -81,7 +81,7 @@ resource "aws_fsx_ontap_volume" "myvol" {
8181
#
8282
# The next two data blocks retrieve the secret from Secrets Manager.
8383
data "aws_secretsmanager_secret" "fsx_secret" {
84-
name = var.fsx_secret_name
84+
name = var.secret_name
8585
}
8686
data "aws_secretsmanager_secret_version" "fsx_password" {
8787
secret_id = data.aws_secretsmanager_secret.fsx_secret.id

0 commit comments

Comments
 (0)