Creating an Import Job
Create an import job in Resource Manager to import state files for existing resources already managed by Terraform. An import job sets the provided Terraform state file as the current state of the stack.
For example, use an import job to migrate a local Terraform environment to Resource Manager.
The import job is created. The new job is listed under Jobs.
Use the
oci resource-manager job create-import-tf-state-job
command and required parameters to run an import job.oci resource-manager job create-import-tf-state-job --stack-id <stack_OCID> --tf-state-file <job_details>
For a complete list of parameters and values for CLI commands, see the Command Line Reference for Resource Manager.
Use the CreateJob operation to create an import job.
For an example of the
operation
part of the request, see CreateImportTfStateJobOperationDetails.
What's Next
After running an import job, get the job's details to check its status. You can optionally view the Terraform state file and view the logs.
Monitor the job status (lifecycle state) by getting the job's details. Succeeded (SUCCEEDED
) indicates that the job has completed. Depending on the complexity of the job, the operation can take some time. While the job runs, or after it finishes, you can get the job logs content.
To view the Terraform state file (shows the state of your resources after running the job), select the name of the job to display the Job details page, then select View state under Resources. Optionally select Show changes in this version.
To view the logs for the job, select the job to open its details page, then select Logs under Resources.