Skip to content

Export and Manage Resources from OCI (Non-Greenfield Workflow)

Important

  • Toolkit will over-write the data in specific tabs of CD3 Excel sheet with exported content from OCI while the other tabs remain intact.
  • Differential state import of the objects will be performed, i.e., the import statements will be generated only for the objects not already present in state file.

Step 1:
Choose the Blank CD3 Excel sheet template from Excel Templates.

Step 2:
Login to Jenkins URL with user created after initialization. On the dashboard, a folder with <prefix> name is present. Click on it. It has the corresponding setupoci pipeline and terraform_files folder.

Click on the setupoci pipeline and select Build with Parameters from left side menu.

Screenshot 2024-01-16 at 10 56 42 AM

Note: - Only one user at a time using the Jenkins setup is supported in the current release of the toolkit.

Step 3:
Upload the above chosen Excel sheet in Excel_Template section.

Screenshot 2024-01-16 at 11 04 47 AM

This will copy the Excel file at /cd3user/tenancies/<prefix> inside the container. It will also take backup of existing Excel on the container by appending the current datetime if same filename is uploaded in multiple executions.

Step 4:
Select the workflow as Export Existing Resources from OCI (Non-Greenfield Workflow). Choose single or multiple MainOptions as required and then corresponding SubOptions.
Below screenshot shows export of Network and Compute.

Screenshot 2024-01-17 at 7 11 42 PM

Step 5:
Specify region and compartment from where the data has to be exported. Multiple options can be selected to export from multiple regions/compartments. If resources have to be exported from all regions/compartments, do not select any option from the dropdown.
It also asks for service specific filters like display name patterns for compute. Leave empty if no filter is needed.

Screenshot 2024-01-17 at 7 10 56 PM

Click on Build at the bottom.

Step 6:
setUpOCI pipeline is triggered and stages are executed as shown below:

Screenshot 2024-01-17 at 9 37 22 PM

Expected Output of 'Execute setUpOCI' stage:

  1. Overwrites the specific tabs of Excel sheet with the exported resource details from OCI. Here are the steps to download the exported Excel file.
  2. Generates Configuration files - *.auto.tfvars.
  3. Generates shell scripts with import commands - import_commands_<resource>.sh

Note: The updated Excel sheet is also present at /cd3user/tenancies/<prefix> inside the container.

Expected Output of 'Run Import Commands' stage:

  1. Executes shell scripts with import commands(import_commands_<resource>.sh) generated in the previous stage

Expected Output of terraform/tofu Pipelines:

  1. Respective pipelines will get triggered automatically from setUpOCI pipeline based on the services chosen for export. You could also trigger manually when required.
  2. If 'Run Import Commands' stage was successful (ie.. import_commands_<resource>.sh ran successfully for all services chosen for export), respective pipelines triggered should have 'Plan' stage show as 'No Changes'

Note

  • Make sure to execute Fetch Compartments OCIDs to variables file from CD3 Services in setUpOCI menu at least once. This will ensure that the variables file in outdir is updated with the OCID information of all the compartments.
  • Once the export (including the execution of import_commands_.sh) is complete, switch the value of workflow_type back to create_resources. This allows the toolkit to modify these resources or create new ones on top of them.