github.com/graywolf-at-work-2/terraform-vendor@v1.4.5/internal/cloud/e2e/apply_no_input_flag_test.go (about) 1 package main 2 3 import ( 4 "testing" 5 ) 6 7 func Test_apply_no_input_flag(t *testing.T) { 8 t.Parallel() 9 skipIfMissingEnvVar(t) 10 11 cases := testCases{ 12 "terraform apply with -input=false": { 13 operations: []operationSets{ 14 { 15 prep: func(t *testing.T, orgName, dir string) { 16 wsName := "new-workspace" 17 tfBlock := terraformConfigCloudBackendName(orgName, wsName) 18 writeMainTF(t, tfBlock, dir) 19 }, 20 commands: []tfCommand{ 21 { 22 command: []string{"init", "-input=false"}, 23 expectedCmdOutput: `Terraform Cloud has been successfully initialized`, 24 }, 25 { 26 command: []string{"apply", "-input=false"}, 27 expectedCmdOutput: `Cannot confirm apply due to -input=false. Please handle run confirmation in the UI.`, 28 expectError: true, 29 }, 30 }, 31 }, 32 }, 33 }, 34 "terraform apply with auto approve and -input=false": { 35 operations: []operationSets{ 36 { 37 prep: func(t *testing.T, orgName, dir string) { 38 wsName := "cloud-workspace" 39 tfBlock := terraformConfigCloudBackendName(orgName, wsName) 40 writeMainTF(t, tfBlock, dir) 41 }, 42 commands: []tfCommand{ 43 { 44 command: []string{"init", "-input=false"}, 45 expectedCmdOutput: `Terraform Cloud has been successfully initialized`, 46 }, 47 { 48 command: []string{"apply", "-auto-approve", "-input=false"}, 49 expectedCmdOutput: `Apply complete!`, 50 }, 51 }, 52 }, 53 }, 54 }, 55 } 56 57 testRunner(t, cases, 1) 58 }