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: add equinix_fabric_precision_time resource and data source #745

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
133 changes: 133 additions & 0 deletions docs/data-sources/fabric_precision_time.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "equinix_fabric_precision_time Data Source - terraform-provider-equinix"
subcategory: "Fabric"
description: |-
Fabric V4 API compatible data resource that allow user to fetch Equinix Fabric Precision Time Service by Uuid
---

# equinix_fabric_precision_time (Data Source)

Fabric V4 API compatible data resource that allow user to fetch Equinix Fabric Precision Time Service by Uuid

Additional documentation:
* Getting Started: https://docs.equinix.com/en-us/Content/Edge-Services/EPT/EPT.htm
* API: https://developer.equinix.com/dev-docs/fabric/api-reference/fabric-v4-apis#precision-time

## Example Usage

```terraform
data "equinix_fabric_precision_time" "time_service" {
uuid = "f9361b9a-a0b3-4fa3-bf36-be265dc7617f"
}
```


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

### Required

- `uuid` (String) Uuid of Precision Time Service resource; used for lookup

### Read-Only

- `account` (List of Object) Equinix User Account associated with Precision Time Service (see [below for nested schema](#nestedatt--account))
- `advance_configuration` (List of Object) An object that has advanced configuration options. (see [below for nested schema](#nestedatt--advance_configuration))
- `connections` (Block List) An array of objects with unique identifiers of connections. (see [below for nested schema](#nestedblock--connections))
- `description` (String) Optional description of time service
- `href` (String) Equinix generated Portal link for the created Precision Time Service
- `id` (String) The unique identifier of the resource
- `ipv4` (Block, Read-only) An object that has Network IP Configurations for Timing Master Servers. (see [below for nested schema](#nestedblock--ipv4))
- `name` (String) Name of Precision Time Service. Applicable values: Maximum: 24 characters; Allowed characters: alpha-numeric, hyphens ('-') and underscores ('_')
- `package` (Block, Read-only) Precision Time Service Package Details (see [below for nested schema](#nestedblock--package))
- `project_id` (String) Equinix Fabric Project ID
- `state` (String) Indicator of the state of this Precision Time Service. One of: [[PROVISIONED PROVISIONING PROVISIONING_FAILED CONFIGURING CANCELLED DEPROVISIONING_FAILED PENDING_CONFIGURATION DEPROVISIONED CONFIGURING_FAILED DEPROVISIONING]]
- `type` (String) Choose type of Precision Time Service

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

Read-Only:

- `account_number` (Number)
- `global_org_id` (String)
- `is_reseller_account` (Boolean)
- `org_id` (String)


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

Read-Only:

- `ntp` (List of Object) (see [below for nested schema](#nestedobjatt--advance_configuration--ntp))
- `ptp` (List of Object) (see [below for nested schema](#nestedobjatt--advance_configuration--ptp))

<a id="nestedobjatt--advance_configuration--ntp"></a>
### Nested Schema for `advance_configuration.ntp`

Read-Only:

- `id` (String)
- `password` (String)
- `type` (String)


<a id="nestedobjatt--advance_configuration--ptp"></a>
### Nested Schema for `advance_configuration.ptp`

Read-Only:

- `domain` (Number)
- `grant_time` (Number)
- `log_announce_interval` (Number)
- `log_delay_req_interval` (Number)
- `log_sync_interval` (Number)
- `priority_1` (Number)
- `priority_2` (Number)
- `time_scale` (String)
- `transport_mode` (String)



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

Read-Only:

- `href` (String) Link to the Equinix Fabric Connection associated with the Precision Time Service
- `type` (String) Type of the Equinix Fabric Connection associated with the Precision Time Service
- `uuid` (String) Equinix Fabric Connection UUID; Precision Time Service will be connected with it


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

Read-Only:

- `default_gateway` (String) IPv4 address that establishes the Routing Interface where traffic is directed. It serves as the next hop in the Network.
- `network_mask` (String) IPv4 address that defines the range of consecutive subnets in the network.
- `primary` (String) IPv4 address for the Primary Timing Master Server.
- `secondary` (String) IPv4 address for the Secondary Timing Master Server.


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

Read-Only:

- `accuracy_avg_max` (Number) Average maximum accuracy provided by the Precision Time Service
- `accuracy_avg_min` (Number) Average minimum accuracy provided by the Precision Time Service
- `accuracy_sla` (Number) SLA for the accuracy provided by the Precision Time Service
- `accuracy_unit` (String) Time unit of accuracy for the Precision Time Service; e.g. microseconds
- `bandwidth` (Number) Bandwidth of the Precision Time Service
- `clients_per_second_max` (Number) Maximum clients available per second for the Precision Time Service
- `code` (String) Time Precision Package Code for the desired billing package
- `href` (String) Time Precision Package HREF link to corresponding resource in Equinix Portal
- `multi_subnet_supported` (Boolean) Boolean flag indicating if this Precision Time Service supports multi subnetting
- `redundancy_supported` (Boolean) Boolean flag indicating if this Precision Time Service supports redundancy
- `type` (String) Type of the Precision Time Service Package



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

# equinix_fabric_precision_time (Resource)

Fabric V4 API compatible resource allows creation and management of Equinix Fabric Precision Time Services

Additional documentation:
* Getting Started: https://docs.equinix.com/en-us/Content/Edge-Services/EPT/EPT.htm
* API: https://developer.equinix.com/dev-docs/fabric/api-reference/fabric-v4-apis#precision-time

## Example Usage

PTP Configuration:
```terraform
resource "equinix_fabric_precision_time" "ptp" {
type = "PTP"
name = "tf_ept_PFCR"
description = "Equinix Precision Time with PTP Configuration"
package {
code = "PTP_STANDARD"
}
connections {
uuid = "30b82c65-ffb4-47d3-ab2b-3cacf46d5b8b"
}
ipv4 {
primary = "192.168.0.2"
secondary = "192.168.0.3"
network_mask = "255.255.255.224"
default_gateway = "192.168.0.1"
}
}
```

NTP Configuration:
```terraform
resource "equinix_fabric_precision_time" "ntp" {
type = "NTP"
name = "tf_ntp_PFCR"
description = "Equinix Precision Time with NTP Configuration"
package {
code = "NTP_STANDARD"
}
connections {
uuid = "30b82c65-ffb4-47d3-ab2b-3cacf46d5b8b"
}
ipv4 {
primary = "192.168.0.2"
secondary = "192.168.0.3"
network_mask = "255.255.255.224"
default_gateway = "192.168.0.1"
}
}
```

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

### Required

- `name` (String) Name of Precision Time Service. Applicable values: Maximum: 24 characters; Allowed characters: alpha-numeric, hyphens ('-') and underscores ('_')
- `type` (String) Choose type of Precision Time Service

### Optional

- `advance_configuration` (List of Object) An object that has advanced configuration options. (see [below for nested schema](#nestedatt--advance_configuration))
- `connections` (Block List) An array of objects with unique identifiers of connections. (see [below for nested schema](#nestedblock--connections))
- `description` (String) Optional description of time service
- `ipv4` (Block, Optional) An object that has Network IP Configurations for Timing Master Servers. (see [below for nested schema](#nestedblock--ipv4))
- `package` (Block, Optional) Precision Time Service Package Details (see [below for nested schema](#nestedblock--package))
- `project_id` (String) Equinix Fabric Project ID
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-Only

- `account` (List of Object) Equinix User Account associated with Precision Time Service (see [below for nested schema](#nestedatt--account))
- `href` (String) Equinix generated Portal link for the created Precision Time Service
- `id` (String) The unique identifier of the resource
- `state` (String) Indicator of the state of this Precision Time Service. One of: [[PROVISIONED PROVISIONING PROVISIONING_FAILED CONFIGURING CANCELLED DEPROVISIONING_FAILED PENDING_CONFIGURATION DEPROVISIONED CONFIGURING_FAILED DEPROVISIONING]]
- `uuid` (String) Equinix generated id for the Precision Time Service

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

Optional:

- `ntp` (List of Object) (see [below for nested schema](#nestedobjatt--advance_configuration--ntp))
- `ptp` (List of Object) (see [below for nested schema](#nestedobjatt--advance_configuration--ptp))

<a id="nestedobjatt--advance_configuration--ntp"></a>
### Nested Schema for `advance_configuration.ntp`

Optional:

- `id` (String)
- `password` (String)
- `type` (String)


<a id="nestedobjatt--advance_configuration--ptp"></a>
### Nested Schema for `advance_configuration.ptp`

Optional:

- `domain` (Number)
- `grant_time` (Number)
- `log_announce_interval` (Number)
- `log_delay_req_interval` (Number)
- `log_sync_interval` (Number)
- `priority_1` (Number)
- `priority_2` (Number)
- `time_scale` (String)
- `transport_mode` (String)



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

Required:

- `uuid` (String) Equinix Fabric Connection UUID; Precision Time Service will be connected with it

Read-Only:

- `href` (String) Link to the Equinix Fabric Connection associated with the Precision Time Service
- `type` (String) Type of the Equinix Fabric Connection associated with the Precision Time Service


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

Required:

- `default_gateway` (String) IPv4 address that establishes the Routing Interface where traffic is directed. It serves as the next hop in the Network.
- `network_mask` (String) IPv4 address that defines the range of consecutive subnets in the network.
- `primary` (String) IPv4 address for the Primary Timing Master Server.
- `secondary` (String) IPv4 address for the Secondary Timing Master Server.


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

Required:

- `code` (String) Time Precision Package Code for the desired billing package

Optional:

- `href` (String) Time Precision Package HREF link to corresponding resource in Equinix Portal

Read-Only:

- `accuracy_avg_max` (Number) Average maximum accuracy provided by the Precision Time Service
- `accuracy_avg_min` (Number) Average minimum accuracy provided by the Precision Time Service
- `accuracy_sla` (Number) SLA for the accuracy provided by the Precision Time Service
- `accuracy_unit` (String) Time unit of accuracy for the Precision Time Service; e.g. microseconds
- `bandwidth` (Number) Bandwidth of the Precision Time Service
- `clients_per_second_max` (Number) Maximum clients available per second for the Precision Time Service
- `multi_subnet_supported` (Boolean) Boolean flag indicating if this Precision Time Service supports multi subnetting
- `redundancy_supported` (Boolean) Boolean flag indicating if this Precision Time Service supports redundancy
- `type` (String) Type of the Precision Time Service Package


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

Optional:

- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
- `delete` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
- `read` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
- `update` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).


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

Read-Only:

- `account_number` (Number)
- `global_org_id` (String)
- `is_reseller_account` (Boolean)
- `org_id` (String)



3 changes: 3 additions & 0 deletions examples/data-sources/fabric_precision_time/get_by_uuid.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "equinix_fabric_precision_time" "time_service" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that you can avoid adding a custom doc template for this datasource by moving this file to examples/data-sources/equinix_fabric_precision_time/data-source.tf

uuid = "f9361b9a-a0b3-4fa3-bf36-be265dc7617f"
}
17 changes: 17 additions & 0 deletions examples/resources/fabric_precision_time/ntp_time_service.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
resource "equinix_fabric_precision_time" "ntp" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's more of a tradeoff for these examples than the data source example, but you could merge these resource examples into a single file, with # comments describing each block if necessary, put the merged file at examples/resources/equinix_fabric_precision_time/resource.tf and remove the custom doc template for the resource as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried out this documentation adjustment you suggested for Data Source and Resource and didn't get the results that were expected. I still feel the templates are necessary based on what Fabric team expects before the schema information, and the examples weren't included following that pattern.

type = "NTP"
name = "tf_ntp_PFCR"
description = "Equinix Precision Time with NTP Configuration"
package {
code = "NTP_STANDARD"
}
connections {
uuid = "30b82c65-ffb4-47d3-ab2b-3cacf46d5b8b"
}
ipv4 {
primary = "192.168.0.2"
secondary = "192.168.0.3"
network_mask = "255.255.255.224"
default_gateway = "192.168.0.1"
}
}
17 changes: 17 additions & 0 deletions examples/resources/fabric_precision_time/ptp_time_service.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
resource "equinix_fabric_precision_time" "ptp" {
type = "PTP"
name = "tf_ept_PFCR"
description = "Equinix Precision Time with PTP Configuration"
package {
code = "PTP_STANDARD"
}
connections {
uuid = "30b82c65-ffb4-47d3-ab2b-3cacf46d5b8b"
}
ipv4 {
primary = "192.168.0.2"
secondary = "192.168.0.3"
network_mask = "255.255.255.224"
default_gateway = "192.168.0.1"
}
}
Loading
Loading