fix: Instance image diff during Instance import#2238
Merged
ezilber-akamai merged 7 commits intolinode:devfrom Feb 5, 2026
Merged
fix: Instance image diff during Instance import#2238ezilber-akamai merged 7 commits intolinode:devfrom
image diff during Instance import#2238ezilber-akamai merged 7 commits intolinode:devfrom
Conversation
9df9564 to
8291881
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a state management issue where the image attribute was missing from the Terraform state during instance disk imports, causing unnecessary diffs and potential resource replacements.
Changes:
- Added
UseStateForUnknown()plan modifier to preserve theimageattribute in state - Implemented logic to populate
imagefrom the parent instance during Read operations when the state value is null
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| linode/instancedisk/framework_resource_schema.go | Added plan modifier to preserve image state value |
| linode/instancedisk/framework_resource.go | Added logic to backfill image from parent instance during import |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zliang-akamai
approved these changes
Jan 28, 2026
Member
|
This may introduce another issue when you are importing the disk without specifying image in the TF config: provider "linode" {}
resource "linode_instance" "test" {
label = "tf-disk-migration-test"
region = "us-east"
type = "g6-standard-1"
image = "linode/ubuntu22.04"
}
resource "linode_instance_disk" "boot" {
linode_id = linode_instance.test.id
label = "Ubuntu 22.04 LTS Disk"
size = 50688
// image removed here
}
resource "linode_instance_config" "cfg" {
linode_id = linode_instance.test.id
label = "My Ubuntu 22.04 LTS Disk Profile"
device {
device_name = "sda"
disk_id = linode_instance_disk.boot.id
}
} |
zliang-akamai
approved these changes
Feb 2, 2026
dawiddzhafarov
approved these changes
Feb 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Fixed an import/migration diff where linode_instance_disk.image was missing from state, causing unnecessary updates.
✔️ How to Test
The following test steps assume you have pulled down this PR locally.
Integration Testing:
make test-int TEST_SUITE="instancedisk"Manual Testing:
dx-devenv), runmake initfollowed bymake applyfor the following TF Configuration:linode-cli linodes disks-list <LINODE_ID>linode-cli linodes configs-list <LINODE_ID>terraform import linode_instance_disk.boot <LINODE_ID>,<DISK_ID>terraform import linode_instance_config.cfg <LINODE_ID>,<CONFIG_ID>make planand ensure that noimagediff is detected.