Skip to content

Commit c9fe4ee

Browse files
committed
Fix firewall_id handling in LKE node pools
1 parent 0b7b116 commit c9fe4ee

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

linode/lke/schema_resource.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ var resourceSchema = map[string]*schema.Schema{
133133
Type: schema.TypeInt,
134134
Description: "The ID of the Firewall to attach to nodes in this node pool.",
135135
Optional: true,
136+
Computed: true,
136137
},
137138
"labels": {
138139
Type: schema.TypeMap,

linode/lkenodepool/framework_models.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,11 @@ func (pool *NodePoolModel) SetNodePoolCreateOptions(
149149
)
150150
p.Type = pool.Type.ValueString()
151151
p.Label = pool.Label.ValueStringPointer()
152-
if !pool.FirewallID.IsUnknown() && !pool.FirewallID.IsNull() {
153-
id := pool.FirewallID.ValueInt64()
154-
p.FirewallID = linodego.Pointer(int(id))
152+
if !pool.FirewallID.IsUnknown() {
153+
p.FirewallID = helper.FrameworkSafeInt64PointerToIntPointer(pool.FirewallID.ValueInt64Pointer(), diags)
154+
if diags.HasError() {
155+
return
156+
}
155157
}
156158

157159
if !pool.Tags.IsNull() {
@@ -205,9 +207,11 @@ func (pool *NodePoolModel) SetNodePoolUpdateOptions(
205207
}
206208

207209
if !state.FirewallID.Equal(pool.FirewallID) {
208-
if !pool.FirewallID.IsUnknown() && !pool.FirewallID.IsNull() {
209-
id := pool.FirewallID.ValueInt64()
210-
p.FirewallID = linodego.Pointer(int(id))
210+
if !pool.FirewallID.IsUnknown() {
211+
p.FirewallID = helper.FrameworkSafeInt64PointerToIntPointer(pool.FirewallID.ValueInt64Pointer(), diags)
212+
if diags.HasError() {
213+
return false
214+
}
211215
}
212216
// else: do NOT set p.FirewallID at all
213217
shouldUpdate = true

0 commit comments

Comments
 (0)