Terraform is an infrastructure as code tool that lets you provision and manage cloud infrastructure. Terraform provides plugins called providers that let you interact with cloud providers and other APIs. You can use the Terraform provider for Google Cloud to provision and manage Google Cloud resources, including Oracle Database@Google Cloud.
This page introduces you to using Terraform with Oracle Database@Google Cloud, including an introduction to how Terraform works and some resources to help you get started using Terraform with Google Cloud. You'll also find links to Terraform reference docs for Oracle Database@Google Cloud, code examples, and guides for using Terraform to provision Oracle Database@Google Cloud resources.
How Terraform works
Terraform has a declarative and configuration-oriented syntax, which you can use to describe the infrastructure that you want to provision in your Google Cloud project. After you author this configuration in one or more Terraform configuration files, you can use the Terraform CLI to apply this configuration to your Oracle Database@Google Cloud resources.
The following steps explain how Terraform works:
You describe the infrastructure you want to provision in a Terraform configuration file. You don't need to write code describing how to provision the infrastructure. Terraform provisions the infrastructure for you.
You run the
terraform plan
command, which evaluates your configuration and generates an execution plan
Terraform uses this file to keep a record of the most recent state of your infrastructure, and to determine when to create, update, and destroy resources.
When you run
terraform apply
, Terraform uses the mapping in the state file to compare the existing infrastructure to the code, and make updates as necessary:
If a resource object is defined in the configuration file, but doesn't exist in the state file, Terraform creates it.
If a resource object exists in the state file, but has a different configuration from your configuration file, Terraform updates the resource to match your configuration file.
If a resource object in the state file matches your configuration file, Terraform leaves the resource unchanged.
Terraform resources for Oracle Database@Google Cloud
Resources are the fundamental elements in the Terraform language
Terraform with Oracle Cloud Infrastructure
Note:
This tutorial requires access to Oracle Cloud. To sign up for a free account, see Get started with Oracle Cloud Infrastructure Free Tier.
It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
Get Started with Terraform in Oracle Cloud Infrastructure
Introduction
Terraform is an Infrastructure as Code (IaC) tool developed by Hashicorp that allows you to define, provision, and manage your infrastructure across multiple cloud providers using the Terraform language syntax, HCL. Terraform enables you to automate the entire lifecycle of your cloud infrastructure, making it easy to build, update, and scale resources in a consistent and reproducible manner. Terraform is widely used by DevOps teams to manage cloud resources, improve infrastructure efficiency, reduce manual errors and version control cloud resources.
This tutorial helps you to start your journey into leveraging IaC for deploying and managing your cloud infrastructure.
Terraform Architecture Workflow
Objectives
Install, configure and use Terraform in Oracle Cloud Infrastructure (OCI) for MacOS and Windows
The tutorial covers the practical workflow for working with OCI using Terraform. The core workflow is authentication, configuration authoring, validation, planning, applying, and change management.
Step by Step OCI Tutorials with Terraform
Build, change, and destroy a virtual cloud network and subnet on Oracle Cloud Infrastructure (OCI) using Terraform. Step-by-step, command-line tutorials will walk you through the Terraform basics for the first time.
Learn how infrastructure as code lets you safely build, change, and manage infrastructure. Try Terraform.
Install Terraform
Install Terraform on Mac, Linux, or Windows by downloading the binary or using a package manager (Homebrew or Chocolatey). Then create a Docker container locally by following a quick-start tutorial to check that Terraform installed correctly.
The installation step is presented as a video
7min
Build infrastructure
Authenticate to Oracle Cloud Infrastructure, and create a Virtual Cloud Network. Write, format and validate a Terraform configuration. Plan and apply the configuration to create an VCN OCI resource.
This section is presented as a video
13min
Change infrastructure
Add a subnet to your Oracle Cloud Infrastructure (OCI) VCN. Modify the subnet display name and plan changes to update the resource in place. Learn Terraform handles infrastructure change management.
This section is presented as a video
6min
Destroy infrastructure
Destroy the Oracle Cloud Infrastructure (OCI) Virtual Cloud Network (VCN) and subnet you created in the previous tutorials. Evaluate the plan and confirm the destruction.
This section is presented as a video
5min
Define input variables
Declare your OCI region and compartment ID as variables. Reference the variable in Terraform configuration
This section is presented as a video
6min
The sequence demonstrates how Terraform supports the full lifecycle of an OCI network resource, from creation through modification to safe destruction.
Oracle Terraform Modules and Projects
Terraform projects for Oracle Cloud Infrastructure (OCI), developed and maintained by Oracle and the OCI community.
The following organizations maintain Terraform related projects:
- Oracle – our primary GitHub organization
- Fn Project – the container native, cloud agnostic serverless platform
- GraalVM - projects related to GraalVM, a high-performance JDK with native compilation
- Helidon – cloud-native set of Java libraries for writing microservices
- Java Community Process – developing standard technical specifications for Java technology
- LiveLabs – workshops for building and deploying applications using Oracle's technologies
- MySQL – the world's most popular open source database
- OCI Landing Zones – landing zones for automated deployment of OCI services
- Oracle Cloud Native Environment - fully integrated suite for the development and management of cloud-native applications
- OpenJDK – OpenJDK development and related repositories
- Oracle DevRel – developer code samples, tutorials, and more
- Oracle GitHub Actions – GitHub Actions from Oracle
- Oracle Sample Projects – new projects and sample applications
- Oracle Terraform Modules – Terraform modules for provisioning Oracle Cloud Infrastructure resources
- Quick Start – automated deployments of enterprise software on Oracle Cloud Infrastructure
- VirtualBox - Oracle's virtualization software running on many operating systems using AMD/Intel/ARM processors
The Oracle Terraform Modules repository provides Terraform modules for provisioning Oracle Cloud Infrastructure resources.
Terraform with Oracle Database@AWS
Provision Oracle Database@AWS resources using Terraform
In this post, we show you how to provision key components of the Oracle Database@AWS offering, including the ODB network, Oracle Exadata infrastructure, Exadata VM clusters and Autonomous VM clusters using Terraform.
Oracle Database@AWS (ODB@AWS) delivers Oracle Exadata infrastructure, managed by Oracle Cloud Infrastructure (OCI), from within AWS data centers. With Oracle Database@AWS, you can migrate Oracle databases to AWS while benefiting from the high performance, scalability, and advanced capabilities of Exadata. Oracle Database@AWS offers deep integration with native AWS services, including Amazon Simple Storage Service (Amazon S3), zero-ETL pipelines, and AWS Key Management Service (AWS KMS). Oracle databases run alongside applications deployed on Amazon Elastic Compute Cloud (Amazon EC2), Amazon Elastic Container Service (Amazon ECS), Amazon Elastic Kubernetes Service (Amazon EKS), and more. This tight integration simplifies data flows, enhances security, and accelerates application development across diverse compute environments.
Currently, Oracle Database@AWS offers the following Oracle Database services:
- Oracle Autonomous AI Database on Dedicated Exadata Infrastructure (ADB-D).
- Oracle Exadata Database Service on Dedicated Infrastructure (ExaDB-D).
Infrastructure as code (IaC) is the process of provisioning and managing an application’s infrastructure through a set of configuration files
IaC is designed to help you centralize infrastructure management, standardize resources, and scale quickly so that new environments are repeatable, reliable, and consistent. You can deploy the resources in Oracle Database@AWS using IaC tools like Terraform or AWS CloudFormation.
HashiCorp Terraform is an infrastructure as code tool that lets you define both cloud and on-premises resources in human-readable configuration files that you can version, reuse, and share. You can then use a consistent workflow to provision and manage your infrastructure throughout its lifecycle.
This walkthrough is intended for database administrators and DevOps engineers who want to automate Oracle Database@AWS provisioning.
Solution overview
To get started with Oracle Database@AWS, you can view the listing in AWS Marketplace. To use the service, you configure it within your AWS account through a process referred to as onboarding. To begin onboarding, contact your Oracle representative and request a Private Offer. After you agree on pricing, terms and conditions, you complete the purchase through AWS Marketplace. After the purchase is complete, you link your AWS account with an OCI tenancy. This is called multicloud linking. Based on your requirements, you can use the entitlement sharing capability to share the AWS Marketplace entitlements for ODB@AWS across AWS accounts in the same AWS organization
Terraform Core Workflow Comparison
| Phase | Action | Tool / Command |
|---|---|---|
| Describe | Author infrastructure in configuration file | Terraform configuration file |
| Evaluate | Evaluate configuration and generate execution plan | terraform plan |
| Apply | Compare state file and make updates | terraform apply |
| Record | Keep record of most recent state | State file |
| Create | Resource defined in config but not in state | Terraform creates it |
| Update | Resource exists in state but config differs | Terraform updates resource |
| No Change | Resource matches configuration | Terraform leaves resource unchanged |
The same declarative workflow applies to Oracle Database@Google Cloud, Oracle Cloud Infrastructure, and Oracle Database@AWS.
Common Terraform Commands
terraform plan
terraform apply
The commands are used consistently across OCI tutorials for building a Virtual Cloud Network, adding a subnet, modifying a display name, and destroying a VCN and subnet.
Conclusion
Terraform provides a consistent declarative and configuration-oriented syntax for provisioning Oracle resources across multiple cloud environments. With Oracle Database@Google Cloud, the Terraform provider for Google Cloud enables provisioning and management of Oracle Database@Google Cloud resources using Terraform configuration files and the Terraform CLI. The workflow is describe infrastructure, run terraform plan to generate an execution plan, and run terraform apply to create, update, or leave resources unchanged based on the state file comparison.
For Oracle Cloud Infrastructure, Terraform is an Infrastructure as Code tool developed by Hashicorp that allows you to define, provision, and manage infrastructure across multiple cloud providers using HCL. The official tutorials cover installing Terraform on MacOS, Linux, or Windows using binary download or package managers such as Homebrew or Chocolatey, authenticating to OCI, writing, formatting and validating configuration, planning and applying a VCN, changing infrastructure by adding a subnet and modifying display name, destroying VCN and subnet resources, and defining input variables for OCI region and compartment ID.
Oracle maintains Terraform projects for OCI, including Oracle Terraform Modules for provisioning OCI resources, alongside other projects such as OCI Landing Zones, Oracle Cloud Native Environment, LiveLabs, and Quick Start.
For Oracle Database@AWS, Terraform enables provisioning of ODB network, Oracle Exadata infrastructure, Exadata VM clusters and Autonomous VM clusters. Oracle Database@AWS delivers Oracle Exadata infrastructure managed by OCI from within AWS data centers and offers integration with Amazon S3, zero-ETL pipelines, AWS KMS, Amazon EC2, Amazon ECS, and Amazon EKS. Current services include Oracle Autonomous AI Database on Dedicated Exadata Infrastructure (ADB-D) and Oracle Exadata Database Service on Dedicated Infrastructure (ExaDB-D). IaC with Terraform centralizes management, standardizes resources, and enables repeatable reliable consistent environments. Onboarding involves viewing the AWS Marketplace listing, requesting a Private Offer, completing purchase, and linking AWS account with OCI tenancy via multicloud linking, with optional entitlement sharing across AWS organization accounts.