Skip to content

Commit 3c94ca9

Browse files
fix: Skip empty values so Terraform can use the default value (#3902)
1 parent 94eb503 commit 3c94ca9

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

coderd/workspaces.go

+6
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,12 @@ func (api *API) postWorkspacesByOrganization(rw http.ResponseWriter, r *http.Req
389389
return xerrors.Errorf("insert workspace: %w", err)
390390
}
391391
for _, parameterValue := range createWorkspace.ParameterValues {
392+
// If the value is empty, we don't want to save it on database so
393+
// Terraform can use the default value
394+
if parameterValue.SourceValue == "" {
395+
continue
396+
}
397+
392398
_, err = db.InsertParameterValue(r.Context(), database.InsertParameterValueParams{
393399
ID: uuid.New(),
394400
Name: parameterValue.Name,

site/src/components/ParameterInput/ParameterInput.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const ParameterField: React.FC<React.PropsWithChildren<ParameterInputProps>> = (
5858
id={schema.name}
5959
size="small"
6060
defaultValue={schema.default_source_value}
61+
placeholder={schema.default_source_value}
6162
disabled={disabled}
6263
onChange={(event) => {
6364
onChange(event.target.value)

0 commit comments

Comments
 (0)