Skip to content

TPT-4295: terraform: Update linode_networking_ip resource — reserved conversion & IP representation - #2327

Merged
mgwoj merged 29 commits into
linode:proj/reserved-ipsfrom
mgwoj:feature/TPT-4295-terraform-update-linode_networking_ip-resource-reserved-conversion-ip
May 21, 2026
Merged

TPT-4295: terraform: Update linode_networking_ip resource — reserved conversion & IP representation#2327
mgwoj merged 29 commits into
linode:proj/reserved-ipsfrom
mgwoj:feature/TPT-4295-terraform-update-linode_networking_ip-resource-reserved-conversion-ip

Conversation

@mgwoj

@mgwoj mgwoj commented Apr 8, 2026

Copy link
Copy Markdown
Contributor

📝 Description

Extend the existing linode_networking_ip resource and related data sources to support two new API changes:

PUT /networking/ips/{address} — Add ability to convert an existing ephemeral IP to a reserved IP (and vice versa) by setting/unsetting the reserved flag.
Updated IP address representation — Add the new reserved and tags fields to all responses from /networking/ips endpoints.

✔️ How to Test

make test-unit
make PKG_NAME="instancenetworking" test-int
make PKG_NAME="instancereservedipassignment" test-int
make PKG_NAME="networkingip" test-int
make PKG_NAME="networkingipassignment" test-int
make PKG_NAME="networkingips" test-int

@mgwoj
mgwoj requested a review from Copilot April 8, 2026 14:05
@mgwoj
mgwoj requested review from a team as code owners April 8, 2026 14:05
@mgwoj mgwoj added the new-feature for new features in the changelog. label Apr 8, 2026
@mgwoj
mgwoj requested review from ckulinsk and jbilskiAkam and removed request for a team April 8, 2026 14:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Extends the Linode IP-related Terraform resources/data sources to support the API’s updated IP representation (adding reserved + tags fields) and to support converting IPs between ephemeral and reserved via in-place updates.

Changes:

  • Add tags (and propagate reserved) across networking IP schemas/models for resources and data sources.
  • Update linode_networking_ips data source listing logic to include unassigned reserved IPs.
  • Add/adjust unit + acceptance tests and update docs to reflect new fields and reserved conversion behavior.

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
linode/networkingips/framework_models_unit_test.go New unit tests for parsing IP tags/reserved into models.
linode/networkingips/framework_datasource.go Merge ListIPAddresses + ListReservedIPAddresses to include unassigned reserved IPs.
linode/networkingips/framework_datasource_test.go Refactor acceptance checks for ip_addresses fields (now includes tags).
linode/networkingips/framework_datasource_models.go Add Tags to IPAddressModel and parse from API.
linode/networkingips/famework_datasource_schema.go Expose tags on the linode_networking_ips data source schema.
linode/networkingipassignment/framework_resource.go Populate computed reserved/tags for assignment entries; add helper to flatten tags.
linode/networkingipassignment/framework_resource_schema.go Change assignments to nested schema and expose computed reserved/tags.
linode/networkingipassignment/framework_resource_model.go Extend assignment model with reserved + tags.
linode/networkingip/resource_test.go Add acceptance test for ephemeral ⇄ reserved in-place conversion + tags presence.
linode/networkingip/framework_resource.go After update, re-read IP details to refresh computed fields.
linode/networkingip/framework_resource_schema.go Expose computed tags on the linode_networking_ip resource schema.
linode/networkingip/framework_resource_model.go Track/flatten tags from API into resource state.
linode/networkingip/framework_models_unit_test.go Extend unit tests to validate tags parsing in resource/data models.
linode/networkingip/framework_datasource_schema.go Expose computed tags on the linode_networking_ip data source.
linode/networkingip/framework_datasource_model.go Parse API tags into the linode_networking_ip data source model.
linode/instancereservedipassignment/framework_schema.go Expose computed tags on reserved IP assignment resource schema.
linode/instancereservedipassignment/framework_models.go Flatten/copy tags for reserved IP assignment model.
linode/instancereservedipassignment/framework_models_unit_test.go New unit tests validating tags behavior for reserved IP assignment model.
linode/instancenetworking/framework_models.go Include reserved + tags in flattened instance networking IP objects.
linode/instancenetworking/framework_models_unit_test.go Update unit tests for reserved/tags in instance networking IP parsing.
linode/instancenetworking/framework_datasource_schema.go Extend instance networking object type with reserved + tags.
docs/resources/reserved_ip_assignment.md New docs describing reserved IP assignment resource attributes including tags.
docs/resources/networking_ip.md Document reserved conversion semantics + add tags attribute.
docs/resources/networking_ip_assignment.md Document computed reserved + tags fields on assignment entries.
docs/data-sources/networking_ips.md Document tags field on returned IPs.
docs/data-sources/networking_ip.md Document tags field on networking IP data source.
docs/data-sources/instance_networking.md Document reserved/tags fields on instance networking IP objects.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread linode/networkingips/framework_datasource_test.go Outdated
Comment thread linode/networkingip/framework_resource.go Outdated
Comment thread linode/networkingipassignment/framework_resource.go Outdated
Comment thread linode/networkingipassignment/framework_resource.go Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The API spec claims this is an API filterable field. Can we double check it to see if we can toggle it to true?

Comment thread linode/networkingips/famework_datasource_schema.go Outdated
Comment thread linode/networkingips/framework_datasource.go Outdated
Comment thread linode/networkingip/framework_resource_schema.go Outdated
Comment thread linode/networkingip/framework_datasource_schema.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 29 out of 30 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread linode/networkingip/framework_resource.go
Comment thread linode/networkingip/framework_resource.go Outdated
Comment thread go.mod Outdated
Comment thread docs/resources/networking_ip.md Outdated
Comment thread docs/resources/reserved_ip_assignment.md Outdated
Comment thread docs/data-sources/networking_ips.md Outdated
Comment thread docs/data-sources/networking_ip.md Outdated
Comment thread docs/data-sources/instance_networking.md Outdated
Comment thread docs/data-sources/instance_networking.md Outdated
Comment thread docs/data-sources/instance_networking.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.

Comment thread linode/networkingips/tmpl/data_filter.gotf
Comment thread linode/networkingipassignment/resource_test.go
@mawilk90

Copy link
Copy Markdown
Contributor

There are still two failing tests that are triggerred by make PKG_NAME="networkingips" test-int:

  1. TestAccDataSourceNetworkingIP_list - it fails because filtering specified in networking_ip_data_list template does not work (the list of all existing IPs is retrieved so 0 index refers to a random IP). Anyway, should we use filtering in networking_ip_data_list template if we have a dedicated template (networking_ip_data_filtered) and test for that (see below)
  2. TestAccDataSourceNetworkingIP_filterReserved - similar issue as for TestAccDataSourceNetworkingIP_list

@mgwoj
mgwoj requested a review from Copilot May 13, 2026 11:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 38 out of 38 changed files in this pull request and generated 4 comments.

data "linode_networking_ips" "list" {
depends_on = [linode_networking_ip.test]
}
data "linode_networking_ips" "list" {}
Comment on lines +1 to +73
---
page_title: "Linode: linode_reserved_ip_assignment"
description: |-
Manages assignment of a reserved IP address to a Linode instance.
---

# linode\_reserved\_ip\_assignment

Manages the assignment of a reserved IPv4 address to a Linode instance.

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

## Example Usage

```hcl
resource "linode_reserved_ip_assignment" "example" {
linode_id = linode_instance.example.id
address = linode_networking_ip.reserved.address
public = true
}
```

## Argument Reference

The following arguments are supported:

* `linode_id` - (Required) The ID of the Linode to assign the reserved IP to. Changing this forces creation of a new resource.

* `address` - (Required) The reserved IPv4 address to assign to the Linode.

* `public` - (Optional) Whether the IP address is public. Defaults to `true`. This must match the reserved IP's existing public/private status. Changing this forces creation of a new resource.

* `rdns` - (Optional) The reverse DNS assigned to this address. Configured via a separate API call after the IP is assigned.

* `apply_immediately` - (Optional) If true, the instance will be rebooted to update network interfaces. Defaults to `false`.

## Attributes Reference

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

* `id` - The ID of the IPv4 address (the address itself).

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

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

* `region` - The region this IP resides in.

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

* `type` - The type of IP address.

* `reserved` - The reservation status of the IP address.

* `tags` - A set of tags associated with this IP address.

* `assigned_entity` - The entity this IP address has been assigned to. This is null if the address is not assigned to an entity.

* `id` - The ID of the entity.

* `label` - The label of the entity.

* `type` - The type of the entity.

* `url` - The URL of the entity.

* `vpc_nat_1_1` - Contains information about the NAT 1:1 mapping of a public IP address to a VPC subnet.

* `address` - The IPv4 address that is configured as a 1:1 NAT for this VPC interface.

* `subnet_id` - The `id` of the VPC Subnet for this Interface.

* `vpc_id` - The `id` of the VPC configured for this Interface.
Comment thread docs/resources/networking_ip.md Outdated
The following arguments are only available when reserving an IP address:

* `reserved` - (Optional) Whether this IP address should be a reserved IP.
* `reserved` - (Optional) Whether this IP address should be a reserved IP. Changing this value on an assigned IP triggers an in-place update (not replacement). Setting `reserved = true` converts an ephemeral IP to reserved. Setting `reserved = false` converts a reserved IP to ephemeral (or deletes it if unassigned).
Comment on lines +112 to +115
// The reserved IP appears in the public list; verify 2 public IPs are present
resource.TestCheckResourceAttr(testInstanceNetworkResName, "ipv4.0.public.#", "2"),
// At least one public IP has assigned_entity populated (the reserved IP)
resource.TestCheckResourceAttrSet(testInstanceNetworkResName, "ipv4.0.public.0.assigned_entity.type"),

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 2 comments.

Comment thread docs/resources/networking_ip.md Outdated
The following arguments are only available when reserving an IP address:

* `reserved` - (Optional) Whether this IP address should be a reserved IP.
* `reserved` - (Optional) Whether this IP address should be a reserved IP. Changing this value on an assigned IP triggers an in-place update (not replacement). Setting `reserved = true` converts an ephemeral IP to reserved. Setting `reserved = false` converts a reserved IP to ephemeral when the address is assigned. If the reserved IP is unassigned, the provider deletes the IP during the update and returns an `IP Address Deleted During Update` error; after this occurs, remove the resource from your Terraform configuration so future applies succeed.
Comment on lines +46 to +50
* `reserved` - (Computed) Whether this IP address is a reserved IP. Populated from the IP address details after assignment.

* `tags` - (Computed) A set of tags associated with this IP address. Populated from the IP address details after assignment.

* `assigned_entity` - (Computed) The entity this IP address has been assigned to. Populated from the IP address details after assignment.

@ezilber-akamai ezilber-akamai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Implementation looks good and tests are passing locally. Nice work!

@mgwoj
mgwoj merged commit 7a14454 into linode:proj/reserved-ips May 21, 2026
9 checks passed
@mgwoj
mgwoj deleted the feature/TPT-4295-terraform-update-linode_networking_ip-resource-reserved-conversion-ip branch May 21, 2026 07:05
lgarber-akamai added a commit that referenced this pull request Jul 9, 2026
* TPT-4292: terraform: Implement linode_reserved_ip resource (#2309)

* TPT-4294: terraform: Update linode_instance resource to support reserved IP assignment at creation (#2323)

* TPT-4293: terraform: Implement linode_reserved_ip_types data source (#2322)

* TPT-4296: terraform: Update linode_nodebalancer resource to support reserved IP assignment (#2329)

* TPT-4297: terraform: Implement linode_tag Data Source with Reserved IPv4 Support (#2330)

* TPT-4295: terraform: Update linode_networking_ip resource — reserved conversion & IP representation (#2327)

* Update unit tests for linodego v2

* Make format

---------

Co-authored-by: Michal Wojcik <32574975+mgwoj@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature for new features in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants