How to Configure the Terraform Provider for OCI (Oracle Cloud Infrastructure) with API Key Authentication

Guillermo Musumeci
5 min readJan 2, 2023

The OCI Terraform provider supports four authentication methods:

  • API Key Authentication
  • Instance Principal Authorization
  • Resource Principal Authorization
  • Security Token Authentication

In this story, we will set up the Terraform Provider for OCI (Oracle Cloud Infrastructure) using API Key Authentication.

1. Requirements

This is the list of requirements to configure the OCI Terraform provider:

  • Create a free OCI account at https://www.oracle.com/cloud/free
  • Create an IAM User for Terraform
  • Generate the API Key
  • Get the Tenant Settings
  • Get the Root OCI compartment

2. Configuring the OCI Provider

To be able to authenticate to OCI, we will need all settings listed below:

  • tenancy - our tenancy's OCID
  • region - the OCI region in the Console
  • user - the OCID of the user for whom the key pair is being added

--

--

Guillermo Musumeci

Certified AWS, Azure & GCP Architect | HashiCorp Ambassador | Terraform SME | KopiCloud Founder | ex-AWS | Entrepreneur | Book Author | Husband & Dad of ✌