Pulumi OCI Provider
raw JSON → 4.10.0 verified Sat May 09 auth: no python
A Pulumi package for creating and managing Oracle Cloud Infrastructure (OCI) resources. Version 4.10.0 is the latest, released on an irregular cadence aligned with the upstream Terraform provider bridge updates.
pip install pulumi-oci Common errors
error ModuleNotFoundError: No module named 'oci' ↓
cause Attempted to import the wrong package; the correct package is 'pulumi_oci'.
fix
Install the correct package: pip install pulumi-oci, then import as import pulumi_oci as oci.
error pulumi_oci.exceptions.InvalidCredentialsError ↓
cause The provider could not authenticate with OCI due to missing or incorrect credentials in configuration.
fix
Ensure you have set the required configuration values: userOcid, fingerprint, privateKey, tenancyOcid, region. Use 'pulumi config set' or a Provider resource.
Warnings
gotcha Import using 'import pulumi_oci as oci' or 'from pulumi_oci import ...'. The plain 'oci' package is Oracle's official SDK, not the Pulumi provider. ↓
fix Always use 'pulumi_oci' as the import name.
deprecated Older versions (pre-4.0) used a different resource module structure. Resources may have moved or been renamed. ↓
fix Check the provider documentation for the correct resource paths, e.g., 'oci_core_vcn' became 'oci.core.Vcn'.
gotcha The provider requires explicit configuration via Pulumi config or a Provider resource. Environment variables are not automatically read. ↓
fix Set config values via 'pulumi config set' or instantiate a 'pulumi_oci.Provider' resource with required arguments.
Imports
- oci wrong
import ocicorrectimport pulumi_oci as oci - Identity wrong
from oci import Identitycorrectfrom pulumi_oci import Identity
Quickstart
import pulumi
import pulumi_oci as oci
config = pulumi.Config()
user_ocid = config.require('userOcid')
fingerprint = config.require('fingerprint')
private_key = config.require_secret('privateKey')
tenancy_ocid = config.require('tenancyOcid')
region = config.require('region')
provider = oci.Provider('oci-provider',
user_ocid=user_ocid,
fingerprint=fingerprint,
private_key=private_key,
tenancy_ocid=tenancy_ocid,
region=region
)
vcn = oci.core.Vcn('my-vcn',
cidr_blocks=['10.0.0.0/16'],
compartment_id=config.require('compartmentOcid'),
opts=pulumi.ResourceOptions(provider=provider)
)
pulumi.export('vcn_id', vcn.id)