Skip to content

Commit 44c798b

Browse files
drewmullensebasslash
authored andcommitted
bool vals are assessed for inclusion
1 parent dabecec commit 44c798b

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

internal/provider/resource_tfe_workspace.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -374,10 +374,7 @@ func resourceTFEWorkspaceCreate(d *schema.ResourceData, meta interface{}) error
374374
options := tfe.WorkspaceCreateOptions{
375375
Name: tfe.String(name),
376376
AllowDestroyPlan: tfe.Bool(d.Get("allow_destroy_plan").(bool)),
377-
AutoApply: tfe.Bool(d.Get("auto_apply").(bool)),
378377
AutoApplyRunTrigger: tfe.Bool(d.Get("auto_apply_run_trigger").(bool)),
379-
Description: tfe.String(d.Get("description").(string)),
380-
AssessmentsEnabled: tfe.Bool(d.Get("assessments_enabled").(bool)),
381378
FileTriggersEnabled: tfe.Bool(d.Get("file_triggers_enabled").(bool)),
382379
QueueAllRuns: tfe.Bool(d.Get("queue_all_runs").(bool)),
383380
SpeculativeEnabled: tfe.Bool(d.Get("speculative_enabled").(bool)),
@@ -391,6 +388,18 @@ func resourceTFEWorkspaceCreate(d *schema.ResourceData, meta interface{}) error
391388
options.GlobalRemoteState = tfe.Bool(globalRemoteState.(bool))
392389
}
393390

391+
if v, ok := d.GetOkExists("auto_apply"); ok {
392+
options.AutoApply = tfe.Bool(v.(bool))
393+
}
394+
395+
if v, ok := d.GetOkExists("assessments_enabled"); ok {
396+
options.AssessmentsEnabled = tfe.Bool(v.(bool))
397+
}
398+
399+
if v, ok := d.GetOk("description"); ok {
400+
options.Description = tfe.String(v.(string))
401+
}
402+
394403
if v, ok := d.GetOk("agent_pool_id"); ok && v.(string) != "" {
395404
options.AgentPoolID = tfe.String(v.(string))
396405
options.SettingOverwrites = &tfe.WorkspaceSettingOverwritesOptions{
@@ -726,13 +735,13 @@ func resourceTFEWorkspaceUpdate(d *schema.ResourceData, meta interface{}) error
726735
}
727736

728737
if d.HasChange("assessments_enabled") {
729-
if v, ok := d.GetOk("assessments_enabled"); ok {
738+
if v, ok := d.GetOkExists("assessments_enabled"); ok {
730739
options.AssessmentsEnabled = tfe.Bool(v.(bool))
731740
}
732741
}
733742

734743
if d.HasChange("auto_apply") {
735-
if v, ok := d.GetOk("auto_apply"); ok {
744+
if v, ok := d.GetOkExists("auto_apply"); ok {
736745
options.AutoApply = tfe.Bool(v.(bool))
737746
}
738747
}

internal/provider/resource_tfe_workspace_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestAccTFEWorkspace_basic(t *testing.T) {
5555
resource.TestCheckResourceAttr(
5656
"tfe_workspace.foobar", "queue_all_runs", "true"),
5757
resource.TestCheckResourceAttr(
58-
"tfe_workspace.foobar", "speculative_enabled", "true"),
58+
"tfe_workspace.foobar", "speculative_enabled", "false"),
5959
resource.TestCheckResourceAttr(
6060
"tfe_workspace.foobar", "assessments_enabled", "false"),
6161
resource.TestCheckResourceAttr(

0 commit comments

Comments
 (0)