github.com/kevinklinger/open_terraform@v1.3.6/noninternal/cloud/e2e/migrate_state_tfc_to_other_test.go (about)

     1  package main
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func Test_migrate_tfc_to_other(t *testing.T) {
     8  	t.Parallel()
     9  	skipIfMissingEnvVar(t)
    10  
    11  	cases := testCases{
    12  		"migrate from cloud to local backend": {
    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"},
    23  							expectedCmdOutput: `Terraform Cloud has been successfully initialized!`,
    24  						},
    25  					},
    26  				},
    27  				{
    28  					prep: func(t *testing.T, orgName, dir string) {
    29  						tfBlock := terraformConfigLocalBackend()
    30  						writeMainTF(t, tfBlock, dir)
    31  					},
    32  					commands: []tfCommand{
    33  						{
    34  							command:           []string{"init"},
    35  							expectedCmdOutput: `Migrating state from Terraform Cloud to another backend is not yet implemented.`,
    36  							expectError:       true,
    37  						},
    38  					},
    39  				},
    40  			},
    41  		},
    42  	}
    43  
    44  	testRunner(t, cases, 1)
    45  }