You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I need help to resolve this error which I'm getting while working to build a flow on top of python_terraform APIs:
Running apply in the remote backend. Output will stream here. Pressing Ctrl-C will cancel the remote apply if it's still pending. If the apply started it, will stop streaming the logs, but will not stop the apply running remotely.\n\nPreparing the remote apply...\n\nTo view this run in a browser, visit:\nhttps://app.terraform.io/app/xxxxx/xxxxx/runs/run-xxxxxxx\n\nWaiting for the plan to start...\n\nTerraform v1.0.11\non linux_amd64\n\n------------ Terraform Cloud System Message ------------\n\nTerraform Cloud detected a terraform.tfstate file in your working\ndirectory: ./terraform.tfstate\n\nThe presence of this file causes a state migration error which prevents\nTerraform from running successfully. To fix this error please migrate\nyour local terraform.tfstate to Terraform Cloud and make sure the\nthe file is deleted.\n\nFor step by step instructions on how to migrate your terraform.tfstate\nfile from Terraform Open Source to Terraform Cloud, please see:\n\n https://www.terraform.io/docs/enterprise/migrate/index.html\n\n--------------------------------------------------------\n\nSetup failed: Terraform Cloud detected a terraform.tfstate file
I'm not able to understand how to migrate the state using python terraform APIs. I'm trying to setup an automated workflow to deploy TF based infra. Here's my code flow at a high level with relevant steps:
# base_dir = directory where the config files are present
createAutoTfVarsFile() # create a new terraform.auto.tfvars.json based on what is required
tf = Terraform(working_dir=base_dir, terraform_bin_path=TERRAFORM_PATH)
tf.init(backend_config={'token': tf_token}) --- This step creates the terraform.tfstate file locally
tf.create_workspace(workspace='newworkspace')
tf.set_workspace(workspace='newworkspace')
return_code, stdout, stderr = tf.apply(skip_plan=True, parallelism=10) --- I'm getting the above error at this step
I see that there is some migrate-state option that we can provide, but I'm not able to understand how to supply that during terraform.init (in python_terraform). Please let me know what I'm missing. Thanks.
The text was updated successfully, but these errors were encountered:
Hello, I need help to resolve this error which I'm getting while working to build a flow on top of python_terraform APIs:
Running apply in the remote backend. Output will stream here. Pressing Ctrl-C will cancel the remote apply if it's still pending. If the apply started it, will stop streaming the logs, but will not stop the apply running remotely.\n\nPreparing the remote apply...\n\nTo view this run in a browser, visit:\nhttps://app.terraform.io/app/xxxxx/xxxxx/runs/run-xxxxxxx\n\nWaiting for the plan to start...\n\nTerraform v1.0.11\non linux_amd64\n\n------------ Terraform Cloud System Message ------------\n\nTerraform Cloud detected a terraform.tfstate file in your working\ndirectory: ./terraform.tfstate\n\nThe presence of this file causes a state migration error which prevents\nTerraform from running successfully. To fix this error please migrate\nyour local terraform.tfstate to Terraform Cloud and make sure the\nthe file is deleted.\n\nFor step by step instructions on how to migrate your terraform.tfstate\nfile from Terraform Open Source to Terraform Cloud, please see:\n\n https://www.terraform.io/docs/enterprise/migrate/index.html\n\n--------------------------------------------------------\n\nSetup failed: Terraform Cloud detected a terraform.tfstate file
I'm not able to understand how to migrate the state using python terraform APIs. I'm trying to setup an automated workflow to deploy TF based infra. Here's my code flow at a high level with relevant steps:
Setup:
globals.tf
Code flow:
I see that there is some migrate-state option that we can provide, but I'm not able to understand how to supply that during terraform.init (in python_terraform). Please let me know what I'm missing. Thanks.
The text was updated successfully, but these errors were encountered: