Skip to content
Merged
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# 2.5.0 (2026-**-**)

FEATURES:

- **New Data Source:** `netapp-ontap_network_ip_service_policy` and `netapp-ontap_network_ip_service_policies`([#621](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/621))
- **New Resource:** `netapp-ontap_network_ip_service_policy` ([#621](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/621))

ENHANCEMENTS:

- Fixed import documentation on resources which are supporting import. ([#613](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/613))
- **netapp-ontap_security_certificate**: added extra parameter to import to support for avoiding duplicate cert names across svms ([#614](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/614))

BUG FIXES:
Expand Down
87 changes: 87 additions & 0 deletions docs/data-sources/network_ip_service_policies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netapp-ontap_network_ip_service_policies Data Source - terraform-provider-netapp-ontap"
subcategory: "Networking"
description: |-
Service Policies data source
---

# Data Source Service Policies

Retrieves details of multiple Service Policies

## Related ONTAP commands

```commandline
* network interface service-policy show
```

## Example Usage

```terraform
# retrieving cluster-scoped service policies
data "netapp-ontap_network_ip_service_policies" "example1" {
# required to know which system to interface with
cx_profile_name = "hw-cluster"
filter = {
scope = "cluster"
}
}
# retrieving svm-scoped service policies
data "netapp-ontap_network_ip_service_policies" "example2" {
# required to know which system to interface with
cx_profile_name = "hw-cluster"
filter = {
svm_name = "svm1"
}
}
# retrieving service policies with matching name pattern
data "netapp-ontap_network_ip_service_policies" "example3" {
# required to know which system to interface with
cx_profile_name = "hw-cluster"
filter = {
svm_name = "svm1"
name = "test_service_policy*"
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `cx_profile_name` (String) Connection profile name
- `filter` (Attributes) (see [below for nested schema](#nestedatt--filter))

### Read-Only

- `ip_service_policies` (Attributes List) (see [below for nested schema](#nestedatt--ip_service_policies))

<a id="nestedatt--filter"></a>
### Nested Schema for `filter`

Optional:

- `name` (String) The name of the service policy
- `scope` (String) The name of the SVM
- `svm_name` (String) The name of the SVM


<a id="nestedatt--ip_service_policies"></a>
### Nested Schema for `ip_service_policies`

Required:

- `cx_profile_name` (String) Connection profile name
- `name` (String) The name of the service policy

Read-Only:

- `id` (String) Service policy UUID
- `ipspace` (String) IP space name
- `scope` (String) Set to "svm" for service policies owned by an SVM. Otherwise, set to "cluster".
- `services` (Set of String) A list of services that should be included in this policy
- `svm_name` (String) The name of the SVM on which the service policy exists
60 changes: 60 additions & 0 deletions docs/data-sources/network_ip_service_policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netapp-ontap_network_ip_service_policy Data Source - terraform-provider-netapp-ontap"
subcategory: "Networking"
description: |-
Service Policy data source
---

# Data Source Service Policy

Retrieves the specified cluster-scoped or svm-scoped service policy

## Related ONTAP commands

```commandline
* network interface service-policy show
```

## Supported Platforms

* On-prem ONTAP system 9.8 or higher
* Amazon FSx for NetApp ONTAP

## Example Usage

```terraform
data "netapp-ontap_network_ip_service_policy" "svm_scoped" {
# required to know which system to interface with
cx_profile_name = "hw-cluster"
name = "test_service_policy"
svm_name = "svm1"
}

data "netapp-ontap_network_ip_service_policy" "cluster_scoped" {
# required to know which system to interface with
cx_profile_name = "hw-cluster"
name = "default-management"
scope = "cluster"
ipspace = "Default"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `cx_profile_name` (String) Connection profile name
- `name` (String) The name of the service policy

### Optional

- `ipspace` (String) IP space name
- `scope` (String) Set to "svm" for service policies owned by an SVM. Otherwise, set to "cluster".
- `svm_name` (String) The name of the SVM on which the service policy exists

### Read-Only

- `id` (String) Service policy UUID
- `services` (Set of String) A list of services that should be included in this policy
113 changes: 113 additions & 0 deletions docs/resources/network_ip_service_policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netapp-ontap_network_ip_service_policy Resource - terraform-provider-netapp-ontap"
subcategory: "Networking"
description: |-
Service Policy resource
---

# Resource Service Policy

Create, delete, or modify network interface service policy

## Related ONTAP commands

```commandline
* network interface service-policy create
* network interface service-policy rename
* network interface service-policy add-service
* network interface service-policy remove-service
* network interface service-policy delete
```

## Supported Platforms

* On-prem ONTAP system 9.8 or higher
* Amazon FSx for NetApp ONTAP

## Example Usage

```terraform
resource "netapp-ontap_network_ip_service_policy" "example" {
cx_profile_name = "hw-cluster"
name = "test_service_policy1"
svm_name = "svm1"
services = [
"data_nfs",
"data_cifs",
"management_ssh"
]
ipspace = "Default"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `cx_profile_name` (String) Connection profile name
- `name` (String) The name of the service policy

### Optional

- `ipspace` (String) The IPspace that owns the service policy.
Required for cluster-scoped service policies.
Optional for SVM-scoped service policies.
- `scope` (String) Set to "svm" for service policies owned by an SVM. Otherwise, set to "cluster".
- `services` (Set of String) A list of services that should be included in this policy
- `svm_name` (String) The name of the SVM

### Read-Only

- `id` (String) Service policy UUID

## Import

This resource supports import, which allows you to import existing service policy into the state of this resource.
Import requires a unique ID composed of the service policy name, scope, connection profile (for cluster-scoped policies), separated by a comma
or service policy name, SVM name, connection profile (for svm-scoped policies), separated by a comma.

id = `name`,`svm_name`,`cx_profile_name`

### Terraform Import

For example

```shell
terraform import netapp-ontap_network_ip_service_policy.example test_ip_service_policy,svm1,hw-cluster
```

!> The terraform import CLI command can only import resources into the state. Importing via the CLI does not generate configuration. If you want to generate the accompanying configuration for imported resources, use the import block instead.

### Terraform Import Block

This requires Terraform 1.5 or higher, and will auto create the configuration for you

First create the block

```terraform
import {
to = netapp-ontap_network_ip_service_policy.service_policy_import
id = "test_ip_service_policy,svm1,hw-cluster"
}
```

Next run, this will auto create the configuration for you

```shell
terraform plan -generate-config-out=generated.tf
```

This will generate a file called generated.tf, which will contain the configuration for the imported resource

```terraform
# __generated__ by Terraform
# Please review these resources and move them into your main configuration files.
# __generated__ by Terraform from "test_ip_service_policy,svm1,hw-cluster"
resource "netapp-ontap_network_ip_service_policy" "service_policy_import" {
cx_profile_name = "hw-cluster"
name = "test_ip_service_policy"
svm_name = "svm1"
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# retrieving cluster-scoped service policies
data "netapp-ontap_network_ip_service_policies" "example1" {
# required to know which system to interface with
cx_profile_name = "hw-cluster"
filter = {
scope = "cluster"
}
}

# retrieving svm-scoped service policies
data "netapp-ontap_network_ip_service_policies" "example2" {
# required to know which system to interface with
cx_profile_name = "hw-cluster"
filter = {
svm_name = "svm1"
}
}

# retrieving service policies with matching name pattern
data "netapp-ontap_network_ip_service_policies" "example3" {
# required to know which system to interface with
cx_profile_name = "hw-cluster"
filter = {
svm_name = "svm1"
name = "test_service_policy*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
data "netapp-ontap_network_ip_service_policy" "svm_scoped" {
# required to know which system to interface with
cx_profile_name = "hw-cluster"
name = "test_service_policy1"
svm_name = "svm1"
}

data "netapp-ontap_network_ip_service_policy" "cluster_scoped" {
# required to know which system to interface with
cx_profile_name = "hw-cluster"
name = "default-management"
scope = "cluster"
ipspace = "Default"
}
7 changes: 7 additions & 0 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ provider "netapp-ontap" {
username = var.username
password = var.password
validate_certs = var.validate_certs
},
{
name = "hw-cluster"
hostname = "********50"
username = var.username
password = var.password
validate_certs = var.validate_certs
}
]
}
4 changes: 2 additions & 2 deletions examples/provider/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
username = "admin"
password = "Netapp1!"
validate_certs = false
password = "xxxxxxxxx"
validate_certs = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource "netapp-ontap_network_ip_service_policy" "example" {
cx_profile_name = "hw-cluster"
name = "test_service_policy1"
svm_name = "svm1"
services = [
"data_nfs",
"data_cifs",
"management_ssh"
]
ipspace = "Default"
}
Loading
Loading