Note
Course of actions involved in Exporting objects from OCI-
- Automation Tool Kit fetches the data for the supported services. You can chose to export the data from a specific region or the compartment. Exported data is written to appropriate sheets of the CD3 Excel Sheet based on the resources being exported.
- Tool Kit then generates the TF configuration files/auto.tfvars files for these exported resources.
- It also generates a shell script - tf_import_commands_
<resource>
_nonGF.sh that has the import commands, to import the state of the resources to tfstate file.(This helps to manage the resources via Terraform in future).
Below are the steps that will help to configure the Automation Tool Kit to support the Non - Green Field Tenancies:
Step 1:
Chose the appropriate CD3 Excel sheet template from Excel Templates
Step 2:
Put CD3 Excel at the appropriate location.
Modify/Review setUpOCI.properties with non_gf_tenancy set to true as shown below:
Step 3:
Execute the SetUpOCI.py script to start exporting the resources to CD3 and creating the terraform configuration files.
Command to Execute:
cd /cd3user/oci_tools/cd3_automation_toolkit/
python setUpOCI.py <path_to_setupOCI.properties> ie
python setUpOCI.py /cd3user/tenancies/<customer_name>/<customer_name>_setUpOCI.properties
→ Example execution of the wrapper script:
Choose the resources by specifying a single option (for choosing one of these resources) or comma-separated values (to choose multiple resources) as shown in the sample screenshot above.
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.
Toolkit will over-write the specific tabs of CD3 Excel sheet with exported data for that resource in OCI while the other tabs remain intact.
Expected Outputs:
a. Excel sheet with the resource details from OCI
b. Terraform Configuration files - *.auto.tfvars
c. Shell Script with import commands - tf_import_commands_<resource>
_nonGF.sh
Action:
Execute the tf_import_commands_<resource>
_nonGF.sh files that are generated in the outdir.
The terraform plan should show that infrastructure is up-to-date with no changes required for all regions.
Note
Once the export (including the execution of tf_import_commands_<resource>
_nonGF.sh) is complete, switch the value of non_gf_tenancy back to false. This allows the Tool Kit to support the tenancy as Green Field from this point onwards.
Follow the below steps to quickly export Identity components from OCI.
-
Use the excel CD3-Blank-template and place it at the location /cd3user/tenancies/<customer_name>/ which is also mapped to your local directory.
-
Edit the setUpOCI.properties at location:/cd3user/tenancies /<customer_name>/<customer_name>_setUpOCI.properties with appropriate values.
- Update the cd3file parameter to specify the CD3 excel sheet path.
- Set the non_gf_tenancy parameter value to true. (for Non Greenfield Workflow.)
-
Change Directory to 'cd3_automation_toolkit' :
cd /cd3user/oci_tools/cd3_automation_toolkit/
and execute the setupOCI.py file:
python setUpOCI.py /cd3user/tenancies/<customer_name>/<customer_name>_setUpOCI.properties
-
Choose option 'Export Identity' from the displayed menu. Once the execution is successful, you will see:
- Filled in tabs-Compartments, Groups, Polecies of Excel sheet
- tf_import_commands_identity_nonGF.sh
- <customer_name>_compartments.auto.tfvars, <customer_name>_groups.auto.tfvars, <customer_name>_policies.auto.tfvars
-
Execute tf_import_commands_identity_nonGF.sh to start importing the identity components into tfstate file.
-
Repeat the above process (except Step 5) to export other components from OCI.