Skip to content

Commit

Permalink
demonstrate conversion to generated schema attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreatma committed Jun 27, 2024
1 parent 23d56bc commit 37c4d06
Show file tree
Hide file tree
Showing 13 changed files with 220 additions and 423 deletions.
117 changes: 56 additions & 61 deletions docs/data-sources/metal_device.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,64 +36,59 @@ output "ipv4" {
}
```

## Argument Reference

The following arguments are supported:

* `hostname` - (Optional) The device name.
* `project_id` - (Optional) The id of the project in which the devices exists.
* `device_id` - (Optional) Device ID.

-> **NOTE:** You should pass either `device_id`, or both `project_id` and `hostname`.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `access_private_ipv4` - The ipv4 private IP assigned to the device.
* `access_public_ipv4` - The ipv4 management IP assigned to the device.
* `access_public_ipv6` - The ipv6 management IP assigned to the device.
* `billing_cycle` - The billing cycle of the device (monthly or hourly).
* `facility` - (**Deprecated**) The facility where the device is deployed. Use metro instead; read the [facility to metro migration guide](https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/migration_guide_facilities_to_metros_devices)
* `description` - Description string for the device.
* `hardware_reservation_id` - The id of hardware reservation which this device occupies.
* `id` - The ID of the device.
* `metro` - The metro where the device is deployed
* `network` - The device's private and public IP (v4 and v6) network details. See [Network Attribute](#network-attribute) below for more details.
* `network_type` - L2 network type of the device, one of `layer3`, `layer2-bonded`, `layer2-individual`, `hybrid`.
* `operating_system` - The operating system running on the device.
* `plan` - The hardware config of the device.
* `ports` - List of ports assigned to the device. See [Ports Attribute](#ports-attribute) below for more details.
* `root_password` - Root password to the server (if still available).
* `sos_hostname` - The hostname to use for [Serial over SSH](https://deploy.equinix.com/developers/docs/metal/resilience-recovery/serial-over-ssh/) access to the device
* `ssh_key_ids` - List of IDs of SSH keys deployed in the device, can be both user or project SSH keys.
* `state` - The state of the device.
* `tags` - Tags attached to the device.

### Network Attribute

When a device is run without any special network, it will have 3 networks:

* Public IPv4 at `equinix_metal_device.name.network.0`.
* IPv6 at `equinix_metal_device.name.network.1`.
* Private IPv4 at `equinix_metal_device.name.network.2`.

-> **NOTE:** Elastic addresses stack by type. An assigned public IPv4 will go after the management public IPv4 (to index 1), and will then shift the indices of the IPv6 and private IPv4. Assigned private IPv4 will go after the management private IPv4 (to the end of the network list).

Each element in the `network` list exports:

* `address` - IPv4 or IPv6 address string.
* `cidr` - Bit length of the network mask of the address.
* `gateway` - Address of router.
* `public` - Whether the address is routable from the Internet.
* `family` - IP version. One of `4`, `6`.

### Ports Attribute

Each element in the `ports` list exports:

* `name` - Name of the port (e.g. `eth0`, or `bond0`).
* `id` - ID of the port.
* `type` - Type of the port (e.g. `NetworkPort` or `NetworkBondPort`).
* `mac` - MAC address assigned to the port.
* `bonded` - Whether this port is part of a bond in bonded network setup.
<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `device_id` (String) Device ID
- `hostname` (String) The device name
- `project_id` (String) The id of the project in which the devices exists

### Read-Only

- `access_private_ipv4` (String) The ipv4 private IP assigned to the device
- `access_public_ipv4` (String) The ipv4 management IP assigned to the device
- `access_public_ipv6` (String) The ipv6 management IP assigned to the device
- `always_pxe` (Boolean)
- `billing_cycle` (String) The billing cycle of the device (monthly or hourly)
- `description` (String) Description string for the device
- `facility` (String, Deprecated) The facility where the device is deployed
- `hardware_reservation_id` (String) The id of hardware reservation which this device occupies
- `id` (String) The ID of this resource.
- `ipxe_script_url` (String)
- `metro` (String) The metro where the device is deployed
- `network` (List of Object) The device's private and public IP (v4 and v6) network details. When a device is run without any special network configuration, it will have 3 networks: ublic IPv4 at equinix_metal_device.name.network.0, IPv6 at equinix_metal_device.name.network.1 and private IPv4 at equinix_metal_device.name.network.2. Elastic addresses then stack by type - an assigned public IPv4 will go after the management public IPv4 (to index 1), and will then shift the indices of the IPv6 and private IPv4. Assigned private IPv4 will go after the management private IPv4 (to the end of the network list). (see [below for nested schema](#nestedatt--network))
- `network_type` (String) L2 network type of the device, one oflayer3, hybrid, layer2-individual, layer2-bonded
- `operating_system` (String) The operating system running on the device
- `plan` (String) The hardware config of the device
- `ports` (List of Object) Ports assigned to the device (see [below for nested schema](#nestedatt--ports))
- `root_password` (String, Sensitive) Root password to the server (if still available)
- `sos_hostname` (String) The hostname to use for [Serial over SSH](https://deploy.equinix.com/developers/docs/metal/resilience-recovery/serial-over-ssh/) access to the device
- `ssh_key_ids` (List of String) List of IDs of SSH keys deployed in the device, can be both user or project SSH keys
- `state` (String) The state of the device
- `storage` (String)
- `tags` (List of String) Tags attached to the device

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

Read-Only:

- `address` (String)
- `cidr` (Number)
- `family` (Number)
- `gateway` (String)
- `public` (Boolean)


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

Read-Only:

- `bonded` (Boolean)
- `id` (String)
- `mac` (String)
- `name` (String)
- `type` (String)
31 changes: 14 additions & 17 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
page_title: "Provider: Equinix"
page_title: "Equinix Provider"
---

# Equinix Provider
Expand Down Expand Up @@ -70,22 +70,19 @@ provider "equinix" {

The Equinix provider requires a few basic parameters. While the authentication arguments are individually optionally, either `token` or `client_id` and `client_secret` must be defined through arguments or environment settings to interact with Equinix Fabric and Network Edge services, and `auth_token` to interact with Equinix Metal.

* `client_id` - (Optional) API Consumer Key available under "My Apps" in developer portal. This argument can also be specified with the `EQUINIX_API_CLIENTID` shell environment variable.

* `client_secret` (Optional) API Consumer secret available under "My Apps" in developer portal. This argument can also be specified with the `EQUINIX_API_CLIENTSECRET` shell environment variable.

* `token` (Optional) API tokens are generated from API Consumer clients using the [OAuth2 API](https://developer.equinix.com/dev-docs/fabric/getting-started/getting-access-token#request-access-and-refresh-tokens). This argument can also be specified with the `EQUINIX_API_TOKEN` shell environment variable.

* `auth_token` - (Optional) This is your Equinix Metal API Auth token. This can also be specified with the `METAL_AUTH_TOKEN` environment variable.

* `endpoint` (Optional) The Equinix API base URL to point out desired environment. This argument can also be specified with the `EQUINIX_API_ENDPOINT` shell environment variable. (Defaults to `https://api.equinix.com`)

* `request_timeout` (Optional) The duration of time, in seconds, that the Equinix Platform API Client should wait before canceling an API request. Canceled requests may still result in provisioned resources. (Defaults to `30`)

* `response_max_page_size` (Optional) The maximum number of records in a single response for REST queries that produce paginated responses. (Default is client specific)
These parameters can be provided in [Terraform variable files](https://www.terraform.io/docs/configuration/variables.html#variable-definitions-tfvars-files) or as environment variables. Nevertheless, please note that it is [not recommended to keep sensitive data in plain text files](https://www.terraform.io/docs/state/sensitive-data.html).

* `max_retries` (Optional) Maximum number of retries in case of network failure.
<!-- schema generated by tfplugindocs -->
## Schema

* `max_retry_wait_seconds` (Optional) Maximum time to wait in case of network failure.
### Optional

These parameters can be provided in [Terraform variable files](https://www.terraform.io/docs/configuration/variables.html#variable-definitions-tfvars-files) or as environment variables. Nevertheless, please note that it is [not recommended to keep sensitive data in plain text files](https://www.terraform.io/docs/state/sensitive-data.html).
- `auth_token` (String) The Equinix Metal API auth key for API operations
- `client_id` (String) API Consumer Key available under "My Apps" in developer portal. This argument can also be specified with the `EQUINIX_API_CLIENTID` shell environment variable.
- `client_secret` (String) API Consumer secret available under "My Apps" in developer portal. This argument can also be specified with the `EQUINIX_API_CLIENTSECRET` shell environment variable.
- `endpoint` (String) The Equinix API base URL to point out desired environment. This argument can also be specified with the `EQUINIX_API_ENDPOINT` shell environment variable. (Defaults to `https://api.equinix.com`)
- `max_retries` (Number) Maximum number of retries in case of network failure.
- `max_retry_wait_seconds` (Number) Maximum number of seconds to wait before retrying a request.
- `request_timeout` (Number) The duration of time, in seconds, that the Equinix Platform API Client should wait before canceling an API request. Canceled requests may still result in provisioned resources. (Defaults to `30`)
- `response_max_page_size` (Number) The maximum number of records in a single response for REST queries that produce paginated responses. (Default is client specific)
- `token` (String) API tokens are generated from API Consumer clients using the [OAuth2 API](https://developer.equinix.com/dev-docs/fabric/getting-started/getting-access-token#request-access-and-refresh-tokens). This argument can also be specified with the `EQUINIX_API_TOKEN` shell environment variable.
Loading

0 comments on commit 37c4d06

Please sign in to comment.