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

refactor: updating data sources and resources for fabric cloud router #531

Merged
merged 15 commits into from
Feb 13, 2024
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
21 changes: 9 additions & 12 deletions docs/data-sources/equinix_fabric_cloud_router.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,31 @@ data "equinix_fabric_cloud_router" "cloud_router_data_name" {
### Read-Only

- `account` (Set of Object) Customer account information that is associated with this Fabric Cloud Router (see [below for nested schema](#nestedatt--account))
- `bgp_ipv4_routes_count` (Number) Access point used and maximum number of IPv4 BGP routes
- `bgp_ipv6_routes_count` (Number) Access point used and maximum number of IPv6 BGP routes
- `bgp_ipv4_routes_count` (Number) Number of IPv4 BGP routes in use (including non-distinct prefixes)
- `bgp_ipv6_routes_count` (Number) Number of IPv6 BGP routes in use (including non-distinct prefixes)
- `change_log` (Set of Object) Captures Fabric Cloud Router lifecycle change information (see [below for nested schema](#nestedatt--change_log))
- `connections_count` (Number) Number of connections associated with this Access point
- `connections_count` (Number) Number of connections associated with this Fabric Cloud Router instance
- `description` (String) Customer-provided Fabric Cloud Router description
- `distinct_ipv4_prefixes_count` (Number) Number of distinct IPv4 routes
- `distinct_ipv6_prefixes_count` (Number) Number of distinct IPv6 routes
- `equinix_asn` (Number) Equinix ASN
- `href` (String) Fabric Cloud Router URI information
- `id` (String) The ID of this resource.
- `location` (Set of Object) Fabric Cloud Router location (see [below for nested schema](#nestedatt--location))
- `name` (String) Fabric Cloud Router name. An alpha-numeric 24 characters string which can include only hyphens and underscores
- `notifications` (List of Object) Preferences for notifications on Fabric Cloud Router configuration or status changes (see [below for nested schema](#nestedatt--notifications))
- `order` (Set of Object) Order information related to this Fabric Cloud Router (see [below for nested schema](#nestedatt--order))
- `package` (Set of Object) Fabric Cloud Router package information (see [below for nested schema](#nestedatt--package))
- `project` (Set of Object) Project information (see [below for nested schema](#nestedatt--project))
- `package` (Set of Object) Fabric Cloud Router Package Type (see [below for nested schema](#nestedatt--package))
- `project` (Set of Object) Customer resource hierarchy project information.Applicable to customers onboarded to Equinix Identity and Access Management. For more information see Identity and Access Management: Projects (see [below for nested schema](#nestedatt--project))
- `state` (String) Fabric Cloud Router overall state
- `type` (String) Defines the Fabric Cloud Router type like XF_GATEWAY
- `type` (String) Defines the FCR type like; XF_ROUTER

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

Read-Only:

- `account_name` (String)
- `account_number` (Number)
- `global_cust_id` (String)
- `global_org_id` (String)
- `global_organization_name` (String)
- `org_id` (Number)
- `organization_name` (String)


<a id="nestedatt--change_log"></a>
Expand Down Expand Up @@ -127,3 +123,4 @@ Read-Only:

- `href` (String)
- `project_id` (String)

53 changes: 28 additions & 25 deletions docs/resources/equinix_fabric_cloud_router.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,42 @@ resource "equinix_fabric_cloud_router" "new_cloud_router"{

### Required

- `account` (Block Set, Min: 1, Max: 1) Customer account information that is associated with this Fabric Cloud Router (see [below for nested schema](#nestedblock--account))
- `location` (Block Set, Min: 1, Max: 1) Fabric Cloud Router location (see [below for nested schema](#nestedblock--location))
- `name` (String) Fabric Cloud Router name. An alpha-numeric 24 characters string which can include only hyphens and underscores
- `notifications` (Block List, Min: 1) Preferences for notifications on Fabric Cloud Router configuration or status changes (see [below for nested schema](#nestedblock--notifications))
- `package` (Block Set, Min: 1, Max: 1) Fabric Cloud Router location (see [below for nested schema](#nestedblock--package))
- `type` (String) Defines the FCR type like XF_ROUTER
- `order` (Block Set, Min: 1, Max: 1) Order information related to this Fabric Cloud Router (see [below for nested schema](#nestedblock--order))
- `package` (Block Set, Min: 1, Max: 1) Fabric Cloud Router Package Type (see [below for nested schema](#nestedblock--package))
- `project` (Block Set, Min: 1, Max: 1) Customer resource hierarchy project information.Applicable to customers onboarded to Equinix Identity and Access Management. For more information see Identity and Access Management: Projects (see [below for nested schema](#nestedblock--project))
- `type` (String) Defines the FCR type like; XF_ROUTER

### Optional

- `account` (Block Set, Max: 1) Customer account information that is associated with this Fabric Cloud Router (see [below for nested schema](#nestedblock--account))
- `description` (String) Customer-provided Fabric Cloud Router description
- `order` (Block Set, Max: 1) Order information related to this Fabric Cloud Router (see [below for nested schema](#nestedblock--order))
- `project` (Block Set, Max: 1) Fabric Cloud Router project (see [below for nested schema](#nestedblock--project))
- `href` (String) Fabric Cloud Router URI information
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
- `uuid` (String) Equinix-assigned Fabric Cloud Router identifier

### Read-Only

- `bgp_ipv4_routes_count` (Number) Access point used and maximum number of IPv4 BGP routes
- `bgp_ipv6_routes_count` (Number) Access point used and maximum number of IPv6 BGP routes
- `bgp_ipv4_routes_count` (Number) Number of IPv4 BGP routes in use (including non-distinct prefixes)
- `bgp_ipv6_routes_count` (Number) Number of IPv6 BGP routes in use (including non-distinct prefixes)
- `change_log` (Set of Object) Captures Fabric Cloud Router lifecycle change information (see [below for nested schema](#nestedatt--change_log))
- `connections_count` (Number) Number of connections associated with this Access point
- `connections_count` (Number) Number of connections associated with this Fabric Cloud Router instance
- `distinct_ipv4_prefixes_count` (Number) Number of distinct IPv4 routes
- `distinct_ipv6_prefixes_count` (Number) Number of distinct IPv6 routes
- `equinix_asn` (Number) Equinix ASN
- `href` (String) Fabric Cloud Router URI information
- `id` (String) The ID of this resource.
- `state` (String) Fabric Cloud Router overall state

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

Optional:

- `account_number` (Number) Account Number


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

Expand All @@ -96,22 +107,6 @@ Optional:
- `send_interval` (String) Send interval


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

Required:

- `code` (String) Fabric Cloud Router package code


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

Optional:

- `account_number` (Number) Account Number


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

Expand All @@ -123,6 +118,14 @@ Optional:
- `purchase_order_number` (String) Purchase order number


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

Required:

- `code` (String) Fabric Cloud Router package code


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

Expand Down
28 changes: 23 additions & 5 deletions equinix/data_source_fabric_cloud_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,34 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceCloudRouter() *schema.Resource {
func readFabricCloudRouterResourceSchema() map[string]*schema.Schema {
sch := fabricCloudRouterResourceSchema()
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 dataSourceFabricCloudRouter() *schema.Resource {
return &schema.Resource{
ReadContext: dataSourceCloudRouterRead,
Schema: readCloudRouterResourceSchema(),
ReadContext: dataSourceFabricCloudRouterRead,
Schema: readFabricCloudRouterResourceSchema(),
Description: "Fabric V4 API compatible data resource that allow user to fetch Fabric Cloud Router for a given UUID",
}
}

func dataSourceCloudRouterRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
func dataSourceFabricCloudRouterRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
uuid, _ := d.Get("uuid").(string)
d.SetId(uuid)
return resourceCloudRouterRead(ctx, d, meta)
return resourceFabricCloudRouterRead(ctx, d, meta)
}
127 changes: 0 additions & 127 deletions equinix/fabric_cloud_router_read_schema.go

This file was deleted.

Loading
Loading