Skip to content
Merged
Changes from 1 commit
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
Next Next commit
chore: template versions without tf values assumed to be empty
  • Loading branch information
Emyrk committed Jun 20, 2025
commit eba1c36e7ca3ce30aaec4c469ec997cdf4d27c04
16 changes: 15 additions & 1 deletion coderd/dynamicparameters/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import (
"context"
"database/sql"
"io/fs"
"log/slog"
"sync"
"time"

"github.com/google/uuid"
"golang.org/x/sync/errgroup"
Expand Down Expand Up @@ -105,7 +107,19 @@

if r.terraformValues == nil {
values, err := db.GetTemplateVersionTerraformValues(ctx, r.templateVersion.ID)
if err != nil {
if xerrors.Is(err, sql.ErrNoRows) {

Check failure on line 110 in coderd/dynamicparameters/render.go

View workflow job for this annotation

GitHub Actions / lint

early-return: if c { ... } else { ... return } can be simplified to if !c { ... return } ... (revive)
// If the row does not exist, return zero values.
//
// Older template versions (prior to dynamic parameters) will be missing
// this row, and we can assume the 'ProvisionerdVersion' "" (unknown).
values = database.TemplateVersionTerraformValue{
TemplateVersionID: r.templateVersionID,
UpdatedAt: time.Time{},
CachedPlan: nil,
CachedModuleFiles: uuid.NullUUID{},
ProvisionerdVersion: "",
}
} else {
return xerrors.Errorf("template version terraform values: %w", err)
}
r.terraformValues = &values
Expand Down
Loading