Skip to content

Commit

Permalink
Renamed networking to network.
Browse files Browse the repository at this point in the history
  • Loading branch information
wenjun666 committed Sep 20, 2024
1 parent e8bbee2 commit a249d5e
Show file tree
Hide file tree
Showing 38 changed files with 88 additions and 73 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ BREAKING CHANGES:
* **Rename Resource:** `netapp-ontap_security_accounts` is now renamed to `netapp-ontap_security_account`
* **Rename Resource:** `netapp-ontap_security_login_messages` is now renamed to `netapp-ontap_security_login_message`
* **Rename Resource:** `netapp-ontap_security_roles` is now renamed to `netapp-ontap_security_role`
* **Rename Resource:** `netapp-ontap_networking_ip_interface` is now renamed to `netapp-ontap_network_ip_interface`
* **Rename Resource:** `netapp-ontap_networking_ip_route` is now renamed to `netapp-ontap_network_ip_route`


* **Rename Data Source:** `netapp-ontap_networking_ip_interface` is now renamed to `netapp-ontap_network_ip_interface`
* **Rename Data Source:** `netapp-ontap_networking_ip_interfaces` is now renamed to `netapp-ontap_network_ip_interfaces`
* **Rename Data Source:** `netapp-ontap_networking_ip_route` is now renamed to `netapp-ontap_network_ip_route`
* **Rename Data Source:** `netapp-ontap_networking_ip_routes` is now renamed to `netapp-ontap_network_ip_routes`

FEATURES:
* **provider**: add `aws_lambda` option. ([#262](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/262))
* **New Data Source:** `netapp-ontap_volumes_files` ([#8](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/8))
Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/networking_ip_interface_data_source.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netapp-ontap_networking_ip_interface Data Source - terraform-provider-netapp-ontap"
page_title: "netapp-ontap_network_ip_interface Data Source - terraform-provider-netapp-ontap"
subcategory: "Networking"
description: |-
Retrieves the details of IP interface of SVMs.
Expand All @@ -12,7 +12,7 @@ Retrieves the details of IP interface of SVMs.

## Example Usage
```terraform
data "netapp-ontap_networking_ip_interface" "ip_interface" {
data "netapp-ontap_network_ip_interface" "ip_interface" {
# required to know which system to interface with
cx_profile_name = "cluster4"
name = "cluster_mgmt"
Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/networking_ip_interfaces_data_source.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netapp-ontap_netapp-ontap_networking_ip_interfaces Data Source - terraform-provider-netapp-ontap"
page_title: "netapp-ontap_netapp-ontap_network_ip_interfaces Data Source - terraform-provider-netapp-ontap"
subcategory: "Networking"
description: |-
Retrieves the details of IP interfaces of SVMs.
Expand All @@ -12,7 +12,7 @@ Retrieves the details of IP interfaces of SVMs.

## Example Usage
```terraform
data "netapp-ontap_networking_ip_interfaces" "ip_interfaces" {
data "netapp-ontap_network_ip_interfaces" "ip_interfaces" {
# required to know which system to interface with
cx_profile_name = "cluster4"
filter = {
Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/networking_ip_route_data_source.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netapp-ontap_networking_ip_route Data Source - terraform-provider-netapp-ontap"
page_title: "netapp-ontap_network_ip_route Data Source - terraform-provider-netapp-ontap"
subcategory: "Networking"
description: |-
Retrieves the IP route of SVMs.
Expand All @@ -12,7 +12,7 @@ Retrieves the IP route of SVMs.

## Example Usage
```terraform
data "netapp-ontap_networking_ip_route" "networking_ip_route" {
data "netapp-ontap_network_ip_route" "network_ip_route" {
# required to know which system to interface with
cx_profile_name = "cluster4"
destination = {
Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/networking_ip_routes_data_source.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "netapp-ontap_networking_ip_routes Data Source - terraform-provider-netapp-ontap"
page_title: "netapp-ontap_network_ip_routes Data Source - terraform-provider-netapp-ontap"
subcategory: "Networking"
description: |-
Retrieves the IP routes of SVMs.
Expand All @@ -12,7 +12,7 @@ Retrieves the IP routes of SVMs.

## Example Usage
```terraform
data "netapp-ontap_networking_ip_routes" "networking_ip_routes" {
data "netapp-ontap_network_ip_routes" "network_ip_routes" {
# required to know which system to interface with
cx_profile_name = "cluster4"
gateway = "10.10.10.254"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Create/Update/Delete an IPInterface resource
## Example Usage

```terraform
resource "netapp-ontap_networking_ip_interface" "example" {
resource "netapp-ontap_network_ip_interface" "example" {
cx_profile_name = "cluster4"
name = "test-interface"
svm_name = "carchi-test"
Expand Down Expand Up @@ -80,7 +80,7 @@ Import require a unique ID composed of the interface name, svm_name and cx_profi
### Terraform Import
For example
```shell
terraform import netapp-ontap_networking_ip_interface.example if1,svm1,cluster4
terraform import netapp-ontap_network_ip_interface.example if1,svm1,cluster4
```

!> 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.
Expand All @@ -91,7 +91,7 @@ This requires Terraform 1.5 or higher, and will auto create the configuration fo
First create the block
```terraform
import {
to = netapp-ontap_networking_ip_interface.if_import
to = netapp-ontap_network_ip_interface.if_import
id = "if1,svm1,cluster4"
}
```
Expand All @@ -104,7 +104,7 @@ This will generate a file called generated.tf, which will contain the configurat
# __generated__ by Terraform
# Please review these resources and move them into your main configuration files.
# __generated__ by Terraform from "if1,svm1,cluster4"
resource "netapp-ontap_networking_ip_interface" "if1_import" {
resource "netapp-ontap_network_ip_interface" "if1_import" {
cx_profile_name = "cluster4"
name = "if1"
svm_name = "svm1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Create/Delete an IP Route resource
## Example Usage

```terraform
resource "netapp-ontap_networking_ip_route" "networking_ip_route" {
resource "netapp-ontap_network_ip_route" "network_ip_route" {
# required to know which system to interface with
cx_profile_name = "cluster4"
svm_name = "ansibleSVM"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
data "netapp-ontap_networking_ip_interface" "ip_interface" {
data "netapp-ontap_network_ip_interface" "ip_interface" {
# required to know which system to interface with
cx_profile_name = "cluster4"
name = "cluster_mgmt"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
data "netapp-ontap_networking_ip_interfaces" "ip_interfaces" {
data "netapp-ontap_network_ip_interfaces" "ip_interfaces" {
# required to know which system to interface with
cx_profile_name = "cluster4"
filter = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
data "netapp-ontap_networking_ip_route" "networking_ip_route" {
data "netapp-ontap_network_ip_route" "network_ip_route" {
# required to know which system to interface with
cx_profile_name = "cluster4"
destination = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
data "netapp-ontap_networking_ip_routes" "networking_ip_routes" {
data "netapp-ontap_network_ip_routes" "network_ip_routes" {
# required to know which system to interface with
cx_profile_name = "cluster4"
gateway = "10.10.10.254"
Expand Down
2 changes: 1 addition & 1 deletion examples/resources/netapp-ontap_cluster_peer/resource.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "netapp-ontap_cluster_peer" "cluster_peers" {
resource "netapp-ontap_cluster_peer" "cluster_peer" {
# required to know which system to interface with
cx_profile_name = "cluster3"
# name = "testme"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "netapp-ontap_networking_ip_interface" "ip_interface" {
resource "netapp-ontap_network_ip_interface" "ip_interface" {
# required to know which system to interface with
cx_profile_name = "cluster4"
name = "testme"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "netapp-ontap_networking_ip_route" "networking_ip_route" {
resource "netapp-ontap_network_ip_route" "network_ip_route" {
# required to know which system to interface with
cx_profile_name = "cluster4"
svm_name = "ansibleSVM"
Expand Down
2 changes: 1 addition & 1 deletion internal/interfaces/cluster_peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ func CreateClusterPeers(errorHandler *utils.ErrorHandler, r restclient.RestClien

var dataONTAP ClusterPeersGetDataModelONTAP
if err := mapstructure.Decode(response.Records[0], &dataONTAP); err != nil {
return nil, errorHandler.MakeAndReportError("error decoding cluster_peers info", fmt.Sprintf("error on decode storage/cluster_peerss info: %s, statusCode %d, response %#v", err, statusCode, response))
return nil, errorHandler.MakeAndReportError("error decoding cluster_peers info", fmt.Sprintf("error on decode cluster/cluster_peers info: %s, statusCode %d, response %#v", err, statusCode, response))
}
tflog.Debug(errorHandler.Ctx, fmt.Sprintf("Create cluster_peers source - udata: %#v", dataONTAP))
return &dataONTAP, nil
Expand Down
2 changes: 1 addition & 1 deletion internal/interfaces/name_services_ldap.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func CreateNameServicesLDAP(errorHandler *utils.ErrorHandler, r restclient.RestC

var dataONTAP NameServicesLDAPGetDataModelONTAP
if err := mapstructure.Decode(response.Records[0], &dataONTAP); err != nil {
return nil, errorHandler.MakeAndReportError("error decoding name_services_ldap info", fmt.Sprintf("error on decode storage/name_services_ldaps info: %s, statusCode %d, response %#v", err, statusCode, response))
return nil, errorHandler.MakeAndReportError("error decoding name_services_ldap info", fmt.Sprintf("error on decode name_services_ldaps info: %s, statusCode %d, response %#v", err, statusCode, response))
}
tflog.Debug(errorHandler.Ctx, fmt.Sprintf("Create name_services_ldap source - udata: %#v", dataONTAP))
return &dataONTAP, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package networking
import (
"context"
"fmt"
"github.com/netapp/terraform-provider-netapp-ontap/internal/provider/connection"
"strconv"

"github.com/netapp/terraform-provider-netapp-ontap/internal/provider/connection"

"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
Expand All @@ -21,7 +22,7 @@ var _ datasource.DataSource = &IPInterfaceDataSource{}
func NewIPInterfaceDataSource() datasource.DataSource {
return &IPInterfaceDataSource{
config: connection.ResourceOrDataSourceConfig{
Name: "networking_ip_interface",
Name: "network_ip_interface",
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package networking
import (
"context"
"fmt"
"github.com/netapp/terraform-provider-netapp-ontap/internal/provider/connection"
"strconv"
"strings"

"github.com/netapp/terraform-provider-netapp-ontap/internal/provider/connection"

"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
Expand All @@ -26,7 +27,7 @@ var _ resource.ResourceWithImportState = &IPInterfaceResource{}
func NewIPInterfaceResource() resource.Resource {
return &IPInterfaceResource{
config: connection.ResourceOrDataSourceConfig{
Name: "networking_ip_interface",
Name: "network_ip_interface",
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,61 @@ package networking_test

import (
"fmt"
ntest "github.com/netapp/terraform-provider-netapp-ontap/internal/provider"
"os"
"regexp"
"testing"

ntest "github.com/netapp/terraform-provider-netapp-ontap/internal/provider"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccNetworkingIpInterfaceResource(t *testing.T) {
func TestAccNetworkIpInterfaceResource(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { ntest.TestAccPreCheck(t) },
ProtoV6ProviderFactories: ntest.TestAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
// non-existant SVM return code 2621462. Must happen before create/read
{
Config: testAccNetworkingIPInterfaceResourceConfig("non-existant", "10.10.10.10", "ontap_cluster_1-01"),
Config: testAccNetworkIPInterfaceResourceConfig("non-existant", "10.10.10.10", "ontap_cluster_1-01"),
ExpectError: regexp.MustCompile("2621462"),
},
// non-existant home node
{
Config: testAccNetworkingIPInterfaceResourceConfig("svm0", "10.10.10.10", "non-existant_home_node"),
Config: testAccNetworkIPInterfaceResourceConfig("svm0", "10.10.10.10", "non-existant_home_node"),
ExpectError: regexp.MustCompile("393271"),
},
// Create and Read
{
Config: testAccNetworkingIPInterfaceResourceConfig("svm0", "10.10.10.10", "ontap_cluster_1-01"),
Config: testAccNetworkIPInterfaceResourceConfig("svm0", "10.10.10.10", "ontap_cluster_1-01"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("netapp-ontap_networking_ip_interface.example", "name", "test-interface"),
resource.TestCheckResourceAttr("netapp-ontap_networking_ip_interface.example", "svm_name", "svm0"),
resource.TestCheckResourceAttr("netapp-ontap_network_ip_interface.example", "name", "test-interface"),
resource.TestCheckResourceAttr("netapp-ontap_network_ip_interface.example", "svm_name", "svm0"),
),
},
// Update and Read
{
Config: testAccNetworkingIPInterfaceResourceConfig("svm0", "10.10.10.20", "ontap_cluster_1-01"),
Config: testAccNetworkIPInterfaceResourceConfig("svm0", "10.10.10.20", "ontap_cluster_1-01"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("netapp-ontap_networking_ip_interface.example", "name", "test-interface"),
resource.TestCheckResourceAttr("netapp-ontap_networking_ip_interface.example", "ip.address", "10.10.10.20"),
resource.TestCheckResourceAttr("netapp-ontap_network_ip_interface.example", "name", "test-interface"),
resource.TestCheckResourceAttr("netapp-ontap_network_ip_interface.example", "ip.address", "10.10.10.20"),
),
},
// Test importing a resource
{
ResourceName: "netapp-ontap_networking_ip_interface.example",
ResourceName: "netapp-ontap_network_ip_interface.example",
ImportState: true,
ImportStateId: fmt.Sprintf("%s,%s,%s", "test-interface", "svm0", "cluster4"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("netapp-ontap_networking_ip_interface.example", "name", "test-interface"),
resource.TestCheckResourceAttr("netapp-ontap_networking_ip_interface.example", "ip.address", "10.10.10.20"),
resource.TestCheckResourceAttr("netapp-ontap_network_ip_interface.example", "name", "test-interface"),
resource.TestCheckResourceAttr("netapp-ontap_network_ip_interface.example", "ip.address", "10.10.10.20"),
),
},
},
})
}

func testAccNetworkingIPInterfaceResourceConfig(svmName, address, homeNode string) string {
func testAccNetworkIPInterfaceResourceConfig(svmName, address, homeNode string) string {
host := os.Getenv("TF_ACC_NETAPP_HOST")
admin := os.Getenv("TF_ACC_NETAPP_USER")
password := os.Getenv("TF_ACC_NETAPP_PASS")
Expand All @@ -76,7 +77,7 @@ provider "netapp-ontap" {
]
}
resource "netapp-ontap_networking_ip_interface" "example" {
resource "netapp-ontap_network_ip_interface" "example" {
cx_profile_name = "cluster4"
name = "test-interface"
svm_name = "%s"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package networking
import (
"context"
"fmt"
"github.com/netapp/terraform-provider-netapp-ontap/internal/provider/connection"
"strconv"

"github.com/netapp/terraform-provider-netapp-ontap/internal/provider/connection"

"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
Expand All @@ -21,7 +22,7 @@ var _ datasource.DataSource = &IPInterfacesDataSource{}
func NewIPInterfacesDataSource() datasource.DataSource {
return &IPInterfacesDataSource{
config: connection.ResourceOrDataSourceConfig{
Name: "networking_ip_interfaces",
Name: "network_ip_interfaces",
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package networking
import (
"context"
"fmt"

"github.com/netapp/terraform-provider-netapp-ontap/internal/provider/connection"

"github.com/hashicorp/terraform-plugin-framework/datasource"
Expand All @@ -20,7 +21,7 @@ var _ datasource.DataSource = &IPRouteDataSource{}
func NewIPRouteDataSource() datasource.DataSource {
return &IPRouteDataSource{
config: connection.ResourceOrDataSourceConfig{
Name: "networking_ip_route",
Name: "network_ip_route",
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package networking
import (
"context"
"fmt"
"github.com/netapp/terraform-provider-netapp-ontap/internal/provider/connection"
"strings"

"github.com/netapp/terraform-provider-netapp-ontap/internal/provider/connection"

"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier"
Expand All @@ -32,7 +33,7 @@ var _ resource.ResourceWithImportState = &IPRouteResource{}
func NewIPRouteResource() resource.Resource {
return &IPRouteResource{
config: connection.ResourceOrDataSourceConfig{
Name: "networking_ip_route",
Name: "network_ip_route",
},
}
}
Expand Down
Loading

0 comments on commit a249d5e

Please sign in to comment.