DEV Community

Abhilash Kumar Bhattaram for Nabhaas Cloud Consulting

Posted on • Updated on

The ocidtab !!!

{ Abhilash Kumar Bhattaram : Follow on LinkedIn }

ocidtab is a utility I had created to ensure OCI scripting is
made easier , I have a complete description of the usage and the need of OCIDTAB for OCI CLI in this article below

https://blog.pythian.com/the-ocidtab-a-solution-to-make-oci-cli-scripting-easier/

Made some improvements and the complete source code is available here
https://github.com/abhilash-8/ocidenv

Below is a brief readme section of the ocidtab

ocidenv

ocidenv is a script that will generate a ocidtab file , the generated ocidtab file can be used to source the required OCID Environment Variables

ocidenv prerequisites

The following prerequisites are needed to use the ocidenv

OCI Config Path
OCI Profile
OCI Compartment
OCI VCN Name
jq to be installed in Linux

$ sudo yum install jq
Enter fullscreen mode Exit fullscreen mode

The OCI User in the profile will need to have the required IAM Policies for OCI Services to generate the OCID

ocidenv syntax to generate ocidtab

$ . ./ocidenv.sh <config_file_path> <oci_profile> <compartment_name> <vcn_name> && env | grep OCID
Enter fullscreen mode Exit fullscreen mode

ocidtab usage

The ocidenv.sh output will generate ocidtab files

for e.g. $ . ./ocidenv.sh ~/.oci/config DEV-PROFLE1 DEV-COMP1 DEV-VCN1 && env | grep OCID

This command will generate a ocidtab file ~/.DEV-PROFLE1-ocidtab which can be sourced as Environment Variable files or shell scripts

$ . .DEV-PROFLE1-ocidtab

$ oci iam region-subscription list --all --output table --profile $CONFIG_PROFILE

$ oci iam availability-domain list -c $TENANCY_OCID --output table --profile $CONFIG_PROFILE

Enter fullscreen mode Exit fullscreen mode

In the above ehe $CONFIG_PROFILE and $TENANCY_OCID variable will be sourced from the ocidtab file .DEV-PROFLE1-ocidtab

NOTE

The ocidenv script comes with absolutely no gurantee , due diligence is needed for setting up the required ocidtab environment files.

Top comments (0)