Skip to content

Commit 08e2d9d

Browse files
committed
Some minor updates.
1 parent 1c2022c commit 08e2d9d

File tree

4 files changed

+38
-43
lines changed

4 files changed

+38
-43
lines changed

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ module "fsxontap" {
133133
primarysub = "<YOUR-PRIMARY-SUBNET>"
134134
secondarysub = "<YOUR-SECONDAY-SUBNET>"
135135
}
136-
create_sg = <true / false> // true to create Security Group for the Fs / false otherwise
136+
create_sg = true // true to create Security Group for the Fs / false otherwise
137137
cidr_for_sg = "<YOUR-CIDR-BLOCK>"
138-
fsx_admin_password = "<YOUR_PASSWORD>"
138+
fsx_secret_name = "<YOUR_SECRET>" // The name of a secret in AWS Secrets Manager that contains the FSxN admin password.
139139
tags = {
140140
Terraform = "true"
141141
Environment = "dev"
@@ -147,7 +147,7 @@ module "fsxontap" {
147147
> To Override default values assigned to other variables in this module, add them to this source block as well. The above source block includes the minimum requirements only.
148148
149149
> [!NOTE]
150-
> The default deployment type is: MULTI_AZ_1. For SINGLE AZ deployment, override the `fsx_deploy_type` variable in the module block, and make sure to only provide one subnet as `primarysub`
150+
> The default deployment type is: MULTI_AZ_1. For SINGLE AZ deployment, set the `fsx_deploy_type` variable to SINGLE_AZ_1 in the module block.
151151
152152
Please read the vriables descriptions in `variables.tf` file for more information regarding the variables passed to the module block.
153153

@@ -166,31 +166,29 @@ terraform {
166166
}
167167
168168
provider "aws" {
169-
shared_config_files = ["$HOME/.aws/conf"]
170-
shared_credentials_files = ["$HOME/.aws/credentials"]
171169
region = "us-west-2"
172170
}
173171
174172
175173
module "fsxontap" {
176174
source = "github.com/Netapp/FSx-ONTAP-samples-scripts/Terraform/deploy-fsx-ontap/module"
177175
176+
name = "fsxontap"
177+
178178
vpc_id = "vpc-111111111"
179179
fsx_subnets = {
180180
"primarysub" = "subnet-11111111"
181181
"secondarysub" = "subnet-2222222"
182182
}
183183
create_sg = true
184184
cidr_for_sg = "10.0.0.0/8"
185-
fsx_admin_password = "yourpassword"
185+
fsx_secret_name = "fsx_secret"
186186
route_table_ids = ["rtb-111111"]
187187
tags = {
188188
Terraform = "true"
189189
Environment = "dev"
190190
}
191191
}
192-
193-
194192
```
195193

196194
### Install the module
@@ -240,7 +238,7 @@ Ensure that the proposed changes match what you expected before you apply the ch
240238
241239
Once confirmed, run the `terraform apply` command followed by `yes` to execute the Terrafom code and apply the changes proposed in the `plan` step:
242240
```shell
243-
terraform apply -y
241+
terraform apply
244242
```
245243
246244
<!-- BEGIN_TF_DOCS -->

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ resource "aws_fsx_ontap_file_system" "terraform-fsxn" {
2828
daily_automatic_backup_start_time = var.daily_backup_start_time
2929
fsx_admin_password = data.aws_secretsmanager_secret_version.fsx_password.secret_string
3030
route_table_ids = (var.fsx_deploy_type == "MULTI_AZ_1" ? var.route_table_ids : null)
31-
tags = var.tags
31+
tags = merge(var.tags, {Name = var.fsx_name })
3232
dynamic "disk_iops_configuration" {
3333
for_each = length(var.disk_iops_configuration) > 0 ? [var.disk_iops_configuration] : []
3434

@@ -57,7 +57,6 @@ resource "aws_fsx_ontap_storage_virtual_machine" "mysvm" {
5757

5858
// OPTIONAL PARAMETERS
5959
root_volume_security_style = var.root_vol_sec_style
60-
# active_directory_configuration {}
6160
}
6261

6362
resource "aws_fsx_ontap_volume" "myvol" {
@@ -74,12 +73,10 @@ resource "aws_fsx_ontap_volume" "myvol" {
7473
name = var.vol_info["tier_policy_name"]
7574
cooling_period = var.vol_info["cooling_period"]
7675
}
77-
bypass_snaplock_enterprise_retention = var.vol_info["bypass_sl_retention"]
78-
copy_tags_to_backups = var.vol_info["copy_tags_to_backups"]
79-
security_style = var.vol_info["sec_style"]
80-
skip_final_backup = var.vol_info["skip_final_backup"]
81-
# snaplock_configuration {}
82-
# snapshot_policy {}
76+
copy_tags_to_backups = var.vol_info["copy_tags_to_backups"]
77+
security_style = var.vol_info["sec_style"]
78+
skip_final_backup = var.vol_info["skip_final_backup"]
79+
snapshot_policy = var.vol_info["snapshot_policy"]
8380
}
8481
#
8582
# The next two data blocks retrieve the secret from Secrets Manager.

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

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
/*
2-
* If you want to set the nam eof your FSxN file system, you must set a "Name"
3-
* tag equal to the desired name. Feel free to add additional tags as needed.
4-
*/
51
variable "tags" {
6-
description = "Tags to be applied to the resources"
2+
description = "Tags to be applied to the FSxN file system."
73
type = map(any)
8-
default = {
9-
"Name" = "terraform-fsxn"
10-
}
4+
default = {}
5+
}
6+
7+
variable "fsx_name" {
8+
description = "The name to assigne to the FSxN file system."
9+
type = string
10+
default = "fsx1"
1111
}
1212

1313
variable "create_sg" {
14-
description = "Determines whether the SG should be deployed as part of this execution or not"
14+
description = "Determines whether the SG should be deployed as part of this deployment or not."
1515
type = bool
1616
default = true
1717
}
1818

1919
variable "security_group_id" {
20-
description = "If you are not creating the SG, provide the ID of the SG to be used"
20+
description = "If you are not creating the security group, provide the ID of the security group to be used."
2121
type = string
2222
default = ""
2323
}
@@ -41,20 +41,16 @@ variable "source_security_group_id" {
4141
}
4242

4343
variable "vpc_id" {
44-
description = "The ID of the VPC in which the FSxN fikesystem should be deployed"
44+
description = "The ID of the VPC in where the security group will be created."
4545
type = string
4646
default = ""
47-
validation {
48-
condition = var.vpc_id != ""
49-
error_message = "You must provide the ID of the VPC in which the FSxN file system should be deployed."
50-
}
5147
}
5248

5349
variable "fsx_subnets" {
5450
description = "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."
5551
type = map(string)
5652
default = {
57-
"primarysub" = "subnet-111111111"
53+
"primarysub" = "subnet-111111111"
5854
"secondarysub" = "subnet-222222222"
5955
}
6056
}
@@ -105,6 +101,10 @@ variable "backup_retention_days" {
105101
description = "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."
106102
type = number
107103
default = 0
104+
validation {
105+
condition = var.backup_retention_days >= 0 && var.backup_retention_days <= 90
106+
error_message = "Invalid backup retention days. Valid values are between 0 and 90."
107+
}
108108
}
109109

110110
variable "daily_backup_start_time" {
@@ -120,7 +120,7 @@ variable "disk_iops_configuration" {
120120
}
121121

122122
variable "fsx_secret_name" {
123-
description = "The name of the secure where the FSxN passwood is stored"
123+
description = "The name of the secure where the FSxN passwood is stored."
124124
type = string
125125
default = ""
126126
validation {
@@ -136,7 +136,7 @@ variable "route_table_ids" {
136136
}
137137

138138
variable "svm_name" {
139-
description = "The name of the Storage Virtual Machine"
139+
description = "The name of the Storage Virtual Machine, (a.k.a. vserver)."
140140
type = string
141141
default = "first_svm"
142142
}
@@ -151,17 +151,17 @@ variable "vol_info" {
151151
description = "Details for the volume creation"
152152
type = map(any)
153153
default = {
154-
"vol_name" = "vol1"
155-
"junction_path" = "/vol1"
156-
"size_mg" = 1024
157-
"efficiency" = true
158-
"tier_policy_name" = "AUTO"
159-
"cooling_period" = 31
154+
"vol_name" = "vol1"
155+
"junction_path" = "/vol1"
156+
"size_mg" = 1024
157+
"efficiency" = true
158+
"tier_policy_name" = "AUTO"
159+
"cooling_period" = 31
160160
"vol_type" = "RW"
161-
"bypass_sl_retention" = false
162161
"copy_tags_to_backups" = false
163162
"sec_style" = "UNIX"
164163
"skip_final_backup" = false
164+
"snapshot_policy" = "default"
165165
}
166166
}
167167

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ variable "vol_info" {
8181
}
8282

8383
variable "vpc_id" {
84-
description = "The ID of the VPC in which the FSxN fikesystem should be deployed"
84+
description = "The ID of the VPC in which the security group will be created."
8585
type = string
8686
default = "vpc-11111111"
8787
}

0 commit comments

Comments
 (0)