Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e0d8555

Browse files
committedJun 25, 2024·
Switch to OptionalEnv
1 parent 382b543 commit e0d8555

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed
 

‎.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ website/vendor
3232
!command/test-fixtures/**/.terraform/
3333

3434
# Keep windows files with windows line endings
35-
*.winfile eol=crlf
35+
*.winfile eol=crlf
36+
37+
# Binary
38+
terraform-provider-coder

‎integration/integration_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ func TestIntegration(t *testing.T) {
9191
ctrID := setup(ctx, t, tt.name)
9292
// Import named template
9393
_, rc := execContainer(ctx, t, ctrID, fmt.Sprintf(`coder templates push %s --directory /src/integration/%s --var output_path=/tmp/%s.json --yes`, tt.name, tt.name, tt.name))
94+
time.Sleep(10 * time.Minute)
95+
9496
require.Equal(t, 0, rc)
9597
// Create a workspace
9698
_, rc = execContainer(ctx, t, ctrID, fmt.Sprintf(`coder create %s -t %s --yes`, tt.name, tt.name))
@@ -165,6 +167,8 @@ func setup(ctx context.Context, t *testing.T, name string) string {
165167
"CODER_IN_MEMORY=true", // We don't necessarily care about real persistence here.
166168
"CODER_TELEMETRY_ENABLE=false", // Avoid creating noise.
167169
"TF_CLI_CONFIG_FILE=/tmp/integration.tfrc", // Our custom tfrc from above.
170+
"TF_LOG=DEBUG",
171+
"CODER_VERBOSE=TRUE",
168172
},
169173
Labels: map[string]string{},
170174
}, &container.HostConfig{

‎provider/workspace.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,13 @@ func workspaceDataSource() *schema.Resource {
6262
id := helpers.OptionalEnvOrDefault("CODER_WORKSPACE_ID", uuid.NewString())
6363
rd.SetId(id)
6464

65-
templateID := helpers.OptionalEnv("CODER_WORKSPACE_TEMPLATE_ID")
65+
templateID := helpers.OptionalEnv("CODER_WORKSPACE_TEMPLATE_ID") // FIXME switch to `helpers.RequireEnv(...)`
6666
_ = rd.Set("template_id", templateID)
6767

68-
templateName := helpers.OptionalEnv("CODER_WORKSPACE_TEMPLATE_NAME")
68+
templateName := helpers.OptionalEnv("CODER_WORKSPACE_TEMPLATE_NAME") // FIXME switch to `helpers.RequireEnv(...)`
6969
_ = rd.Set("template_name", templateName)
7070

71-
templateVersion, err := helpers.RequireEnv("CODER_WORKSPACE_TEMPLATE_VERSION")
72-
if err != nil {
73-
return diag.Errorf("undefined env: %v", err)
74-
}
71+
templateVersion := helpers.OptionalEnv("CODER_WORKSPACE_TEMPLATE_VERSION") // FIXME switch to `helpers.RequireEnv(...)`
7572
_ = rd.Set("template_version", templateVersion)
7673

7774
config, valid := i.(config)

0 commit comments

Comments
 (0)
Please sign in to comment.