Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: correct the prebuilds type definition#376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
SasSwart merged 1 commit intomainfromjjs/363
Apr 7, 2025
Merged
Changes fromall 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 deletionsprovider/workspace_preset.go
View file
Open in desktop
Original file line numberDiff line numberDiff 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

[8]ページ先頭

©2009-2025 Movatter.jp