Fix duplicate default state
The default state is already explicitly added to the result slice. Added a guard to prevent it being added a second time. Fixes https://github.com/hashicorp/terraform/issues/28098
This commit is contained in:
parent
0750a16cce
commit
188ea61a12
|
@ -23,8 +23,10 @@ func (b *Backend) Workspaces() ([]string, error) {
|
|||
result := make([]string, 1, len(res.Kvs)+1)
|
||||
result[0] = backend.DefaultStateName
|
||||
for _, kv := range res.Kvs {
|
||||
if strings.TrimPrefix(string(kv.Key), b.prefix) != backend.DefaultStateName {
|
||||
result = append(result, strings.TrimPrefix(string(kv.Key), b.prefix))
|
||||
}
|
||||
}
|
||||
sort.Strings(result[1:])
|
||||
|
||||
return result, nil
|
||||
|
|
Loading…
Reference in New Issue