Skip to content

Commit 02f7ebd

Browse files
author
nichollri
committed
added sample.tfvars file and updated readme
1 parent 9564d98 commit 02f7ebd

File tree

2 files changed

+131
-1
lines changed

2 files changed

+131
-1
lines changed

Terraform/fsxn-replicate/README.md

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ SnapMirror replication requires **ICMP** and ports **11104** and **11105**.
2020
| --------------------- | ------------------------------------------------------------------------------------------------------------- | -------------- | ------------------------------------ | :------: |
2121
| prime_hostname | Hostname or IP address of primary cluster. | `string` | | Yes |
2222
| prime_fsxid | FSx ID of the primary cluster. | `string` | | Yes |
23-
| prime_clus_name | This is the name of the cluster given for ONTAP TF connection profile. This is a user created value, that can be any string. It is referenced in many ONTAP TF resources | `string` | primary_clus | Yes |
23+
| prime_clus_name | This is the name of the cluster given for ONTAP TF connection profile. This is a user created value, that can be any string. It is referenced in many ONTAP TF resources | `string` | primary_clus | Yes |
2424
| prime_svm | Name of the primary SVM for the volumes that will be replicated. | `string` | | Yes |
2525
| prime_cluster_vserver | Name of the ONTAP cluster vserver for intercluster LIFs in the primary cluster. Can be found by running `network interface show` on the primary cluster. It will have the format FsxId################# | `string` | Yes |
2626
| prime_aws_region | AWS region of the primary FSx ONTAP system | `string` | | Yes |
@@ -60,6 +60,113 @@ SnapMirror replication requires **ICMP** and ports **11104** and **11105**.
6060
| dr_cidr_for_sg | The VPC ID where the DR FSxN and security group will be created. | `string` | 10.0.0.0/8 | No |
6161
| dr_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 |
6262

63+
## Usage
64+
65+
#### 1. Clone the repository
66+
67+
In your server's terminal, navigate to the location where you wish to store this Terraform repository, and clone the repository using your preferred authentication type. In this example we are using HTTPS clone:
68+
69+
```shell
70+
git clone https://github.com/NetApp/FSx-ONTAP-samples-scripts
71+
```
72+
73+
#### 2. Navigate to the directory
74+
75+
```shell
76+
cd Terraform/fsxn-replicate
77+
```
78+
79+
#### 3. Initialize Terraform
80+
81+
This directory represents a standalone Terraform module. Run the following command to initialize the module and install all dependencies:
82+
83+
```shell
84+
terraform init
85+
```
86+
87+
A succesfull initialization should display the following output:
88+
89+
```shell
90+
91+
Initializing the backend...
92+
Initializing modules...
93+
94+
Initializing provider plugins...
95+
- Reusing previous version of netapp/netapp-ontap from the dependency lock file
96+
- Reusing previous version of hashicorp/aws from the dependency lock file
97+
- Using previously-installed netapp/netapp-ontap v1.1.4
98+
- Using previously-installed hashicorp/aws v5.69.0
99+
100+
Terraform has been successfully initialized!
101+
102+
You may now begin working with Terraform. Try running "terraform plan" to see
103+
any changes that are required for your infrastructure. All Terraform commands
104+
should now work.
105+
106+
If you ever set or change modules or backend configuration for Terraform,
107+
rerun this command to reinitialize your working directory. If you forget, other
108+
commands will detect it and remind you to do so if necessary.
109+
110+
```
111+
112+
You can see that Terraform recognizes the modules required by our configuration: `hashicorp/aws` and `hashicorpt/netapp-ontap`.
113+
114+
#### 4. Create Variables Values
115+
116+
- Copy or Rename the file **`terraform.sample.tfvars`** to **`terraform.tfvars`**
117+
118+
- Open the **`terraform.tfvars`** file in your preferred text editor. Update the values of the variables to match your preferences and save the file. This will ensure that the Terraform code deploys resources according to your specifications.
119+
120+
- Set the parameters in terraform.tfvars
121+
122+
##### Sample file
123+
124+
***
125+
126+
```ini
127+
# Primary FSxN variables
128+
prime_hostname = "<admin ip address>"
129+
prime_fsxid = "fs-xxxxxxxxxxxxxxxxx"
130+
prime_svm = "fsx"
131+
prime_cluster_vserver = "FsxIdxxxxxxxxxxxxxxxx"
132+
prime_aws_region = "us-west-2"
133+
username_pass_secrets_id = "<Name of AWS secret>"
134+
list_of_volumes_to_replicate = ["vol1", "vol2", "vol3"]
135+
136+
# DR FSxN variables
137+
dr_aws_region = "us-west-2"
138+
dr_fsx_name = "terraform-dr-fsxn"
139+
dr_fsx_subnets = {
140+
"primarysub" = "subnet-11111111"
141+
"secondarysub" = "subnet-33333333"
142+
}
143+
dr_svm_name = "fsx-dr"
144+
dr_security_group_name_prefix = "fsxn-sg"
145+
dr_vpc_id = "vpc-xxxxxxxx"
146+
dr_username_pass_secrets_id = "<Name of AWS secret>"
147+
dr_snapmirror_policy_name = "<Name of Policy to create>"
148+
```
149+
150+
> [!IMPORTANT]
151+
> **Make sure to replace the values with ones that match your AWS environment and needs.**
152+
153+
#### 5. Create a Terraform plan
154+
155+
Run the following command to create an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure:
156+
157+
```shell
158+
terraform plan
159+
```
160+
161+
Ensure that the proposed changes match what you expected before you apply the changes!
162+
163+
#### 6. Apply the Terraform plan
164+
165+
Run the following command to execute the Terrafom code and apply the changes proposed in the `plan` step:
166+
167+
```shell
168+
terraform apply
169+
```
63170
64171
## Author Information
65172
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Variables for my environment. Source is Development FSxN system.
2+
3+
# Primary FSxN variables
4+
prime_hostname = "<admin ip address>"
5+
prime_fsxid = "fs-xxxxxxxxxxxxxxxxx"
6+
prime_svm = "fsx"
7+
prime_cluster_vserver = "FsxIdxxxxxxxxxxxxxxxx"
8+
prime_aws_region = "us-west-2"
9+
username_pass_secrets_id = "<Name of AWS secret>"
10+
list_of_volumes_to_replicate = ["vol1", "vol2", "vol3"]
11+
12+
# DR FSxN variables
13+
dr_aws_region = "us-west-2"
14+
dr_fsx_name = "terraform-dr-fsxn"
15+
dr_fsx_subnets = {
16+
"primarysub" = "subnet-11111111"
17+
"secondarysub" = "subnet-33333333"
18+
}
19+
dr_svm_name = "fsx-dr"
20+
dr_security_group_name_prefix = "fsxn-sg"
21+
dr_vpc_id = "vpc-xxxxxxxx"
22+
dr_username_pass_secrets_id = "<Name of AWS secret>"
23+
dr_snapmirror_policy_name = "<Name of Policy to create>"

0 commit comments

Comments
 (0)