diff --git a/agent/config/builder.go b/agent/config/builder.go index 9c31c5b58b6a..52b5d82fda3e 100644 --- a/agent/config/builder.go +++ b/agent/config/builder.go @@ -2545,12 +2545,10 @@ func (b *builder) cloudConfigVal(v Config) hcpconfig.CloudConfig { val := hcpconfig.CloudConfig{ ResourceID: os.Getenv("HCP_RESOURCE_ID"), } - if v.NodeName != nil { - val.NodeName = b.nodeName(v.NodeName) - } - if v.NodeID != nil { - val.NodeID = types.NodeID(stringVal(v.NodeID)) - } + + nodeID := stringVal(v.NodeID) + val.NodeID = types.NodeID(nodeID) + val.NodeName = b.nodeName(v.NodeName) if v.Cloud == nil { return val