@@ -44,23 +44,23 @@ func TestGetResourceCountENoColor(t *testing.T) { //nolint:tparallel // subtests
4444func runTestGetResourceCountE (t * testing.T , noColor bool ) { //nolint:tparallel // subtests share mutable terraform options
4545 t .Helper ()
4646 testCases := []struct {
47- tfFuncToRun func (t ttesting.TestingT , options * terraform.Options ) string
47+ tfFuncToRun func (t ttesting.TestingT , ctx context. Context , options * terraform.Options ) string
4848 name string
4949 cntValue int
5050 expectedAdd int
5151 expectedChange int
5252 expectedDestroy int
5353 }{
54- {name : "PlanZero" , tfFuncToRun : terraform .InitAndPlan , cntValue : 0 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 0 },
55- {name : "ApplyZero" , tfFuncToRun : terraform .InitAndApply , cntValue : 0 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 0 },
56- {name : "PlanAddResouce" , tfFuncToRun : terraform .InitAndPlan , cntValue : 2 , expectedAdd : 2 , expectedChange : 0 , expectedDestroy : 0 },
57- {name : "ApplyAddResouce" , tfFuncToRun : terraform .InitAndApply , cntValue : 2 , expectedAdd : 2 , expectedChange : 0 , expectedDestroy : 0 },
58- {name : "PlanNoOp" , tfFuncToRun : terraform .InitAndApply , cntValue : 2 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 0 },
59- {name : "ApplyNoOp" , tfFuncToRun : terraform .InitAndApply , cntValue : 2 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 0 },
60- {name : "PlanDestroyResource" , tfFuncToRun : terraform .InitAndPlan , cntValue : 1 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 1 },
61- {name : "ApplyDestroyResource" , tfFuncToRun : terraform .InitAndApply , cntValue : 1 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 1 },
62- {name : "Destroy" , tfFuncToRun : terraform .Destroy , cntValue : 1 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 1 },
63- {name : "DestroyNoOp" , tfFuncToRun : terraform .Destroy , cntValue : 1 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 0 },
54+ {name : "PlanZero" , tfFuncToRun : terraform .InitAndPlanContext , cntValue : 0 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 0 },
55+ {name : "ApplyZero" , tfFuncToRun : terraform .InitAndApplyContext , cntValue : 0 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 0 },
56+ {name : "PlanAddResouce" , tfFuncToRun : terraform .InitAndPlanContext , cntValue : 2 , expectedAdd : 2 , expectedChange : 0 , expectedDestroy : 0 },
57+ {name : "ApplyAddResouce" , tfFuncToRun : terraform .InitAndApplyContext , cntValue : 2 , expectedAdd : 2 , expectedChange : 0 , expectedDestroy : 0 },
58+ {name : "PlanNoOp" , tfFuncToRun : terraform .InitAndApplyContext , cntValue : 2 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 0 },
59+ {name : "ApplyNoOp" , tfFuncToRun : terraform .InitAndApplyContext , cntValue : 2 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 0 },
60+ {name : "PlanDestroyResource" , tfFuncToRun : terraform .InitAndPlanContext , cntValue : 1 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 1 },
61+ {name : "ApplyDestroyResource" , tfFuncToRun : terraform .InitAndApplyContext , cntValue : 1 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 1 },
62+ {name : "Destroy" , tfFuncToRun : terraform .DestroyContext , cntValue : 1 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 1 },
63+ {name : "DestroyNoOp" , tfFuncToRun : terraform .DestroyContext , cntValue : 1 , expectedAdd : 0 , expectedChange : 0 , expectedDestroy : 0 },
6464 }
6565
6666 testFolder , err := files .CopyTerraformFolderToTemp ("../../test/fixtures/terraform-basic-configuration" , t .Name ())
@@ -78,7 +78,7 @@ func runTestGetResourceCountE(t *testing.T, noColor bool) { //nolint:tparallel /
7878 t .Run (tc .name ,
7979 func (t * testing.T ) {
8080 terraformOptions .Vars ["cnt" ] = tc .cntValue
81- cnt , err := terraform .GetResourceCountE (t , tc .tfFuncToRun (t , terraformOptions ))
81+ cnt , err := terraform .GetResourceCountE (t , tc .tfFuncToRun (t , context . Background (), terraformOptions ))
8282 require .NoError (t , err )
8383 assert .Equal (t , tc .expectedAdd , cnt .Add )
8484 assert .Equal (t , tc .expectedChange , cnt .Change )
0 commit comments