diff --git a/internal/resource/host/state.go b/internal/resource/host/state.go index b7a3040..a35a4d3 100644 --- a/internal/resource/host/state.go +++ b/internal/resource/host/state.go @@ -40,7 +40,10 @@ func (s *State) ApplyHost(ctx context.Context, host *definednet.Host) (diags dia s.RoleID = types.StringValue(host.RoleID) } - s.Tags, diags = types.ListValueFrom(ctx, types.StringType, host.Tags) + s.Tags = types.ListNull(types.StringType) + if len(host.Tags) > 0 { + s.Tags, diags = types.ListValueFrom(ctx, types.StringType, host.Tags) + } return diags } diff --git a/internal/resource/lighthouse/state.go b/internal/resource/lighthouse/state.go index 71e95d0..d71b513 100644 --- a/internal/resource/lighthouse/state.go +++ b/internal/resource/lighthouse/state.go @@ -53,21 +53,24 @@ func (s *State) ApplyHost(ctx context.Context, lighthouse *definednet.Host) (dia diags.Append(d...) + tags := types.ListNull(types.StringType) + if len(lighthouse.Tags) > 0 { + tags, d = types.ListValueFrom(ctx, types.StringType, lighthouse.Tags) + diags.Append(d...) + } + s.ID = types.StringValue(lighthouse.ID) s.Name = types.StringValue(lighthouse.Name) s.NetworkID = types.StringValue(lighthouse.NetworkID) s.StaticAddresses = staticAddrs s.ListenPort = types.Int32Value(int32(lighthouse.ListenPort)) s.IPAddress = types.StringValue(lighthouse.IPAddress) + s.Tags = tags s.RoleID = types.StringNull() if lo.IsNotEmpty(lighthouse.RoleID) { s.RoleID = types.StringValue(lighthouse.RoleID) } - tags, d := types.ListValueFrom(ctx, types.StringType, lighthouse.Tags) - s.Tags = tags - diags.Append(d...) - return diags }