Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding fabric_network_schema_resource #553

Merged
merged 48 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
2934d20
Add equinix_fabric_network provider
manu-equinix Oct 5, 2023
83bda54
add example for network
xbai-equinix Oct 17, 2023
8cdc231
Add func for network change schema
manu-equinix Oct 18, 2023
c042bc4
Update fabric-go sdk and add code required for Network creation
manu-equinix Dec 5, 2023
0c54a4e
Rebase on latest main branch and fix build
manu-equinix Dec 5, 2023
91632bc
Add acceptance test
manu-equinix Dec 5, 2023
7f08cef
fix func name
manu-equinix Dec 8, 2023
049bab4
fix: Updating fabric network schema resources & data sources
srushti-patl Jan 31, 2024
0d7476c
fix: Adding Docs for FCR Network data source and resources
srushti-patl Jan 31, 2024
e1b8534
fix: Adding Docs for FCR Network data source
srushti-patl Jan 31, 2024
ce26978
fix: Updating HasModelErrorcode method reference
srushti-patl Feb 1, 2024
797dc1d
Add equinix_fabric_network provider
manu-equinix Oct 5, 2023
6333d02
add example for network
xbai-equinix Oct 17, 2023
9754bcd
Add func for network change schema
manu-equinix Oct 18, 2023
f71e343
Update fabric-go sdk and add code required for Network creation
manu-equinix Dec 5, 2023
6a01a1f
Rebase on latest main branch and fix build
manu-equinix Dec 5, 2023
95f8ac1
Add acceptance test
manu-equinix Dec 5, 2023
b210c5b
fix func name
manu-equinix Dec 8, 2023
bb6b0f4
fix: Updating fabric network schema resources & data sources
srushti-patl Jan 31, 2024
46f6e17
fix: Adding Docs for FCR Network data source and resources
srushti-patl Jan 31, 2024
7ab6aac
fix: Adding Docs for FCR Network data source
srushti-patl Jan 31, 2024
1d20e9e
fix: Updating waitUntilNetworkDeprovisioned method name and removing …
srushti-patl Feb 1, 2024
118858d
Merge branch 'main' into CXF-83378-update
srushti-patl Feb 1, 2024
e825742
Merge branch 'main' into CXF-83378-update
srushti-patl Feb 2, 2024
12a2e93
fix: updating acc tests for Fabric Network
srushti-patl Feb 2, 2024
d292298
fix: fixing acc tests for Fabric Network
srushti-patl Feb 5, 2024
ac4cefa
Merge branch 'main' into CXF-83378-update
srushti-patl Feb 5, 2024
3ea8685
add example for network
xbai-equinix Oct 17, 2023
e1a8771
Merge branch 'main' into CXF-83378-update
srushti-patl Feb 5, 2024
8b27091
fix: Updating internal/fabric_schema references
srushti-patl Feb 5, 2024
494a8cc
fix: Updating fabric network resource
srushti-patl Feb 5, 2024
892b88e
fix: Updating provider for fabric network resource & data source
srushti-patl Feb 5, 2024
383c801
fix: Updating waiting time for network DEPROVISIONED
srushti-patl Feb 5, 2024
86e2cae
Merge branch 'main' into CXF-83378-update
srushti-patl Feb 5, 2024
01baf9c
fix: updating network docs
srushti-patl Feb 6, 2024
c696ae0
Merge branch 'main' into CXF-83378-update
srushti-patl Feb 6, 2024
e456d47
fix: Updating Network Schema description & methods names
srushti-patl Feb 6, 2024
facd999
Merge remote-tracking branch 'origin/CXF-83378-update' into CXF-83378…
srushti-patl Feb 6, 2024
60e67a1
fix: Updating error handling for fabric network resource
srushti-patl Feb 6, 2024
109095c
fix: Updating error handling in fabric network methods
srushti-patl Feb 7, 2024
230bbd2
Merge branch 'main' into CXF-83378-update
srushti-patl Feb 7, 2024
38a2c86
fix: Updating error handling methods in fabric network methods
srushti-patl Feb 7, 2024
92fb0b2
Merge remote-tracking branch 'origin/CXF-83378-update' into CXF-83378…
srushti-patl Feb 7, 2024
081b76d
fix: Updating error handling methods in fabric network methods
srushti-patl Feb 8, 2024
f5a3bdd
Merge branch 'main' into CXF-83378-update
srushti-patl Feb 9, 2024
6296251
Merge branch 'main' into CXF-83378-update
srushti-patl Feb 9, 2024
1db8887
Merge branch 'main' into CXF-83378-update
srushti-patl Feb 13, 2024
fcfa4e3
Merge branch 'main' into CXF-83378-update
srushti-patl Feb 13, 2024
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
100 changes: 100 additions & 0 deletions docs/data-sources/equinix_fabric_network.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "equinix_fabric_network Data Source - terraform-provider-equinix"
subcategory: "Fabric"
description: |-
Fabric V4 API compatible data resource that allow user to fetch Fabric Network for a given UUID
---

# equinix_fabric_network (Data Source)

Fabric V4 API compatible data resource that allow user to fetch Fabric Network for a given UUID

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

### Required

- `uuid` (String) Equinix-assigned network identifier

### Read-Only

- `change` (Set of Object) Information on asset change operation (see [below for nested schema](#nestedatt--change))
- `change_log` (Set of Object) A permanent record of asset creation, modification, or deletion (see [below for nested schema](#nestedatt--change_log))
- `connections_count` (Number) Number of connections associated with this network
- `href` (String) Fabric Network URI information
- `id` (String) The ID of this resource.
- `location` (Set of Object) Fabric Network location (see [below for nested schema](#nestedatt--location))
- `name` (String) Fabric Network name. An alpha-numeric 24 characters string which can include only hyphens and underscores
- `notifications` (List of Object) Preferences for notifications on Fabric Network configuration or status changes (see [below for nested schema](#nestedatt--notifications))
- `operation` (Set of Object) Network operation information that is associated with this Fabric Network (see [below for nested schema](#nestedatt--operation))
- `project` (Set of Object) Fabric Network project (see [below for nested schema](#nestedatt--project))
- `scope` (String) Fabric Network scope
- `state` (String) Fabric Network overall state
- `type` (String) Supported Network types - EVPLAN, EPLAN, IPWAN

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

Read-Only:

- `href` (String)
- `type` (String)
- `uuid` (String)


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

Read-Only:

- `created_by` (String)
- `created_by_email` (String)
- `created_by_full_name` (String)
- `created_date_time` (String)
- `deleted_by` (String)
- `deleted_by_email` (String)
- `deleted_by_full_name` (String)
- `deleted_date_time` (String)
- `updated_by` (String)
- `updated_by_email` (String)
- `updated_by_full_name` (String)
- `updated_date_time` (String)


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

Read-Only:

- `ibx` (String)
- `metro_code` (String)
- `metro_name` (String)
- `region` (String)


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

Read-Only:

- `emails` (List of String)
- `send_interval` (String)
- `type` (String)


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

Read-Only:

- `equinix_status` (String)


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

Read-Only:

- `project_id` (String)

117 changes: 117 additions & 0 deletions docs/resources/equinix_fabric_network.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "equinix_fabric_network Resource - terraform-provider-equinix"
subcategory: "Fabric"
description: |-
Fabric V4 API compatible resource allows creation and management of Equinix Fabric Network
---

# equinix_fabric_network (Resource)

Fabric V4 API compatible resource allows creation and management of Equinix Fabric Network

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

### Required

- `name` (String) Fabric Network name. An alpha-numeric 24 characters string which can include only hyphens and underscores
- `notifications` (Block List, Min: 1) Preferences for notifications on Fabric Network configuration or status changes (see [below for nested schema](#nestedblock--notifications))
- `project` (Block Set, Min: 1) Fabric Network project (see [below for nested schema](#nestedblock--project))
- `scope` (String) Fabric Network scope
- `type` (String) Supported Network types - EVPLAN, EPLAN, IPWAN

### Optional

- `location` (Block Set, Max: 1) Fabric Network location (see [below for nested schema](#nestedblock--location))
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-Only

- `change` (Set of Object) Information on asset change operation (see [below for nested schema](#nestedatt--change))
- `change_log` (Set of Object) A permanent record of asset creation, modification, or deletion (see [below for nested schema](#nestedatt--change_log))
- `connections_count` (Number) Number of connections associated with this network
- `href` (String) Fabric Network URI information
- `id` (String) The ID of this resource.
- `operation` (Set of Object) Network operation information that is associated with this Fabric Network (see [below for nested schema](#nestedatt--operation))
- `state` (String) Fabric Network overall state
- `uuid` (String) Equinix-assigned network identifier

<a id="nestedblock--notifications"></a>
### Nested Schema for `notifications`

Required:

- `emails` (List of String) Array of contact emails
- `type` (String) Notification Type - ALL,CONNECTION_APPROVAL,SALES_REP_NOTIFICATIONS, NOTIFICATIONS

Optional:

- `send_interval` (String) Send interval


<a id="nestedblock--project"></a>
### Nested Schema for `project`

Required:

- `project_id` (String) Customer project identifier


<a id="nestedblock--location"></a>
### Nested Schema for `location`

Optional:

- `ibx` (String) IBX Code
- `metro_code` (String) Access point metro code
- `metro_name` (String) Access point metro name
- `region` (String) Access point region


<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`

Optional:

- `create` (String)
- `delete` (String)
- `read` (String)
- `update` (String)


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

Read-Only:

- `href` (String)
- `type` (String)
- `uuid` (String)


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

Read-Only:

- `created_by` (String)
- `created_by_email` (String)
- `created_by_full_name` (String)
- `created_date_time` (String)
- `deleted_by` (String)
- `deleted_by_email` (String)
- `deleted_by_full_name` (String)
- `deleted_date_time` (String)
- `updated_by` (String)
- `updated_by_email` (String)
- `updated_by_full_name` (String)
- `updated_date_time` (String)


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

Read-Only:

- `equinix_status` (String)
39 changes: 39 additions & 0 deletions equinix/data_source_fabric_network.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package equinix

import (
"context"

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

func readFabricNetworkResourceSchema() map[string]*schema.Schema {
sch := fabricNetworkResourceSchema()
for key, _ := range sch {
if key == "uuid" {
sch[key].Required = true
sch[key].Optional = false
sch[key].Computed = false
} else {
sch[key].Required = false
sch[key].Optional = false
sch[key].Computed = true
sch[key].MaxItems = 0
sch[key].ValidateFunc = nil
}
}
return sch
}
func dataSourceFabricNetwork() *schema.Resource {
return &schema.Resource{
ReadContext: dataSourceFabricNetworkRead,
Schema: readFabricNetworkResourceSchema(),
Description: "Fabric V4 API compatible data resource that allow user to fetch Fabric Network for a given UUID",
}
}

func dataSourceFabricNetworkRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
uuid, _ := d.Get("uuid").(string)
d.SetId(uuid)
return resourceFabricNetworkRead(ctx, d, meta)
}
59 changes: 59 additions & 0 deletions equinix/data_source_fabric_network_acc_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package equinix_test

import (
"fmt"
"github.com/equinix/terraform-provider-equinix/internal/acceptance"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
_ "github.com/hashicorp/terraform-plugin-testing/terraform"
"testing"
)

func TestAccDataSourceFabricNetwork_PFCR(t *testing.T) {
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acceptance.TestAccPreCheck(t) },
ExternalProviders: acceptance.TestExternalProviders,
Providers: acceptance.TestAccProviders,
Steps: []resource.TestStep{
{
Config: configCreateNetworkResource_PFCR(),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet("data.equinix_fabric_network.example", "href"),
resource.TestCheckResourceAttrSet("data.equinix_fabric_network.example", "uuid"),
resource.TestCheckResourceAttr("data.equinix_fabric_network.example", "name", "Test_Network_PFCR"),
resource.TestCheckResourceAttrSet("data.equinix_fabric_network.example", "state"),
resource.TestCheckResourceAttr("data.equinix_fabric_network.example", "connections_count", "0"),
resource.TestCheckResourceAttr("data.equinix_fabric_network.example", "type", "EVPLAN"),
resource.TestCheckResourceAttr("data.equinix_fabric_network.example", "notifications.0.type", "ALL"),
resource.TestCheckResourceAttr("data.equinix_fabric_network.example", "notifications.0.emails.0", "test@equinix.com"),
resource.TestCheckResourceAttr("data.equinix_fabric_network.example", "scope", "GLOBAL"),
resource.TestCheckResourceAttrSet("data.equinix_fabric_network.example", "change_log.0.created_by"),
resource.TestCheckResourceAttrSet("data.equinix_fabric_network.example", "change_log.0.created_by_full_name"),
resource.TestCheckResourceAttrSet("data.equinix_fabric_network.example", "change_log.0.created_by_email"),
resource.TestCheckResourceAttrSet("data.equinix_fabric_network.example", "change_log.0.created_date_time"),
resource.TestCheckResourceAttrSet("data.equinix_fabric_network.example", "operation.0.equinix_status"),
),
ExpectNonEmptyPlan: false,
},
},
})
}

func configCreateNetworkResource_PFCR() string {
return fmt.Sprintf(`
resource "equinix_fabric_network" "example" {
type = "EVPLAN"
name = "Test_Network_PFCR"
scope = "GLOBAL"
notifications {
type = "ALL"
emails = ["test@equinix.com","test1@equinix.com"]
}
project{
project_id = "291639000636552"
}
}
data "equinix_fabric_network" "example"{
uuid = equinix_fabric_network.example.id
}
`)
}
2 changes: 2 additions & 0 deletions equinix/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ func Provider() *schema.Provider {
"equinix_fabric_routing_protocol": dataSourceRoutingProtocol(),
"equinix_fabric_connection": dataSourceFabricConnection(),
"equinix_fabric_cloud_router": dataSourceCloudRouter(),
"equinix_fabric_network": dataSourceFabricNetwork(),
"equinix_fabric_port": dataSourceFabricPort(),
"equinix_fabric_ports": dataSourceFabricGetPortsByName(),
"equinix_fabric_service_profile": dataSourceFabricServiceProfileReadByUuid(),
Expand Down Expand Up @@ -120,6 +121,7 @@ func Provider() *schema.Provider {
"equinix_ecx_l2_connection_accepter": resourceECXL2ConnectionAccepter(),
"equinix_ecx_l2_serviceprofile": resourceECXL2ServiceProfile(),
"equinix_fabric_cloud_router": resourceCloudRouter(),
"equinix_fabric_network": resourceFabricNetwork(),
"equinix_fabric_connection": resourceFabricConnection(),
"equinix_fabric_routing_protocol": resourceFabricRoutingProtocol(),
"equinix_fabric_service_profile": resourceFabricServiceProfile(),
Expand Down
Loading
Loading