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 11, 2024
1 parent 94f6e35 commit 3917b01
Show file tree
Hide file tree
Showing 33 changed files with 72 additions and 532 deletions.
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
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
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
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 @@ -8,7 +8,7 @@ description: |-

# Resource IP Interfaces

Create/Update/Delete networking IP Interfaces resource
Create/Update/Delete network IP Interfaces resource

### Related ONTAP commands
```commandline
Expand All @@ -24,7 +24,7 @@ Create/Update/Delete networking IP Interfaces resource
## Example Usage

```terraform
resource "netapp-ontap_networking_ip_interfaces" "example" {
resource "netapp-ontap_network_ip_interfaces" "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_interfaces.example if1,svm1,cluster4
terraform import netapp-ontap_network_ip_interfaces.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_interfaces.if_import
to = netapp-ontap_network_ip_interfaces.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_interfaces" "if1_import" {
resource "netapp-ontap_network_ip_interfaces" "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 @@ -8,7 +8,7 @@ description: |-

# Resource IP Routes

Create/Delete networking IP Routes resource
Create/Delete network IP Routes resource

### Related ONTAP commands
```commandline
Expand All @@ -23,7 +23,7 @@ Create/Delete networking IP Routes resource
## Example Usage

```terraform
resource "netapp-ontap_networking_ip_routes" "networking_ip_route" {
resource "netapp-ontap_network_ip_routes" "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" "networking_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_ip_interface/resource.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "netapp-ontap_networking_ip_interfaces" "ip_interface" {
resource "netapp-ontap_network_ip_interfaces" "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_routes" "networking_ip_route" {
resource "netapp-ontap_network_ip_routes" "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
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,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 @@ -11,35 +11,35 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccNetworkingIpInterfacesResource(t *testing.T) {
func TestAccNetworkIpInterfacesResource(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_interfaces.example", "name", "test-interface"),
resource.TestCheckResourceAttr("netapp-ontap_networking_ip_interfaces.example", "svm_name", "svm0"),
resource.TestCheckResourceAttr("netapp-ontap_network_ip_interfaces.example", "name", "test-interface"),
resource.TestCheckResourceAttr("netapp-ontap_network_ip_interfaces.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_interfaces.example", "name", "test-interface"),
resource.TestCheckResourceAttr("netapp-ontap_networking_ip_interfaces.example", "ip.address", "10.10.10.20"),
resource.TestCheckResourceAttr("netapp-ontap_network_ip_interfaces.example", "name", "test-interface"),
resource.TestCheckResourceAttr("netapp-ontap_network_ip_interfaces.example", "ip.address", "10.10.10.20"),
),
},
// Test importing a resource
Expand All @@ -48,15 +48,15 @@ func TestAccNetworkingIpInterfacesResource(t *testing.T) {
ImportState: true,
ImportStateId: fmt.Sprintf("%s,%s,%s", "test-interface", "svm0", "cluster4"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("netapp-ontap_networking_ip_interfaces.example", "name", "test-interface"),
resource.TestCheckResourceAttr("netapp-ontap_networking_ip_interfaces.example", "ip.address", "10.10.10.20"),
resource.TestCheckResourceAttr("netapp-ontap_network_ip_interfaces.example", "name", "test-interface"),
resource.TestCheckResourceAttr("netapp-ontap_network_ip_interfaces.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 @@ -77,7 +77,7 @@ provider "netapp-ontap" {
]
}
resource "netapp-ontap_networking_ip_interfaces" "example" {
resource "netapp-ontap_network_ip_interfaces" "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,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,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 = &IPRoutesDataSource{}
func NewIPRoutesDataSource() datasource.DataSource {
return &IPRoutesDataSource{
config: connection.ResourceOrDataSourceConfig{
Name: "networking_ip_routes",
Name: "network_ip_routes",
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var _ resource.ResourceWithImportState = &IPRouteResource{}
func NewIPRoutesResource() resource.Resource {
return &IPRouteResource{
config: connection.ResourceOrDataSourceConfig{
Name: "networking_ip_routes",
Name: "network_ip_routes",
},
}
}
Expand Down
Loading

0 comments on commit 3917b01

Please sign in to comment.