Installing the Provider

To use the Oracle Cloud Infrastructure (OCI) Terraform provider, you must install both Terraform and the OCI Terraform provider. You can install both Terraform and the OCI Terraform provider with yum, or directly download them from HashiCorp.

Government Cloud customers should follow the installation and configuration steps in Enabling FIPS Compatibility.

Tip

Oracle Cloud Development Kit: You can use Resource Manager to preinstall the Oracle Cloud Development Kit on a Compute instance in your compartment. The Oracle Cloud Development Kit includes Terraform and the OCI Terraform provider, and preconfigures the required authorization.

Oracle Linux Cloud Developer image: The Terraform provider is pre-installed on the Oracle Linux Cloud Developer platform image. For more information, see Oracle Linux Cloud Developer.

After downloading and installing, you must configure the Terraform provider so that Terraform can interact with OCI resources.

Prerequisites for Installing and Using the Provider

  • An Oracle Cloud Infrastructure (OCI) account that has user credentials sufficient to execute a Terraform plan.
  • A user in that account.
  • Required keys and OCI IDs (OCIDs). For guidance, see Required Keys and OCIDs.
  • The correct Terraform binary file for your operating system. We recommend using Terraform version 0.12.20 or greater.

Installing from HashiCorp

Terraform and the OCI Terraform provider can be downloaded directly from HashiCorp.

Download and Install Terraform

Terraform is available for direct download from the HashiCorp download page. Ensure that you download the correct binary file for your system.

Download and Install the Provider

To use the latest version of the OCI Terraform provider, run terraform init from the directory that contains a configuration file with the provider "oci" { ... configuration block. The provider is automatically downloaded. Terraform configurations also allow you to specify a particular version of the OCI Terraform provider.

You can also download the Terraform provider directly to a location of your choice.

Installing with Yum

If you're running Oracle Linux 7 or Oracle Linux 8, you can use yum to install Terraform and the OCI Terraform provider from the Oracle public yum server.

  1. Enable the Oracle Linux developer repository, using one of the following commands, depending on your Oracle Linux version:

    sudo yum-config-manager --enable ol7_developer
    sudo yum-config-manager --enable ol8_developer
  2. After enabling the repository, use yum to install Terraform:

    sudo yum install terraform
  3. After installing Terraform, install the OCI Terraform provider by running the following yum command from an Oracle Linux machine:
    sudo yum install terraform-provider-oci

Test the Terraform Installation

Open a terminal window and run the following command to test your installation:

terraform -v