Skip to content

Commit

Permalink
Add networking-related docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarber-akamai committed Jan 17, 2025
1 parent 865c1e7 commit 98b6393
Show file tree
Hide file tree
Showing 5 changed files with 209 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/data-sources/networking_ip.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,5 @@ The Linode Network IP Address resource exports the following attributes:
* `linode_id` - The ID of the Linode this address currently belongs to.

* `region` - The Region this IP address resides in. See all regions [here](https://api.linode.com/v4/regions).

* `reserved` - Whether this IP address is a reserved IP.
94 changes: 94 additions & 0 deletions docs/data-sources/networking_ips.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
page_title: "Linode: linode_networking_ips"
description: |-
Retrieves a list of IP addresses on your account, including unassigned reserved IP addresses.
---

# linode\_networking\_ips

Provides information about all IP addresses associated with the current Linode account, including both assigned and unassigned reserved IP addresses.

## Example Usage

Retrieve all IPs under the current account:

```hcl
data "linode_networking_ips" "all" {}
```

Retrieve all IPs under the current account in a specific region:

```hcl
data "linode_networking_ips" "filtered" {
filter {
name = "region"
values = ["us-mia"]
}
}
```

## Argument Reference

The following arguments are supported:

* `latest` - (Optional) If true, only the latest image will be returned. Images without a valid `created` field are not included in the result.

* [`filter`](#filter) - (Optional) A set of filters used to select Linode images that meet certain requirements.

* `order_by` - (Optional) The attribute to order the results by. See the [Filterable Fields section](#filterable-fields) for a list of valid fields.

* `order` - (Optional) The order in which results should be returned. (`asc`, `desc`; default `asc`)

### Filter

* `name` - (Required) The name of the field to filter by. See the [Filterable Fields section](#filterable-fields) for a complete list of filterable fields.

* `values` - (Required) A list of values for the filter to allow. These values should all be in string form.

* `match_by` - (Optional) The method to match the field by. (`exact`, `regex`, `substring`; default `exact`)

## Attributes Reference

Each Linode image will be stored in the `ip_addresses` attribute and will export the following attributes:

* `address` - The IP address.

* `gateway` - The default gateway for this address.

* `subnet_mask` - The mask that separates host bits from network bits for this address.

* `prefix` - The number of bits set in the subnet mask.

* `type` - The type of address this is (ipv4, ipv6, ipv6/pool, ipv6/range).

* `public` - Whether this is a public or private IP address.

* `rdns` - The reverse DNS assigned to this address. For public IPv4 addresses, this will be set to a default value provided by Linode if not explicitly set.

* `linode_id` - The ID of the Linode this address currently belongs to.

* `region` - The Region this IP address resides in. See all regions [here](https://api.linode.com/v4/regions).

* `reserved` - Whether this IP address is a reserved IP.

## Filterable Fields

* `address`

* `gateway`

* `subnet_mask`

* `prefix`

* `type`

* `public`

* `rdns`

* `linode_id`

* `region`

* `reserved`
4 changes: 4 additions & 0 deletions docs/resources/instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ The following arguments are supported:

* **NOTE: Disk encryption may not currently be available to all users.**

* `ipv4` - (Optional) A set of reserved IPv4 addresses to assign to this Linode on creation.

* **NOTE: IP reservation is not currently available to all users.**

* `group` - (Optional, Deprecated) A deprecated property denoting a group label for this Linode. We recommend using the `tags` attribute instead.

### Simplified Resource Arguments
Expand Down
56 changes: 56 additions & 0 deletions docs/resources/networking_ip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
page_title: "Linode: linode_networking_ip"
description: |-
Manages the allocation and assignment of an IP addresses.
---

# linode\_networking\_ip

Manages allocation of reserved IPv4 address in a region and optionally assigning the reserved address to a Linode instance.

For more information, see the corresponding [API documentation](https://techdocs.akamai.com/linode-api/reference/post-allocate-ip).

## Example Usage

```hcl
resource "linode_networking_ip" "test_ip" {
type = "ipv4"
linode_id = 12345
public = true
}
```

## Argument Reference

The following arguments are supported:

* `type` - (Required) The type of IP address. (ipv4, ipv6, etc.)

* `public` - (Optional) Whether the IP address is public. Defaults to true.

* `linode_id` - (Optional) The ID of the Linode to which the IP address will be assigned. Conflicts with `region`.

### Reserved-Specific Argument Reference

-> **Note:** IP reservation is not currently accessible to all users.

The following arguments are only available when reserving an IP address:

* `reserved` - (Optional) Whether this IP address should be a reserved IP.

* `region` - (Optional) The region where the reserved IP should be allocated.

## Attributes Reference

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

* `address` - The IP address.

* `id` - The IP address.

## Import

IP addresses can be imported using the IP address ID, e.g.

```sh
terraform import linode_networking_ip.example_ip 172.104.30.209
53 changes: 53 additions & 0 deletions docs/resources/networking_ip_assignment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
page_title: "Linode: linode_networking_ip_assignment"
description: |-
Managed the assignment multiple IPv4 addresses and/or IPv6 ranges to multiple Linodes in a Region.
---

# linode_networking_ip_assignment

Manages the assignment of multiple IPv4 addresses and/or IPv6 ranges to multiple Linodes in a specified region.


For more information, see the corresponding [API documentation](https://techdocs.akamai.com/linode-api/reference/post-assign-ips).

## Example Usage

```hcl
resource "linode_networking_ip_assignment" "foobar" {
region = "us-mia"
assignments = [
{
address = linode_networking_ip.reserved_ip1.address
linode_id = linode_instance.terraform-web1.id
},
{
address = linode_networking_ip.reserved_ip2.address
linode_id = linode_instance.terraform-web2.id
},
]
}
```

## Argument Reference

* `region` - (Required) The region where the IP addresses will be assigned.

* `assignments` - (Required) A list of IP/Linode assignments to apply.

## assignments

The following attributes can be defined under each entry in the `assignments` field:

* `address` - (Required) The IPv4 address or IPv6 range to assign.

* `linode_id` - (Required) The ID of the Linode to which the IP address will be assigned.

## Attribute Reference

* `id` - The unique ID of this resource.

## Import

Network IP assignments cannot be imported.

0 comments on commit 98b6393

Please sign in to comment.