8000 fix prebuild decoding · coder/coder@798cfa1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 798cfa1

Browse files
committed
fix prebuild decoding
1 parent a87933a commit 798cfa1

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

go.mod

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ require (
9494
github.com/coder/quartz v0.1.2
9595
github.com/coder/retry v1.5.1
9696
github.com/coder/serpent v0.10.0
97-
github.com/coder/terraform-provider-coder/v2 v2.3.1-0.20250407062000-ef92eea9d88a
97+
github.com/coder/terraform-provider-coder/v2 v2.3.1-0.20250407072338-ead7863cc664
9898
github.com/coder/websocket v1.8.12
9999
github.com/coder/wgtunnel v0.1.13-0.20240522110300-ade90dfb2da0
100100
github.com/coreos/go-oidc/v3 v3.13.0
@@ -483,4 +483,9 @@ require (
483483

484484
require github.com/mark3labs/mcp-go v0.17.0
485485

486-
require github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
486+
require (
487+
github.com/hashicorp/go-plugin v1.6.2 // indirect
488+
github.com/hashicorp/terraform-registry-address v0.2.4 // indirect
489+
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
490+
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
491+
)

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ github.com/coder/terraform-config-inspect v0.0.0-20250107175719-6d06d90c630e h1:
250250
github.com/coder/terraform-config-inspect v0.0.0-20250107175719-6d06d90c630e/go.mod h1:Gz/z9Hbn+4KSp8A2FBtNszfLSdT2Tn/uAKGuVqqWmDI=
251251
github.com/coder/terraform-provider-coder/v2 v2.3.1-0.20250407062000-ef92eea9d88a h1:iVY94QDlHAjxhqn0pIBxB2Suru+2zLYVanb2rY2zcNY=
252252
github.com/coder/terraform-provider-coder/v2 v2.3.1-0.20250407062000-ef92eea9d88a/go.mod h1:X28s3rz+aEM5PkBKvk3xcUrQFO2eNPjzRChUg9wb70U=
253+
github.com/coder/terraform-provider-coder/v2 v2.3.1-0.20250407072338-ead7863cc664 h1:FAycscYb08zYK7a42D2y80Hkdlb819OZ/QeMVWmtKIM=
254+
github.com/coder/terraform-provider-coder/v2 v2.3.1-0.20250407072338-ead7863cc664/go.mod h1:X28s3rz+aEM5PkBKvk3xcUrQFO2eNPjzRChUg9wb70U=
253255
github.com/coder/websocket v1.8.12 h1:5bUXkEPPIbewrnkU8LTCLVaxi4N4J8ahufH2vlo4NAo=
254256
github.com/coder/websocket v1.8.12/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
255257
github.com/coder/wgtunnel v0.1.13-0.20240522110300-ade90dfb2da0 h1:C2/eCr+r0a5Auuw3YOiSyLNHkdMtyCZHPFBx7syN4rk=

provisioner/terraform/resources.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,11 +884,21 @@ func ConvertState(ctx context.Context, modules []*tfjson.StateModule, rawGraph s
884884
)
885885
}
886886

887+
if len(preset.Prebuilds) != 1 {
888+
logger.Warn(
889+
ctx,
890+
"coder_workspace_preset must have exactly one prebuild block",
891+
)
892+
}
893+
var prebuildInstances int32
894+
if len(preset.Prebuilds) > 0 {
895+
prebuildInstances = int32(math.Min(math.MaxInt32, float64(preset.Prebuilds[0].Instances)))
896+
}
887897
protoPreset := &proto.Preset{
888898
Name: preset.Name,
889899
Parameters: presetParameters,
890900
Prebuild: &proto.Prebuild{
891-
Instances: int32(math.Min(math.MaxInt32, float64(preset.Prebuilds[0].Instances))),
901+
Instances: prebuildInstances,
892902
},
893903
}
894904

0 commit comments

Comments
 (0)
0