Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/example-template/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
netapp-ontap = {
source = "NetApp/netapp-ontap"
version = "~> 1.0"
version = "~> 2.5"
}
}
}
Expand Down
17 changes: 13 additions & 4 deletions terraform/nfs-provision/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,31 @@ resource "netapp-ontap_volume" "nfs_vol" {
size_unit = var.volume_size_unit
}
nas = {
junction_path = "/${var.volume_name}"
junction_path = "/${var.volume_name}"
export_policy_name = netapp-ontap_nfs_export_policy.vol_policy.name
}

}

# Step 2 — Create a dedicated NFS export policy
resource "netapp-ontap_nfs_export_policy" "vol_policy" {
cx_profile_name = "cluster1"
name = "${var.volume_name}_export_policy"
svm_name = var.svm_name
}

# Step 2 — Add a client-match rule to the default export policy
# Step 3 — Add a client-match rule to the dedicated policy
resource "netapp-ontap_nfs_export_policy_rule" "client_rule" {
cx_profile_name = "cluster1"
svm_name = var.svm_name
export_policy_name = "default"
export_policy_name = netapp-ontap_nfs_export_policy.vol_policy.name
clients_match = [var.client_match]
ro_rule = ["any"]
rw_rule = ["any"]
superuser = ["any"]
protocols = ["nfs"]

depends_on = [
netapp-ontap_volume.nfs_vol,
netapp-ontap_nfs_export_policy.vol_policy,
]
}
5 changes: 5 additions & 0 deletions terraform/nfs-provision/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ output "mount_path" {
value = netapp-ontap_volume.nfs_vol.nas.junction_path
}

output "export_policy" {
description = "Name of the dedicated NFS export policy"
value = netapp-ontap_nfs_export_policy.vol_policy.name
}

output "client_match" {
description = "Client match rule on the export policy"
value = var.client_match
Expand Down
Loading