Oracle Cloud

3 Mins Read

Provisioning Oracle Cloud Infrastructure with Terraform

Voiced by Amazon Polly

Introduction

In today’s fast-paced IT landscape, businesses are increasingly adopting cloud automation to streamline infrastructure deployment and management. Oracle Cloud Infrastructure (OCI), combined with Terraform, empowers organizations to embrace Infrastructure as Code (IaC), enabling faster, consistent, and reliable provisioning of cloud resources.

This blog will walk you through the process of provisioning Oracle Cloud Infrastructure with Terraform, from understanding the key benefits of OCI to setting up and deploying infrastructure resources in a fully automated way.

 

Freedom Month Sale — Upgrade Your Skills, Save Big!

  • Up to 80% OFF AWS Courses
  • Up to 30% OFF Microsoft Certs
Act Fast!

Why Oracle Cloud Infrastructure with Terraform?

Oracle Cloud Infrastructure (OCI) is a next-generation cloud designed to run any workload securely and efficiently. Terraform, developed by HashiCorp, is a leading IaC tool that allows you to define infrastructure in declarative configuration files.

Together, they provide:

  • Automation: No more manual provisioning; everything is managed through reusable
  • Consistency: Reduce human errors and ensure predictable
  • Scalability: Manage small environments and enterprise-grade deployments with the same approach.
  • Cost-effectiveness: Control, monitor, and optimize infrastructure

Key Features and Benefits of Oracle Cloud Infrastructure

  1. High Performance and Scalability

OCI is built on a high-performance backbone with low-latency networking. Elastic scaling ensures resources can scale up or down automatically, guaranteeing optimal performance and cost control.

  1. Comprehensive Security

Multi-layered security with encryption, isolated virtualization, identity management,

and compliance certifications. Advanced monitoring and threat detection mechanisms built into the platform.

 

  1. Cost-Effective Cloud Services

Pay-as-you-go pricing ensures you only pay for what you consume. Built-in cost governance tools for analysing and predicting usage.

  1. Flexibility and Compatibility

Wide support for multiple databases, operating systems, and enterprise applications. Seamless hybrid integration with on-premises environments.

  1. Extensive Service Portfolio

Rich portfolio of services including compute, storage, networking, databases, analytics, machine learning, and more. Designed to integrate smoothly for complete workload management.

 

Common Use Cases of OCI

  1. Enterprise Applications – Running critical workloads like Oracle E-Business Suite, PeopleSoft, and JD Edwards.
  2. Data Management & Analytics – Powering big data, Oracle Autonomous Database, and analytics pipelines.
  3. High-Performance Computing (HPC) – Ideal for financial simulations, engineering workloads, and AI/ML training.
  4. Disaster Recovery & Backup – Cost-effective data protection with strong reliability.
  5. Development & Testing – Developers can rapidly spin up test environments to accelerate delivery.

Prerequisites

Before provisioning OCI resources with Terraform, ensure the following are in place:

  1. Oracle Cloud Infrastructure Account
  2. OCI CLI Installed
    • Install via OCI CLI
  3. Terraform Installed
    • Download from Terraform

 

  1. API Keys Generated
    • Follow OCI API Key
  2. OCI CLI Configured
    • Configure CLI with tenancy OCID, user OCID, fingerprint, and region.

Connecting OCI with Terraform Using API Key Authentication

  1. Generate an API Key Pair

On your local machine:

This creates:

pem → your private key (keep safe!)

pem → your public key

Upload Public Key to Your OCI User Account

Log in to OCI

Open User Settings → API Keys → Add API Key.

Upload pem.

OCI generates a Fingerprint (example: 20:3b:97:13:…:7f).

 

 

  1. Collect Required Information

You now need the following values:

  • Tenancy OCID – Found under Tenancy Details in the
  • User OCID – Found under User Settings.
  • Fingerprint – Shown when you upload your API
  • Region – g., us-ashburn-1.
  • Private Key Path – Path to pem (e.g., ~/.oci/oci_api_key.pem).

 

  1. Verify OCI CLI Works (Optional)
    • Before using Terraform, test authentication via the OCI CLI:

 

  1. Configure Terraform Provider with API Key

 

  1. Create a Resource Using Terraform

 

  1. Run Terraform Commands terraform init

terraform plan terraform apply

 

Conclusion

Provisioning Oracle Cloud Infrastructure with Terraform simplifies cloud management by automating resource creation, ensuring consistency, and reducing operational overhead.

By following the steps in this blog, you’ve seen how to:

  • Set up Terraform for OCI
  • Configure API keys and provider details
  • Create and deploy a VCN using IaC principles

This foundation opens the door to more advanced use cases such as multi-region deployments, complex networking setups, and enterprise-scale automation.

Start small, automate more, and scale with confidence using OCI and Terraform Official References Used:

  1. Oracle Cloud Free Tier
  2. How to Upload the Public Key

https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#three)

  1. Terraform Downloads

https://releases.hashicorp.com/terraform/1.13.1/terraform_1.13.1_linux_amd64.zip

Freedom Month Sale — Discounts That Set You Free!

  • Up to 80% OFF AWS Courses
  • Up to 30% OFF Microsoft Certs
Act Fast!

About CloudThat

CloudThat is an award-winning company and the first in India to offer cloud training and consulting services worldwide. As a Microsoft Solutions Partner, AWS Advanced Tier Training Partner, and Google Cloud Platform Partner, CloudThat has empowered over 850,000 professionals through 600+ cloud certifications winning global recognition for its training excellence including 20 MCT Trainers in Microsoft’s Global Top 100 and an impressive 12 awards in the last 8 years. CloudThat specializes in Cloud Migration, Data Platforms, DevOps, IoT, and cutting-edge technologies like Gen AI & AI/ML. It has delivered over 500 consulting projects for 250+ organizations in 30+ countries as it continues to empower professionals and enterprises to thrive in the digital-first world.

WRITTEN BY Martuj Nadaf

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!