Skip to content

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

Merged
mgwoj merged 3 commits into
linode:proj/reserved-ipsfrom
mgwoj:feature/TPT-4294-terraform-update-linode_instance-resource-to-support-reserved-ip-assignment-at
May 8, 2026
Merged

TPT-4294: terraform: Update linode_instance resource to support reserved IP assignment at creation#2323
mgwoj merged 3 commits into
linode:proj/reserved-ipsfrom
mgwoj:feature/TPT-4294-terraform-update-linode_instance-resource-to-support-reserved-ip-assignment-at

Conversation

@mgwoj
Copy link
Copy Markdown
Contributor

@mgwoj mgwoj commented Apr 2, 2026

📝 Description

Extend the linode_instance resource to support assigning a pre-reserved IPv4 address to the instance at creation time. Currently, reserved IP assignment after creation is handled by linode_instance_reserved_ip_assignment. This story adds support for specifying a reserved IP at the point of POST /linode/instances.

✔️ How to Test

make TEST_SUITE="instance" test-int

@mgwoj mgwoj requested a review from Copilot April 2, 2026 15:52
@mgwoj mgwoj added the new-feature for new features in the changelog. label Apr 2, 2026
@mgwoj mgwoj requested review from a team as code owners April 2, 2026 15:52
@mgwoj mgwoj requested review from dawiddzhafarov and mawilk90 and removed request for a team April 2, 2026 15:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the linode_instance resource implementation and tests to better support reserved IPv4 assignment workflows by normalizing how instance IPv4 addresses are flattened into Terraform state and ensuring reserved-IP acceptance tests execute as part of the standard instance suite.

Changes:

  • Refactors repeated IPv4 flattening logic into a shared flattenInstanceIPv4 helper.
  • Updates instance read/create paths to use the shared IPv4 flattening helper.
  • Removes opt-in gating from reserved-IP acceptance tests so they run under the normal instance integration tag.

Reviewed changes

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

File Description
linode/instance/resource.go Uses shared IPv4 flattening helper when setting ipv4 in state during read/create.
linode/instance/flatten.go Introduces flattenInstanceIPv4 helper and reuses it in flattenInstance.
linode/instance/flatten_unit_test.go Adds unit coverage for the new IPv4 flattening helper.
linode/instance/resource_test.go Ensures reserved-IP acceptance tests run without opt-in gating.

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

@dawiddzhafarov
Copy link
Copy Markdown
Contributor

Sorry but I don't quite understand those changes - what changed that it enables using reserved IP in this resource?
To me, the source code is exactly the same, the difference is that some part of it was extracted to a func and tests were added for this func so there are no changes in the behavior of the resource - or am I missing something?

@mgwoj
Copy link
Copy Markdown
Contributor Author

mgwoj commented Apr 3, 2026

Sorry but I don't quite understand those changes - what changed that it enables using reserved IP in this resource? To me, the source code is exactly the same, the difference is that some part of it was extracted to a func and tests were added for this func so there are no changes in the behavior of the resource - or am I missing something?

It is only cleanup for the functionality which was already introduced earlier.

@dawiddzhafarov
Copy link
Copy Markdown
Contributor

Okay, so the PR title and commit message are a bit misleading for me

mgwoj and others added 2 commits May 7, 2026 17:44
…te-linode_instance-resource-to-support-reserved-ip-assignment-at
@mgwoj mgwoj requested a review from lgarber-akamai May 7, 2026 15:49
Copy link
Copy Markdown
Contributor

@lgarber-akamai lgarber-akamai left a comment

Choose a reason for hiding this comment

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

Looks great, nice work!

@mgwoj mgwoj merged commit cca3ff1 into linode:proj/reserved-ips May 8, 2026
9 checks passed
@mgwoj mgwoj deleted the feature/TPT-4294-terraform-update-linode_instance-resource-to-support-reserved-ip-assignment-at branch May 8, 2026 09:36
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