Skip to content
Merged
Changes from all 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
21 changes: 8 additions & 13 deletions provider/workspace_preset.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import (
type WorkspacePreset struct {
Name string `mapstructure:"name"`
Parameters map[string]string `mapstructure:"parameters"`
Prebuilds WorkspacePrebuild `mapstructure:"prebuilds"`
// There should always be only one prebuild block, but Terraform's type system
// still parses them as a slice, so we need to handle it as such. We could use
// an anonymous type and rd.Get to avoid a slice here, but that would not be possible
// for utilities that parse our terraform output using this type. To remain compatible
// with those cases, we use a slice here.
Prebuilds []WorkspacePrebuild `mapstructure:"prebuilds"`
}

type WorkspacePrebuild struct {
Expand All @@ -27,19 +32,9 @@ func workspacePresetDataSource() *schema.Resource {
ReadContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) diag.Diagnostics {
var preset WorkspacePreset
err := mapstructure.Decode(struct {
Name interface{}
Parameters interface{}
Prebuilds struct {
Instances interface{}
}
Name interface{}
}{
Name: rd.Get("name"),
Parameters: rd.Get("parameters"),
Prebuilds: struct {
Instances interface{}
}{
Instances: rd.Get("prebuilds.0.instances"),
},
Name: rd.Get("name"),
}, &preset)
if err != nil {
return diag.Errorf("decode workspace preset: %s", err)
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy