Skip to content

OCI

The OCI plugin enables formae to manage Oracle Cloud Infrastructure resources.

Configuration

Target

Configure an OCI target in your Forma file:

import "@formae/formae.pkl"
import "@oci/oci.pkl"

target: formae.Target = new formae.Target {
    label = "oci-target"
    config = new oci.Config {
        region = "us-ashburn-1"
        profile = "DEFAULT"  // Optional: profile from ~/.oci/config
    }
}

Credentials

The plugin uses the OCI SDK's default config provider which tries the following methods in order:

Config File (~/.oci/config):

[DEFAULT]
user=ocid1.user.oc1..aaaaaaaexample
fingerprint=12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef
tenancy=ocid1.tenancy.oc1..aaaaaaaexample
region=us-ashburn-1
key_file=~/.oci/oci_api_key.pem

Environment Variables:

export OCI_CLI_USER="ocid1.user.oc1..aaaaaaaexample"
export OCI_CLI_TENANCY="ocid1.tenancy.oc1..aaaaaaaexample"
export OCI_CLI_FINGERPRINT="12:34:56:78:90:ab:cd:ef:12:34:56:78:90:ab:cd:ef"
export OCI_CLI_KEY_FILE="~/.oci/oci_api_key.pem"
export OCI_CLI_REGION="us-ashburn-1"

Instance Principal (on OCI Compute): When running on OCI compute instances, credentials are automatically retrieved from the instance metadata service.

Examples

Examples are bundled with formae at /opt/pel/formae/examples/formae-plugin-oci/.

Before running any example, resolve the Pkl dependencies:

pkl project resolve /opt/pel/formae/examples/formae-plugin-oci

Note: Update vars.pkl with your compartment ID and region before running the examples.

Available examples:

Example Description
lifeline VCN networking infrastructure with subnets, gateways, and security
oke OKE Kubernetes cluster with node pools
# Evaluate an example
formae eval /opt/pel/formae/examples/formae-plugin-oci/lifeline/basic_infrastructure.pkl

# Apply resources
formae apply --mode reconcile --watch /opt/pel/formae/examples/formae-plugin-oci/lifeline/basic_infrastructure.pkl

Supported Resources

Type Discoverable Extractable Comment
OCI::ContainerEngine::Cluster
OCI::ContainerEngine::NodePool
OCI::ContainerEngine::VirtualNodePool
OCI::Core::InternetGateway
OCI::Core::NatGateway
OCI::Core::NetworkSecurityGroup
OCI::Core::NetworkSecurityGroupSecurityRule
OCI::Core::RouteTable
OCI::Core::SecurityList
OCI::Core::ServiceGateway
OCI::Core::Subnet
OCI::Core::VCN
OCI::Identity::Compartment
OCI::ObjectStorage::Bucket