Skip to content

Commit 23501de

Browse files
authored
Merge branch 'main' into Restructuring2
2 parents cdd6cd4 + 360f311 commit 23501de

File tree

14 files changed

+536
-308
lines changed

14 files changed

+536
-308
lines changed

.github/linters/.tflint.hcl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
tflint {
2+
required_version = ">= 0.50"
3+
}
4+
5+
config {
6+
rule "terraform_typed_variables" {
7+
enabled = false
8+
}
9+
rule "terraform_module_version" {
10+
enabled = false
11+
}
12+
rule "terraform_required_providers" {
13+
enabled = false
14+
}
15+
rule "terraform_unused_declarations" {
16+
enabled = false
17+
}
18+
}

EKS/FSxN-as-PVC-for-EKS/terraform/eks-cluster.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ resource "aws_iam_policy" "trident_policy" {
8181
{
8282
"Action": "secretsmanager:GetSecretValue",
8383
"Effect": "Allow",
84-
"Resource": "${aws_secretsmanager_secret_version.fsx_secret_password.arn}"
84+
"Resource": aws_secretsmanager_secret_version.fsx_secret_password.arn
8585
}
8686
],
8787
})

Terraform/deploy-fsx-ontap-fileshare-access/modules/vpn/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ resource "aws_acm_certificate" "server_vpn_cert" {
66
certificate_body = var.server_cert
77
private_key = var.server_private_key
88
certificate_chain = var.ca_crt
9+
lifecycle {
10+
create_before_destroy = true
11+
}
912
}
1013

1114
resource "aws_acm_certificate" "client_vpn_cert" {
1215
certificate_body = var.client_cert
1316
private_key = var.client_private_key
1417
certificate_chain = var.ca_crt
18+
lifecycle {
19+
create_before_destroy = true
20+
}
1521
}
1622

1723
resource "aws_ec2_client_vpn_endpoint" "my_client_vpn" {

Terraform/deploy-fsx-ontap-fileshare-access/networking.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ resource "aws_eip" "nat_eip" {
2828
# NAT
2929
resource "aws_nat_gateway" "nat" {
3030
allocation_id = aws_eip.nat_eip.id
31-
subnet_id = element(aws_subnet.public_subnet.*.id, 0)
31+
subnet_id = element(aws_subnet.public_subnet[*].id, 0)
3232

3333
tags = {
3434
Name = "nat"
35-
Environment = "${var.environment}"
35+
Environment = var.environment
3636
}
3737
}
3838

@@ -46,7 +46,7 @@ resource "aws_subnet" "public_subnet" {
4646

4747
tags = {
4848
Name = "${var.creator_tag}-${var.environment}-${element(var.availability_zones, count.index)}-public-subnet"
49-
Environment = "${var.environment}"
49+
Environment = var.environment
5050
}
5151
}
5252

@@ -61,7 +61,7 @@ resource "aws_subnet" "private_subnet" {
6161

6262
tags = {
6363
Name = "${var.creator_tag}-${var.environment}-${element(var.availability_zones, count.index)}-private-subnet"
64-
Environment = "${var.environment}"
64+
Environment = var.environment
6565
}
6666
}
6767

@@ -72,7 +72,7 @@ resource "aws_route_table" "private" {
7272

7373
tags = {
7474
Name = "${var.creator_tag}-${var.environment}-private-route-table"
75-
Environment = "${var.environment}"
75+
Environment = var.environment
7676
}
7777
}
7878

@@ -82,7 +82,7 @@ resource "aws_route_table" "public" {
8282

8383
tags = {
8484
Name = "${var.creator_tag}-${var.environment}-public-route-table"
85-
Environment = "${var.environment}"
85+
Environment = var.environment
8686
}
8787
}
8888

@@ -103,13 +103,13 @@ resource "aws_route" "private_nat_gateway" {
103103
# Route table associations for both Public & Private Subnets
104104
resource "aws_route_table_association" "public" {
105105
count = length(var.public_subnets_cidr)
106-
subnet_id = element(aws_subnet.public_subnet.*.id, count.index)
106+
subnet_id = element(aws_subnet.public_subnet[*].id, count.index)
107107
route_table_id = aws_route_table.public.id
108108
}
109109

110110
resource "aws_route_table_association" "private" {
111111
count = length(var.private_subnets_cidr)
112-
subnet_id = element(aws_subnet.private_subnet.*.id, count.index)
112+
subnet_id = element(aws_subnet.private_subnet[*].id, count.index)
113113
route_table_id = aws_route_table.private.id
114114
}
115115

Terraform/deploy-fsx-ontap-sqlserver/networking.tf

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ resource "aws_eip" "nat_eip" {
2828
# NAT
2929
resource "aws_nat_gateway" "nat" {
3030
allocation_id = aws_eip.nat_eip.id
31-
subnet_id = element(aws_subnet.public_subnet.*.id, 0)
31+
subnet_id = element(aws_subnet.public_subnet[*].id, 0)
3232

3333
tags = {
3434
Name = "nat"
35-
Environment = "${var.environment}"
35+
Environment = var.environment
3636
}
3737
}
3838

@@ -46,7 +46,7 @@ resource "aws_subnet" "public_subnet" {
4646

4747
tags = {
4848
Name = "${var.creator_tag}-${var.environment}-${element(var.availability_zones, count.index)}-public-subnet"
49-
Environment = "${var.environment}"
49+
Environment = var.environment
5050
}
5151
}
5252

@@ -61,7 +61,7 @@ resource "aws_subnet" "private_subnet" {
6161

6262
tags = {
6363
Name = "${var.creator_tag}-${var.environment}-${element(var.availability_zones, count.index)}-private-subnet"
64-
Environment = "${var.environment}"
64+
Environment = var.environment
6565
}
6666
}
6767

@@ -72,7 +72,7 @@ resource "aws_route_table" "private" {
7272

7373
tags = {
7474
Name = "${var.creator_tag}-${var.environment}-private-route-table"
75-
Environment = "${var.environment}"
75+
Environment = var.environment
7676
}
7777
}
7878

@@ -82,7 +82,7 @@ resource "aws_route_table" "public" {
8282

8383
tags = {
8484
Name = "${var.creator_tag}-${var.environment}-public-route-table"
85-
Environment = "${var.environment}"
85+
Environment = var.environment
8686
}
8787
}
8888

@@ -103,13 +103,13 @@ resource "aws_route" "private_nat_gateway" {
103103
# Route table associations for both Public & Private Subnets
104104
resource "aws_route_table_association" "public" {
105105
count = length(var.public_subnets_cidr)
106-
subnet_id = element(aws_subnet.public_subnet.*.id, count.index)
106+
subnet_id = element(aws_subnet.public_subnet[*].id, count.index)
107107
route_table_id = aws_route_table.public.id
108108
}
109109

110110
resource "aws_route_table_association" "private" {
111111
count = length(var.private_subnets_cidr)
112-
subnet_id = element(aws_subnet.private_subnet.*.id, count.index)
112+
subnet_id = element(aws_subnet.private_subnet[*].id, count.index)
113113
route_table_id = aws_route_table.private.id
114114
}
115115

@@ -137,7 +137,7 @@ resource "aws_security_group" "default" {
137137
}
138138

139139
tags = {
140-
Environment = "${var.environment}"
140+
Environment = var.environment
141141
}
142142
}
143143

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

Lines changed: 51 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,23 @@ Calling this terraform module will result the following:
2121
* Create a new AWS Security Group in your VPC with the following rules:
2222
- **Ingress** allow all ICMP traffic
2323
- **Ingress** allow nfs port 111 (both TCP and UDP)
24-
- **Ingress** allow cifc TCP port 139
24+
- **Ingress** allow cifs TCP port 139
2525
- **Ingress** allow snmp ports 161-162 (both TCP and UDP)
2626
- **Ingress** allow smb cifs TCP port 445
27-
- **Ingress** alloe bfs mount port 635 (both TCP and UDP)
27+
- **Ingress** allow nfs mount port 635 (both TCP and UDP)
28+
- **Ingress** allow kerberos TCP port 749
29+
- **Ingress** allow nfs port 2049 (both TCP and UDP)
30+
- **Ingress** allow nfs lock and monitoring 4045-4046 (both TCP and UDP)
31+
- **Ingress** allow nfs quota TCP 4049
32+
- **Ingress** allow Snapmirror Intercluster communication TCP port 11104
33+
- **Ingress** allow Snapmirror data transfer TCP port 11105
34+
- **Ingress** allow ssh port 22
35+
- **Ingress** allow https port 443
2836
- **Egress** allow all traffic
2937
* Create a new FSx for Netapp ONTAP file-system in your AWS account named "_terraform-fsxn_". The file-system will be created with the following configuration parameters:
3038
* 1024Gb of storage capacity
3139
* Multi AZ deployment type
32-
* 256Mbps of throughput capacity
40+
* 128Mbps of throughput capacity
3341

3442
* Create a Storage Virtual Maching (SVM) in this new file-system named "_first_svm_"
3543
* Create a new FlexVol volume in this SVM named "_vol1_" with the following configuration parameters:
@@ -49,8 +57,8 @@ Calling this terraform module will result the following:
4957

5058
| Name | Version |
5159
|------|---------|
52-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.6.6 |
53-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.25 |
60+
| terraform | >= 1.6.6 |
61+
| aws provider | >= 5.25 |
5462

5563
### AWS Account Setup
5664

@@ -68,24 +76,23 @@ Calling this terraform module will result the following:
6876
> [!NOTE]
6977
> In this sample, the AWS Credentials were configured through [AWS CLI](https://aws.amazon.com/cli/), which adds them to a shared configuration file (option 4 above). Therefore, this documentation only provides guidance on setting-up the AWS credentials with shared configuration file using AWS CLI.
7078
71-
#### Configure AWS Credentials using AWS CLI
79+
#### Configure AWS Credentials using AWS CLI
7280

73-
The AWS Provider can source credentials and other settings from the shared configuration and credentials files. By default, these files are located at `$HOME/.aws/config` and `$HOME/.aws/credentials` on Linux and macOS, and `"%USERPROFILE%\.aws\credentials"` on Windows.
81+
The AWS Provider can source credentials and other settings from the shared configuration and credentials files. By default, these files are located at `$HOME/.aws/config` and `$HOME/.aws/credentials` on Linux and macOS, and `"%USERPROFILE%\.aws\credentials"` on Windows.
7482

75-
There are several ways to set your credentials and configuration setting using AWS CLI. We will use [`aws configure`](https://docs.aws.amazon.com/cli/latest/reference/configure/index.html) command:
83+
There are several ways to set your credentials and configuration setting using AWS CLI. We will use [`aws configure`](https://docs.aws.amazon.com/cli/latest/reference/configure/index.html) command:
7684

77-
Run the following command to quickly set and view your credentails, region, and output format. The following example shows sample values:
85+
Run the following command to quickly set and view your credentails, region, and output format. The following example shows sample values:
7886

79-
```shell
80-
$ aws configure
81-
AWS Access Key ID [None]: < YOUR-ACCESS-KEY-ID >
82-
AWS Secret Access Key [None]: < YOUR-SECRET-ACCESS-KE >
83-
Default region name [None]: < YOUR-PREFERRED-REGION >
84-
Default output format [None]: json
85-
```
86-
87-
To list configuration data, use the [`aws configire list`](https://docs.aws.amazon.com/cli/latest/reference/configure/list.html) command. This command lists the profile, access key, secret key, and region configuration information used for the specified profile. For each configuration item, it shows the value, where the configuration value was retrieved, and the configuration variable name.
87+
```shell
88+
$ aws configure
89+
AWS Access Key ID [None]: < YOUR-ACCESS-KEY-ID >
90+
AWS Secret Access Key [None]: < YOUR-SECRET-ACCESS-KE >
91+
Default region name [None]: < YOUR-PREFERRED-REGION >
92+
Default output format [None]: json
93+
```
8894

95+
To list configuration data, use the [`aws configire list`](https://docs.aws.amazon.com/cli/latest/reference/configure/list.html) command. This command lists the profile, access key, secret key, and region configuration information used for the specified profile. For each configuration item, it shows the value, where the configuration value was retrieved, and the configuration variable name.
8996

9097
## Usage
9198

@@ -126,9 +133,9 @@ module "fsxontap" {
126133
primarysub = "<YOUR-PRIMARY-SUBNET>"
127134
secondarysub = "<YOUR-SECONDAY-SUBNET>"
128135
}
129-
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
130137
cidr_for_sg = "<YOUR-CIDR-BLOCK>"
131-
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.
132139
tags = {
133140
Terraform = "true"
134141
Environment = "dev"
@@ -140,7 +147,7 @@ module "fsxontap" {
140147
> 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.
141148
142149
> [!NOTE]
143-
> 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.
144151
145152
Please read the vriables descriptions in `variables.tf` file for more information regarding the variables passed to the module block.
146153

@@ -159,31 +166,29 @@ terraform {
159166
}
160167
161168
provider "aws" {
162-
shared_config_files = ["$HOME/.aws/conf"]
163-
shared_credentials_files = ["$HOME/.aws/credentials"]
164169
region = "us-west-2"
165170
}
166171
167172
168173
module "fsxontap" {
169174
source = "github.com/Netapp/FSx-ONTAP-samples-scripts/Terraform/deploy-fsx-ontap/module"
170175
176+
name = "fsxontap"
177+
171178
vpc_id = "vpc-111111111"
172179
fsx_subnets = {
173180
"primarysub" = "subnet-11111111"
174181
"secondarysub" = "subnet-2222222"
175182
}
176183
create_sg = true
177184
cidr_for_sg = "10.0.0.0/8"
178-
fsx_admin_password = "yourpassword"
185+
fsx_secret_name = "fsx_secret"
179186
route_table_ids = ["rtb-111111"]
180187
tags = {
181188
Terraform = "true"
182189
Environment = "dev"
183190
}
184191
}
185-
186-
187192
```
188193

189194
### Install the module
@@ -233,7 +238,7 @@ Ensure that the proposed changes match what you expected before you apply the ch
233238
234239
Once confirmed, run the `terraform apply` command followed by `yes` to execute the Terrafom code and apply the changes proposed in the `plan` step:
235240
```shell
236-
terraform apply -y
241+
terraform apply
237242
```
238243
239244
<!-- BEGIN_TF_DOCS -->
@@ -250,27 +255,27 @@ terraform apply -y
250255
251256
| Name | Description | Type | Default | Required |
252257
|------|-------------|------|---------|:--------:|
253-
| fsx_admin_password | The ONTAP administrative password for the fsxadmin user that you can use to administer your file system using the ONTAP CLI and REST API | `string` | n/a | yes |
254258
| 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 |
255-
| cidr_for_sg | cide block to be used for the ingress rules | `string` | `"0.0.0.0/0"` | no |
256-
| create_sg | Determines whether the SG should be deployed as part of this execution or not | `bool` | `false` | 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 |
261+
| create_sg | Determines whether the SG should be deployed as part of this deployment or not. | `bool` | `true` | no |
257262
| 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 |
258-
| disk_iops_configuration | The SSD IOPS configuration for the Amazon FSx for NetApp ONTAP file system | `map(any)` | `null` | no |
259-
| fsx_capacity_size_gb | The storage capacity (GiB) of the FSxN file system. Valid values between 1024 and 196608 | `number` | `1024` | no |
260-
| fsx_deploy_type | The filesystem deployment type. Supports MULTI_AZ_1 and SINGLE_AZ_1 | `string` | `"MULTI_AZ_1"` | no |
261-
| 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 |
262-
| fsx_name | The deployed filesystem name | `string` | `"terraform-fsxn"` | no |
263-
| fsx_subnets | A list of IDs for the subnets that the file system will be accessible from. Up to 2 subnets can be provided. | `map(any)` | <pre>{<br> "primarysub": "",<br> "secondarysub": ""<br>}</pre> | no |
264-
| fsx_tput_in_MBps | The throughput capacity (in MBps) for the file system. Valid values are 128, 256, 512, 1024, 2048, and 4096. | `number` | `256` | no |
263+
| deployment_type | The filesystem deployment type. Supports MULTI_AZ_1 and SINGLE_AZ_1 | `string` | `"MULTI_AZ_1"` | no |
264+
| 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 |
265265
| 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-
| root_vol_sec_style | Specifies the root volume security style, Valid values are UNIX, NTFS, and MIXED. All volumes created under this SVM will inherit the root security style unless the security style is specified on the volume. | `string` | `"UNIX"` | no |
267-
| 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. | `list(any)` | `null` | no |
268-
| storage_type | The filesystem storage type | `string` | `"SSD"` | no |
269-
| svm_name | The name of the Storage Virtual Machine | `string` | `"first_svm"` | no |
270-
| tags | Tags to be applied to the resources | `map(any)` | <pre>{<br> "Name": "terraform-fsxn"<br>}</pre> | no |
271-
| vol_info | Details for the volume creation | `map(any)` | <pre>{<br> "bypass_sl_retention": false,<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> "tier_policy_name": "AUTO",<br> "vol_name": "vol1",<br> "vol_type": "RW"<br>}</pre> | no |
272-
| vol_snapshot_policy | Specifies the snapshot policy for the volume | `map(any)` | `null` | no |
273-
| vpc_id | The ID of the VPC in which the FSxN fikesystem should be deployed | `string` | `"vpc-111111111"` | 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 |
268+
| 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 |
269+
| 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 |
271+
| security_group_id | If you are not creating the security group, provide the ID of the security group to be used. | `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 |
274+
| svm_name | The name of the Storage Virtual Machine, (a.k.a. vserver). | `string` | `"first_svm"` | no |
275+
| 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 |
277+
| 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+
| vpc_id | The ID of the VPC in where the security group will be created. | `string` | `""` | no |
274279
275280
### Outputs
276281
@@ -297,4 +302,4 @@ See the License for the specific language governing permissions and limitations
297302
298303
<!-- END_TF_DOCS -->
299304
300-
© 2024 NetApp, Inc. All Rights Reserved.
305+
© 2024 NetApp, Inc. All Rights Reserved.

0 commit comments

Comments
 (0)