Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions linode/instancedisk/framework_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,21 @@ func (r *Resource) Read(
return
}

// Only populate Image if state.Image is null and the parent instance has an image set
if state.Image.IsNull() {
instance, err := client.GetInstance(ctx, linodeID)
if err != nil {
tflog.Debug(ctx, "Failed to fetch parent instance for disk image fallback", map[string]any{
"linode_id": linodeID,
"error": err.Error(),
})
} else if instance.Image != "" {
state.Image = types.StringValue(instance.Image)
}
}

state.FlattenDisk(disk, false)

resp.Diagnostics.Append(resp.State.Set(ctx, &state)...)
}

Expand Down
1 change: 1 addition & 0 deletions linode/instancedisk/framework_resource_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ var frameworkResourceSchema = schema.Schema{
Optional: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.RequiresReplace(),
stringplanmodifier.UseStateForUnknown(),
},
},
"root_pass": schema.StringAttribute{
Expand Down