Prebuilt oci Provider for Terraform CDK (cdktf)
Project description
CDKTF Provider for Oracle Cloud Infrastructure (OCI)
This repository contains prebuilt Terraform OCI Provider bindings for CDK for Terraform (CDKTF).
About
The cdktf-provider-oci package provides TypeScript/JavaScript and Python bindings for the Oracle Cloud Infrastructure Terraform Provider, enabling you to manage OCI resources using CDKTF with type safety and IDE support.
Features
- Complete OCI Coverage: Access to all OCI resources and data sources available in the Terraform OCI Provider
- Type Safety: Full TypeScript/Python type definitions for all resources
- IDE Support: IntelliSense and autocomplete for resource properties
- CDKTF Integration: Seamlessly works with CDK for Terraform constructs and workflows
Prerequisites
Before using this provider, ensure you have:
- OCI Account: An active Oracle Cloud Infrastructure account
- OCI CLI Configuration: Properly configured OCI CLI with credentials (
~/.oci/config) - Node.js/Python: Node.js 20.x+ for TypeScript/JavaScript or Python 3.8+ for Python
- Terraform: Terraform v1.0+ installed
- CDKTF CLI: Install with
npm install -g cdktf-cli
Available Packages
npm
Published from this repository at https://www.npmjs.com/package/cdktf-provider-oci (owner: sureshveeragoni).
npm install cdktf-provider-oci
PyPI
Published at https://pypi.org/project/cdktf-provider-oci (owner: sureshveeragoni).
pip install cdktf-provider-oci
Configuration
Authentication
The OCI provider supports multiple authentication methods:
1. API Key Authentication (Default)
new OciProvider(this, 'oci', {
region: 'us-ashburn-1',
// Uses ~/.oci/config by default
});
2. Instance Principal Authentication
new OciProvider(this, 'oci', {
region: 'us-ashburn-1',
auth: 'InstancePrincipal',
});
3. Resource Principal Authentication
new OciProvider(this, 'oci', {
region: 'us-ashburn-1',
auth: 'ResourcePrincipal',
});
Usage
TypeScript
import { App, TerraformStack } from 'cdktf';
import { Construct } from 'constructs';
import { OciProvider } from 'cdktf-provider-oci/lib/provider';
import { CoreInstance } from 'cdktf-provider-oci/lib/core-instance';
class MyStack extends TerraformStack {
constructor(scope: Construct, id: string) {
super(scope, id);
new OciProvider(this, 'oci', {
region: 'us-ashburn-1',
});
new CoreInstance(this, 'example', {
compartmentId: 'ocid1.compartment.oc1..exampleuniqueID',
availabilityDomain: 'kIdk:US-ASHBURN-AD-1',
shape: 'VM.Standard.E4.Flex',
sourceDetails: {
sourceType: 'image',
imageId: 'ocid1.image.oc1..exampleuniqueID',
},
createVnicDetails: {
subnetId: 'ocid1.subnet.oc1..exampleuniqueID',
},
});
}
}
const app = new App();
new MyStack(app, 'oci-example');
app.synth();
Install dependencies with npm install cdktf cdktf-provider-oci constructs before synthesizing.
Python
from constructs import Construct
from cdktf import App, TerraformStack
from cdktf_provider_oci.provider import OciProvider
from cdktf_provider_oci.core_instance import CoreInstance
class MyStack(TerraformStack):
def __init__(self, scope: Construct, construct_id: str) -> None:
super().__init__(scope, construct_id)
OciProvider(self, "oci", region="us-ashburn-1")
CoreInstance(self, "example",
compartment_id="ocid1.compartment.oc1..exampleuniqueID",
availability_domain="kIdk:US-ASHBURN-AD-1",
shape="VM.Standard.E4.Flex",
source_details={
"source_type": "image",
"image_id": "ocid1.image.oc1..exampleuniqueID",
},
create_vnic_details={
"subnet_id": "ocid1.subnet.oc1..exampleuniqueID",
},
)
app = App()
MyStack(app, "oci-example")
app.synth()
Install dependencies with pip install cdktf cdktf-provider-oci constructs before synthesizing.
Complete Example Project
For a complete working example of using this provider, check out the cdktf-oci-example repository, which demonstrates:
- Setting up a VCN (Virtual Cloud Network)
- Creating compute instances
- Configuring security lists and route tables
- Managing storage resources
- And more OCI resource configurations
Quick Start with Example Project
# Clone the example repository
git clone https://github.com/veeragoni/cdktf-oci-example.git
cd cdktf-oci-example
# Install dependencies
npm install
# Deploy to OCI
cdktf deploy
Documentation
Provider Documentation
CDKTF Documentation
API Reference
Auto-generated API documentation for this provider is available in the docs folder of this repository:
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the Apache-2.0 License.
Support
- For issues with this provider package, please open an issue in this repository
- For OCI-specific issues, refer to Oracle Cloud Infrastructure Support
- For CDKTF issues, see CDKTF GitHub
Versioning
This project is explicitly not tracking the Terraform oci provider version 1:1. In fact, it always tracks latest of ~> 7.19.0 with every release. If there are scenarios where you explicitly have to pin your provider version, you can do so by generating the provider constructs manually.
These are the upstream dependencies:
If there are breaking changes (backward incompatible) in any of the above, the major version of this project will be bumped.
Provider Version
The provider version can be adjusted in ./.projenrc.js.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cdktf_provider_oci-1.1.2.tar.gz.
File metadata
- Download URL: cdktf_provider_oci-1.1.2.tar.gz
- Upload date:
- Size: 79.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ab8ad61d03ac4e9fa684c4c3564e870ec194ed78f1d5f2e529432f433f213f1
|
|
| MD5 |
aa39625fc3daa7bbd33a4c316c01590a
|
|
| BLAKE2b-256 |
6e17bd8fb951d7761c0c3574514f53162828a08ae4d8335644bec0206ea2b19b
|
File details
Details for the file cdktf_provider_oci-1.1.2-py3-none-any.whl.
File metadata
- Download URL: cdktf_provider_oci-1.1.2-py3-none-any.whl
- Upload date:
- Size: 80.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a477f5f8811756b270f20f3aca0cad1b00a911c49329342bfeba5766755b0a38
|
|
| MD5 |
1527a1613bf9ccb10c581ac59becb104
|
|
| BLAKE2b-256 |
d6896622c7839678f97dad77181a110ed4dd7a72d7e2f38b46d0fba5ddfee012
|