OCI ‐ Terraform: Creating an Instance - pavankumarchittajallu/OCI_DOC GitHub Wiki

Steps to create an Instance using terraform

Step 1: Initiate a Resource Plan

Open the code editor in OCI and create a file within a folder named 'terraform'.

create a file named import.tf

Add the script in the import.tf file.

import { to = oci_core_instance.testinstance id = "ocid1.instance.oc1.iad.anuwcljtgnxa3myc3d6ixwoyfzihsxkzwf6gghvblcwfb3rvggwyzxsk2n4a" }

Next, Right click on import.tf file and select open in integrated terminal.

Run terraform init command to initialize Terraform configuration file.

we notice that Terraform is initialized now

Now, Run command terraform plan --generate-config-out=generated.tf that creates an execution plan and it saves the resulting configuration of the plan into a new file called generated.tf.