@@ -51,9 +51,8 @@ func TestThreeBasic(t *testing.T) {
5151 sshAgent := ssh .SshAgentWithKeyPair (t , keyPair .KeyPair )
5252 t .Logf ("Key %s created and added to agent" , keyPair .Name )
5353
54- var tfOptions []* terraform.Options
5554 backendTerraformOptions , err := util .CreateObjectStorageBackend (t , testDir , id , owner , region )
56- tfOptions = append ( tfOptions , backendTerraformOptions )
55+ tfOptions := [] * terraform. Options { backendTerraformOptions }
5756 if err != nil {
5857 t .Log ("Test failed, tearing down..." )
5958 util .Teardown (t , testDir , exampleDir , tfOptions , keyPair , sshAgent )
@@ -93,29 +92,25 @@ func TestThreeBasic(t *testing.T) {
9392 },
9493 // Environment variables to set when running Terraform
9594 EnvVars : map [string ]string {
96- "AWS_DEFAULT_REGION" : region ,
97- "AWS_REGION" : region ,
98- "TF_DATA_DIR" : testDir ,
99- "TF_IN_AUTOMATION" : "1" ,
100- "TF_CLI_ARGS_init" : "-backend-config=\" bucket=" + strings .ToLower (id ) + "\" " ,
101- "TF_CLI_ARGS_plan" : "-no-color" ,
102- "TF_CLI_ARGS_apply" : "-no-color" ,
103- "TF_CLI_ARGS_destroy" : "-no-color" ,
104- "TF_CLI_ARGS_output" : "-no-color" ,
95+ "AWS_DEFAULT_REGION" : region ,
96+ "AWS_REGION" : region ,
97+ "TF_DATA_DIR" : testDir ,
98+ "TF_IN_AUTOMATION" : "1" ,
99+ "TF_CLI_ARGS_init" : "-backend-config=\" bucket=" + strings .ToLower (id ) + "\" " ,
105100 },
106101 RetryableTerraformErrors : util .GetRetryableTerraformErrors (),
107102 NoColor : true ,
108103 SshAgent : sshAgent ,
104+ Reconfigure : true ,
109105 Upgrade : true ,
110106 })
111107 // we need to prepend the main options because we need to destroy it before the backend
112- tfOptions = append ([]* terraform.Options {terraformOptions }, tfOptions ... )
113- t .Logf ("tfOptions: %v" , tfOptions )
108+ newTfOptions := []* terraform.Options {terraformOptions , backendTerraformOptions }
114109 _ , err = terraform .InitAndApplyE (t , terraformOptions )
115110 if err != nil {
116111 t .Log ("Test failed, tearing down..." )
117112 util .GetErrorLogs (t , testDir + "/kubeconfig" )
118- util .Teardown (t , testDir , exampleDir , tfOptions , keyPair , sshAgent )
113+ util .Teardown (t , testDir , exampleDir , newTfOptions , keyPair , sshAgent )
119114 t .Fatalf ("Error creating cluster: %s" , err )
120115 }
121116 util .CheckReady (t , testDir + "/kubeconfig" )
@@ -125,5 +120,5 @@ func TestThreeBasic(t *testing.T) {
125120 } else {
126121 t .Log ("Test passed..." )
127122 }
128- util .Teardown (t , testDir , exampleDir , tfOptions , keyPair , sshAgent )
123+ util .Teardown (t , testDir , exampleDir , newTfOptions , keyPair , sshAgent )
129124}
0 commit comments