@@ -95,15 +95,16 @@ func TestWorkspacesCreate(t *testing.T) {
9595
9696 t .Run ("with valid options" , func (t * testing.T ) {
9797 options := WorkspaceCreateOptions {
98- Environment : envTest ,
99- Name : String (randomString (t )),
100- AutoApply : Bool (true ),
101- ForceLatestRun : Bool (true ),
102- ExecutionMode : WorkspaceExecutionModePtr (WorkspaceExecutionModeRemote ),
103- TerraformVersion : String ("1.1.9" ),
104- WorkingDirectory : String ("bar/" ),
105- RunOperationTimeout : Int (15 ),
106- AutoQueueRuns : AutoQueueRunsModePtr (AutoQueueRunsModeNever ),
98+ Environment : envTest ,
99+ Name : String (randomString (t )),
100+ AutoApply : Bool (true ),
101+ ForceLatestRun : Bool (true ),
102+ DeletionProtectionEnabled : Bool (false ),
103+ ExecutionMode : WorkspaceExecutionModePtr (WorkspaceExecutionModeRemote ),
104+ TerraformVersion : String ("1.1.9" ),
105+ WorkingDirectory : String ("bar/" ),
106+ RunOperationTimeout : Int (15 ),
107+ AutoQueueRuns : AutoQueueRunsModePtr (AutoQueueRunsModeNever ),
107108 }
108109
109110 ws , err := client .Workspaces .Create (ctx , options )
@@ -121,6 +122,7 @@ func TestWorkspacesCreate(t *testing.T) {
121122 assert .Equal (t , * options .Name , item .Name )
122123 assert .Equal (t , * options .AutoApply , item .AutoApply )
123124 assert .Equal (t , * options .ForceLatestRun , item .ForceLatestRun )
125+ assert .Equal (t , * options .DeletionProtectionEnabled , item .DeletionProtectionEnabled )
124126 assert .Equal (t , false , item .HasResources )
125127 assert .Equal (t , * options .ExecutionMode , item .ExecutionMode )
126128 assert .Equal (t , * options .TerraformVersion , item .TerraformVersion )
@@ -295,13 +297,14 @@ func TestWorkspacesUpdate(t *testing.T) {
295297
296298 t .Run ("when updating a subset of values" , func (t * testing.T ) {
297299 options := WorkspaceUpdateOptions {
298- Name : String (wsTest .Name ),
299- AutoApply : Bool (true ),
300- ForceLatestRun : Bool (true ),
301- ExecutionMode : WorkspaceExecutionModePtr (WorkspaceExecutionModeRemote ),
302- TerraformVersion : String ("1.2.9" ),
303- RunOperationTimeout : Int (20 ),
304- AutoQueueRuns : AutoQueueRunsModePtr (AutoQueueRunsModeAlways ),
300+ Name : String (wsTest .Name ),
301+ AutoApply : Bool (true ),
302+ ForceLatestRun : Bool (true ),
303+ DeletionProtectionEnabled : Bool (false ),
304+ ExecutionMode : WorkspaceExecutionModePtr (WorkspaceExecutionModeRemote ),
305+ TerraformVersion : String ("1.2.9" ),
306+ RunOperationTimeout : Int (20 ),
307+ AutoQueueRuns : AutoQueueRunsModePtr (AutoQueueRunsModeAlways ),
305308 }
306309
307310 wsAfter , err := client .Workspaces .Update (ctx , wsTest .ID , options )
@@ -312,6 +315,7 @@ func TestWorkspacesUpdate(t *testing.T) {
312315 assert .Equal (t , * options .AutoQueueRuns , wsAfter .AutoQueueRuns )
313316 assert .NotEqual (t , wsTest .AutoApply , wsAfter .AutoApply )
314317 assert .NotEqual (t , wsTest .ForceLatestRun , wsAfter .ForceLatestRun )
318+ assert .NotEqual (t , wsTest .DeletionProtectionEnabled , wsAfter .DeletionProtectionEnabled )
315319 assert .NotEqual (t , wsTest .TerraformVersion , wsAfter .TerraformVersion )
316320 assert .Equal (t , wsTest .WorkingDirectory , wsAfter .WorkingDirectory )
317321 assert .Equal (t , int (20 ), * wsAfter .RunOperationTimeout )
@@ -340,12 +344,13 @@ func TestWorkspacesUpdate(t *testing.T) {
340344
341345 t .Run ("with valid options" , func (t * testing.T ) {
342346 options := WorkspaceUpdateOptions {
343- Name : String (randomString (t )),
344- AutoApply : Bool (false ),
345- ForceLatestRun : Bool (false ),
346- ExecutionMode : WorkspaceExecutionModePtr (WorkspaceExecutionModeLocal ),
347- TerraformVersion : String ("1.1.9" ),
348- WorkingDirectory : String ("baz/" ),
347+ Name : String (randomString (t )),
348+ AutoApply : Bool (false ),
349+ ForceLatestRun : Bool (false ),
350+ DeletionProtectionEnabled : Bool (false ),
351+ ExecutionMode : WorkspaceExecutionModePtr (WorkspaceExecutionModeLocal ),
352+ TerraformVersion : String ("1.1.9" ),
353+ WorkingDirectory : String ("baz/" ),
349354 }
350355
351356 w , err := client .Workspaces .Update (ctx , wsTest .ID , options )
@@ -362,6 +367,7 @@ func TestWorkspacesUpdate(t *testing.T) {
362367 assert .Equal (t , * options .Name , item .Name )
363368 assert .Equal (t , * options .AutoApply , item .AutoApply )
364369 assert .Equal (t , * options .ForceLatestRun , item .ForceLatestRun )
370+ assert .Equal (t , * options .DeletionProtectionEnabled , item .DeletionProtectionEnabled )
365371 assert .Equal (t , * options .ExecutionMode , item .ExecutionMode )
366372 assert .Equal (t , * options .TerraformVersion , item .TerraformVersion )
367373 assert .Equal (t , * options .WorkingDirectory , item .WorkingDirectory )
0 commit comments