DEV Community

Abhilash Kumar Bhattaram for Nabhaas Cloud Consulting

Posted on • Edited 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/

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

Top comments (0)