Provisioning OracleDB@GCP ADBS using Terraform - public offer
Share on LinkedIn ↗By Venkata Rachuri · October 29, 2026
In this post, we will provision Oracle Autonomous Database Serverless (ADB-S) in Google Cloud using Terraform.
What we will provision
We will create a Google Cloud VPC with an application subnet for a Compute Engine VM. We will then create an ODB network and select that VPC as its Associated Network. Within the ODB network, we will create a client subnet for Oracle Autonomous Database Serverless (ADB-S).
Google Cloud project: ADBS
│
├─ VPC: adbs-demo-vpc
│ └─ Application subnet: adbs-demo-client
│ └─ Compute VM: adbs-demo-sqlclient
│ └─ SSH forwarding to the private database endpoint
│
└─ ODB network: adbs-demo-odb
Associated VPC: adbs-demo-vpc
└─ ODB client subnet: adbs-demo-db-subnet
└─ ADB-S instance ID: adbs-demo-26ai
Display name: ADBS-26ai
Database name: ADBS26AI
The VM will provide a private connection path to the database. We will use SQL Developer on Windows with the database wallet and a PuTTY tunnel through this VM, then run a query to verify the connection. The application subnet and ODB client subnet will use non-overlapping address ranges.
We will use Terraform to provision the VPC, application subnet, ODB network, ODB client subnet, and ADB-S database.
1. Create the project and check its organization
Sign in to the Google Cloud console with an account that can create projects in your organization. Open Cloud Shell using the terminal icon in the console header. Cloud Shell includes gcloud, so we can create the project before installing any tools on Windows.
Find the organization ID
Run:
gcloud organizations list
Find your organization in the results and copy its numeric ID. Use it in place of YOUR_ORGANIZATION_ID below.
Create ADBS directly under the organization
Choose a globally unique project ID and replace YOUR_PROJECT_ID in the command. The display name will be ADBS; the project ID is permanent.
gcloud projects create YOUR_PROJECT_ID --name="ADBS" --organization=YOUR_ORGANIZATION_ID --set-as-default
The --organization argument places the project directly under the specified organization. --set-as-default selects it for subsequent commands in this Cloud Shell configuration. If the ID is already taken, choose a different ID and repeat the command.
Verify the project and its organization
gcloud projects describe YOUR_PROJECT_ID --format="yaml(projectId,name,parent)"
Confirm that the output contains your project ID, the name ADBS, and a parent with type: organization and the intended organization ID:
name: ADBS
parent:
id: 'YOUR_ORGANIZATION_ID'
type: organization
projectId: YOUR_PROJECT_ID

The screenshot shows the organization-parent verification from our setup. For a new project, use the creation command above to assign the organization at creation time.
Finally, check the selected project:
gcloud config get-value project
It should return YOUR_PROJECT_ID. In the console project selector, select ADBS before continuing to billing and Marketplace. If the organization is unavailable or the create command returns a permission error, ask your administrator to confirm your access and project-creation permissions.
Verify billing before subscribing
Creating the project under an organization does not automatically establish its billing link. Before subscribing to the Oracle offer, check that ADBS is linked to an active billing account.
- In the Google Cloud console, select the ADBS project.
- Open the navigation menu and select Billing.
- If a billing account is already linked, confirm that it is the account you intend to use for the Oracle Marketplace subscription. No additional linking is needed.
- If no account is linked, select Link a billing account, choose the intended active account, and confirm with Set account.
- Return to the project's Billing page and verify that it shows the linked account, as illustrated below.

With billing verified, we can subscribe to Oracle Database through Marketplace using that billing account.
2. Subscribe to Oracle Database through Marketplace
Keep ADBS selected and search Google Cloud Marketplace for Oracle Database@Google Cloud. Open the listing published by Oracle and select Subscribe.
Choose the public pay-as-you-go offer and the billing account linked to ADBS. The pricing page displayed USD 1.00 per Oracle Database@Google Cloud credit. That unit is not a monthly database estimate. Likewise, the order calculator displayed Free when estimated usage was zero; it did not establish that a deployed database would be free.
The order form also warned that most Google Cloud promotional credits do not apply to Marketplace purchases. Estimate compute, storage, and any supporting resources before provisioning, using the applicable service prices and configuration.
Review the terms and submit the order if you agree. Open Marketplace Your orders and wait for the status to become Active. The screenshot below shows the active PAYG order from our demo. We can then continue with Oracle account creation.

3. Create and link the Oracle Cloud account
From the product page, select Manage on Console. Before account linking, the Oracle overview displays:
Connect your Marketplace offer with an Oracle account to start provisioning resources.
For the public PAYG offer, Oracle requires creation of a new OCI account through this onboarding flow. Linking an existing OCI account is an option for private offers, not this public offer.
Select Create Account and complete the requested account details. Choose a home region that supports Database@Google Cloud; Oracle states that the home region cannot be changed after account creation.
After submitting the account details, return to the Oracle overview in Google Cloud. While Oracle creates and links the account, the page displays:
Please wait for your account linking to become active.
Wait until account linking becomes active before applying the Terraform configuration. While this completes, we can download the scripts and review their inputs.

In our demo, the account-creation confirmation email arrived at 10:51 PM on October 27, 2026, approximately six hours after the onboarding request. This is an estimate based on our screenshots, rather than an exact measured duration or a promised activation time.
The email confirmed that the new Oracle Cloud account had been created and the Oracle AI Database@Google Cloud subscription was ready to set up. Select Sign In to access the account, then return to the Google Cloud Oracle overview and refresh it to check that account linking is active before provisioning the database.

Account creation and Google Cloud account linking are separate checkpoints. The confirmation email establishes that the account is ready; the Google Cloud overview establishes whether linking has completed.
Oracle account linking instructions
4. Install and verify Terraform
Open PowerShell and install Terraform for the current Windows user:
winget install --id Hashicorp.Terraform --exact --source winget --scope user
WinGet downloads Terraform, verifies the installer hash, and adds the executable to PATH. The installation shown below selected version 1.16.6, which matches the scripts used in this demo.
Open a fresh PowerShell window after installation and verify:
terraform version
The observed result was:
Terraform v1.16.6
on windows_amd64
An update notice may appear below the version output. In our installation, it reported that 1.17.0 was available. Terraform 1.16.6 remains the version used for this walkthrough.
With Terraform available, we can install the CLI that will authenticate our workstation to Google Cloud. We will create the working directory when we download the demo scripts.

HashiCorp installation documentation
5. Install Google Cloud CLI
Install Google Cloud CLI using the official Windows installer. This gives us the gcloud command used to select a project and configure authentication.
The installer choices in this demo were:
- Single User installation.
- The default folder under the Windows user's local application data.
- Google Cloud CLI Core Libraries and Tools selected.
- Bundled Python selected.
- Beta Commands initially left unchecked.
Open a new terminal after installation and check gcloud --version. Then initialize the CLI and sign in with the Google account that will manage the demo:
gcloud init

Google Cloud CLI installation documentation
6. Authenticate Terraform separately
Now that the CLI is configured for ADBS, authenticate Terraform using Application Default Credentials:
gcloud auth application-default login
Sign in with the Google account you will use for this deployment and grant the requested Google Cloud access. When authentication completes, the browser displays the confirmation below. You can close that browser tab and return to the terminal.

In the terminal, confirm that the command reports Credentials saved to file and identifies the expected quota project. These Application Default Credentials will be used by Terraform's Google provider. The screenshot below shows the successful result with the authentication URL and personal file paths obscured.

Keep the credential file private and outside the repository. The quota project is used for applicable API quota and billing attribution; this message does not establish the project's billing-account link, which we verified earlier.
With authentication configured, we can prepare the Terraform files.
Terraform authentication on Google Cloud
7. Create the Terraform files in VS Code
Create a project folder named C:\TerraformProjects\adbs-demo, then select File → Open Folder in VS Code and open it. In Explorer, create a folder named terraform. We will save all Terraform configuration files inside that folder.
Create versions.tf
Right-click the terraform folder, select New File, and enter versions.tf. Add the following configuration and save with Ctrl+S:
terraform {
required_version = "= 1.16.6"
required_providers {
google = {
source = "hashicorp/google"
version = "= 8.9.0"
}
}
}
required_version selects the Terraform CLI version for this demo. The required_providers block selects the Google provider, its registry source, and its exact version. Terraform installs the provider when we run terraform init later.

# Tested version pins for this demo. Keep them unless intentionally upgrading.
# When upgrading, check resource schemas, refresh the lock file, and validate again.
terraform {
required_version = "= 1.16.6"
required_providers {
google = {
source = "hashicorp/google"
version = "= 8.9.0"
}
}
}
Create providers.tf
Create another file in the same folder named providers.tf, enter the following block, and save it:
provider "google" {
project = var.project_id
region = var.region
}
This configures the Google provider. var.project_id supplies the target project and var.region supplies its deployment region. We will declare these inputs in variables.tf and assign their values in terraform.tfvars. Authentication uses the Application Default Credentials configured in section 6.

# Set project_id and region in terraform.tfvars; keep these variable references.
# Authentication uses your local ADC sign-in; do not put credentials in this file.
provider "google" {
project = var.project_id
region = var.region
}
Create variables.tf
Create variables.tf in the same terraform folder. This file declares the inputs used by the other configuration files. The first part defines the project ID, region, naming prefix, application subnet range, and ODB client subnet range. The validation blocks check the name format and IPv4 CIDR syntax; review the ranges separately to ensure they do not overlap existing or connected networks.

# REQUIRED: set your Google Cloud project ID in terraform.tfvars, not the display name.
variable "project_id" {
type = string
description = "Google Cloud project ID, not its display name."
}
# REQUIRED: set a Google Cloud region verified for your Oracle service in terraform.tfvars.
variable "region" {
type = string
description = "Google Cloud region verified to support your Oracle service and linked tenancy."
}
# CUSTOMIZE in terraform.tfvars: prefix for VPC, subnet, ODB network and database instance names. Changing names after deployment may replace resources.
variable "name_prefix" {
type = string
default = "adbs-demo"
validation {
condition = can(regex("^[a-z][a-z0-9-]{0,29}[a-z0-9]$", var.name_prefix))
error_message = "Use 2-31 lowercase letters, digits and hyphens; begin with a letter and end with a letter or digit."
}
}
# CUSTOMIZE in terraform.tfvars: application subnet CIDR; verify no overlap with connected networks.
variable "client_cidr" {
type = string
default = "10.20.0.0/24"
validation {
condition = can(cidrnetmask(var.client_cidr))
error_message = "Supply a valid IPv4 CIDR."
}
}
# CUSTOMIZE in terraform.tfvars: ODB client subnet CIDR; keep it non-overlapping with the application subnet and connected networks.
variable "database_cidr" {
type = string
default = "10.21.0.0/24"
validation {
condition = can(cidrnetmask(var.database_cidr))
error_message = "Supply a valid IPv4 CIDR."
}
}
deletion_protection defaults to true. create_database defaults to false, allowing us to prepare the network before including ADB-S. The remaining variables declare the database version, notification contact, sensitive ADMIN password, ECPU count, and storage size. Point 8 explains these declarations in detail.

# KEEP true normally. Disable only for an intentional deletion, after reviewing the plan.
variable "deletion_protection" {
type = bool
default = true
}
# STAGE CONTROL: false for network-only setup; true to include ADB-S. Switching back to false after creation proposes database deletion.
variable "create_database" {
type = bool
default = false
}
# REQUIRED before database creation: supported API version value for your chosen region, supplied in terraform.tfvars.
variable "database_version" {
type = string
default = ""
description = "API version value confirmed available in the chosen region; do not guess the version label."
}
# CUSTOMIZE before database creation: notification email in terraform.tfvars. Do not publish personal values in examples.
variable "contact_email" {
type = string
default = ""
}
# REQUIRED before database creation: supply TF_VAR_admin_password securely. Never hard-code a real password here. Sensitive values can still be stored in state/plans.
variable "admin_password" {
type = string
sensitive = true
default = ""
}
# CUSTOMIZE in terraform.tfvars: database ECPUs. Review service limits and cost; this does not size a client VM.
variable "compute_count" {
type = number
default = 2
}
# CUSTOMIZE in terraform.tfvars: database storage in TB. Review service limits and cost.
variable "storage_tb" {
type = number
default = 1
}
# CUSTOMIZE in terraform.tfvars: GCP Oracle Zone from your ODB network console.
# This is not the Compute Engine zone; changing it replaces the ODB network.
# null lets the service choose a zone when this optional input is omitted.
variable "gcp_oracle_zone" {
type = string
default = null
description = "GCP Oracle Zone for the ODB network, for example us-east4-b-r1."
}
Create main.tf
Create main.tf in the terraform folder. This file describes the cloud resources. The first block enables the Compute Engine and Oracle Database APIs. The next blocks create the custom-mode VPC and application subnet, then associate the ODB network with that VPC through network = google_compute_network.demo.id.

# CUSTOMER GUIDE: customize input values in terraform.tfvars first.
# Resource labels (demo/client/database) are Terraform addresses, not cloud names.
# Keep ID references consistent; renaming addresses after deployment needs a state migration.
# Enable only the APIs managed by this demo; leave them enabled during cleanup.
resource "google_project_service" "apis" {
for_each = toset(["compute.googleapis.com", "oracledatabase.googleapis.com"])
project = var.project_id
service = each.value
disable_on_destroy = false
}
# A VPC is the Google Cloud network. An ODB network connects Oracle resources to it.
resource "google_compute_network" "demo" {
project = var.project_id
name = "${var.name_prefix}-vpc"
auto_create_subnetworks = false
depends_on = [google_project_service.apis]
}
resource "google_compute_subnetwork" "client" {
project = var.project_id
name = "${var.name_prefix}-client"
region = var.region
network = google_compute_network.demo.id
ip_cidr_range = var.client_cidr
private_ip_google_access = true
}
The ODB subnet block uses purpose = "CLIENT_SUBNET" and the database address range declared in our inputs. The ADB-S block below it references this ODB network and subnet. It is included only when create_database is true.

resource "google_oracle_database_odb_network" "demo" {
project = var.project_id
location = var.region
odb_network_id = "${var.name_prefix}-odb"
# CUSTOMIZE through terraform.tfvars: match the GCP Oracle Zone selected in the console.
gcp_oracle_zone = var.gcp_oracle_zone
network = google_compute_network.demo.id
deletion_protection = var.deletion_protection
# CUSTOMIZE: resource metadata for your environment.
labels = { environment = "demo", managed_by = "terraform" }
}
resource "google_oracle_database_odb_subnet" "database" {
project = var.project_id
location = var.region
odbnetwork = google_oracle_database_odb_network.demo.odb_network_id
odb_subnet_id = "${var.name_prefix}-db-subnet"
cidr_range = var.database_cidr
purpose = "CLIENT_SUBNET"
deletion_protection = var.deletion_protection
}
# Kept off until onboarding, networking, supported version and costs are reviewed.
The database resource sets the instance ID, database name, and display name, then references the ODB network and client subnet. Its properties block selects Transaction Processing, License Included, input-driven ECPU and storage values, seven-day backup retention, regular maintenance, and mTLS. The lifecycle preconditions check that required database inputs have been supplied before creation.

resource "google_oracle_database_autonomous_database" "demo" {
count = var.create_database ? 1 : 0
project = var.project_id
location = var.region
autonomous_database_id = "${var.name_prefix}-26ai"
# CUSTOMIZE before first deployment: Oracle database name; follow the service naming rules.
database = "ADBS26AI"
# CUSTOMIZE: human-readable database display name.
display_name = "ADBS-26ai"
admin_password = var.admin_password
odb_network = google_oracle_database_odb_network.demo.id
odb_subnet = google_oracle_database_odb_subnet.database.id
deletion_protection = var.deletion_protection
properties {
# OPTIONAL: workload and licensing changes must match your requirements and entitlement.
db_workload = "OLTP"
license_type = "LICENSE_INCLUDED"
db_version = var.database_version
compute_count = var.compute_count
data_storage_size_tb = var.storage_tb
# OPTIONAL: review compute/storage autoscaling and potential additional charges.
is_auto_scaling_enabled = false
is_storage_auto_scaling_enabled = false
# OPTIONAL: choose supported retention and maintenance settings for your policy.
backup_retention_period_days = 7
maintenance_schedule_type = "REGULAR"
# KEEP true for this wallet-based connection demo; changing it affects client setup.
mtls_connection_required = true
# CUSTOMIZE before deployment: private endpoint label using service naming rules.
private_endpoint_label = "adbs26ai"
customer_contacts {
email = var.contact_email
}
}
lifecycle {
precondition {
condition = !var.create_database || (length(var.admin_password) >= 12 && length(var.admin_password) <= 30)
error_message = "Supply a 12-30 character ADMIN password before enabling database creation."
}
precondition {
condition = !var.create_database || (var.database_version != "" && var.contact_email != "")
error_message = "Confirm a supported database version and set contact_email before creating the database."
}
}
}
The scripts include customer guidance comments: REQUIRED identifies values to supply, CUSTOMIZE identifies settings to review, and KEEP identifies references or defaults used by this demo. Most customer values belong in terraform.tfvars; database names and selected policy settings are marked directly in main.tf.
Create outputs.tf
Create outputs.tf in the same folder. Its output blocks return the VPC, application subnet, ODB network, ODB subnet, and database resource IDs after provisioning. The database output uses try(..., null) to handle the network-only stage when no database exists. Keep passwords and wallet contents out of outputs.

# OPTIONAL: add non-secret outputs as needed; keep resource references consistent.
# Never output the ADMIN password or wallet contents. IDs do not prove SQL connectivity.
output "vpc_id" {
value = google_compute_network.demo.id
}
output "client_subnet_id" {
value = google_compute_subnetwork.client.id
}
output "odb_network_id" {
value = google_oracle_database_odb_network.demo.id
}
output "odb_subnet_id" {
value = google_oracle_database_odb_subnet.database.id
}
output "database_id" {
value = try(google_oracle_database_autonomous_database.demo[0].id, null)
}
Create terraform.tfvars.example
Create terraform.tfvars.example to document the values customers supply for their deployment. Replace the project and region placeholders in your own input file, review the subnet ranges, and use name_prefix to customize the generated resource names. Keep create_database = false for the network stage.

# CUSTOMER INPUTS: replace project/region placeholders and review all CIDRs before planning.
# Optional sizing overrides: compute_count = 2 and storage_tb = 1.
# Supply the ADMIN password separately with TF_VAR_admin_password; do not commit secrets.
project_id = "YOUR_PROJECT_ID"
# Replace before planning. Select the region matching your verified Oracle service availability.
region = "REPLACE_WITH_VERIFIED_REGION"
# Example selection: region us-east4 and GCP Oracle Zone us-east4-b-r1.
gcp_oracle_zone = "REPLACE_WITH_VERIFIED_GCP_ORACLE_ZONE"
name_prefix = "adbs-demo"
# Examples only: verify no overlap with existing or connected networks.
client_cidr = "10.20.0.0/24"
database_cidr = "10.21.0.0/24"
deletion_protection = true
create_database = false
# Fill these after network provisioning and before setting create_database = true.
database_version = ""
contact_email = ""
Save a copy as terraform.tfvars when preparing your deployment. Terraform automatically loads that filename; it does not automatically load the .example template. Before enabling database creation, supply a supported database version and contact email. Supply the ADMIN password separately rather than adding it to the shared template.
8. Understand the contents of each Terraform file
Terraform reads the .tf files in this folder as one configuration. We split them by purpose so we can find the provider settings, inputs, resources, and outputs easily. The filenames do not determine the order in which resources are created; references between resources establish their dependencies.
versions.tf — select the Terraform and provider versions
terraform {
required_version = "= 1.16.6"
required_providers {
google = {
source = "hashicorp/google"
version = "= 8.9.0"
}
}
}
required_version requires Terraform CLI 1.16.6 for this demo. Inside required_providers, google identifies the provider we use to manage Google Cloud resources. source tells Terraform where to obtain it, and version selects Google provider 8.9.0. The equals sign pins an exact version. When we run terraform init, Terraform downloads the provider; it does not install the Terraform CLI itself.
providers.tf — choose the target project and region
provider "google" {
project = var.project_id
region = var.region
}
This block configures the Google provider. var.project_id and var.region refer to inputs declared in variables.tf. We supply their values in terraform.tfvars. The provider uses the Application Default Credentials configured earlier, so we do not put credentials in this file.
variables.tf — declare the inputs
A variable declaration defines the kind of value the configuration accepts. For example:
variable "name_prefix" {
type = string
default = "adbs-demo"
}
This excerpt declares a text input with a default. The complete file also validates its naming format. A default applies when we do not supply another value. The project ID and region have no defaults, so we must provide them.
| Input | How our configuration uses it |
|---|---|
project_id, region |
Select the Google Cloud project and supported deployment region |
name_prefix |
Builds resource names such as adbs-demo-vpc and adbs-demo-odb |
client_cidr |
Sets the application subnet address range |
database_cidr |
Sets the ODB client subnet address range |
create_database |
Starts as false; set to true when ready to include ADB-S |
deletion_protection |
Starts as true to protect supported Oracle resources from deletion |
database_version, contact_email |
Supply the region-supported database version and notification contact |
compute_count, storage_tb |
Default to 2 ECPUs and 1 TB for ADB-S; these do not size the client VM |
admin_password |
Supplies the database ADMIN password and is marked sensitive |
The CIDR checks validate address syntax, but do not prove the ranges are available or non-overlapping. We must review the network allocation ourselves. Marking the password sensitive hides it from normal Terraform output; it does not remove it from state or saved plans.
main.tf — describe the resources
Each resource block describes an object Terraform manages. In this example:
resource "google_oracle_database_odb_network" "demo" {
project = var.project_id
location = var.region
odb_network_id = "${var.name_prefix}-odb"
network = google_compute_network.demo.id
deletion_protection = var.deletion_protection
labels = { environment = "demo", managed_by = "terraform" }
}
google_oracle_database_odb_network is the resource type. demo is its local Terraform label, used when another block refers to it. The actual cloud resource name comes from odb_network_id: Terraform substitutes adbs-demo for ${var.name_prefix}, producing adbs-demo-odb.
network = google_compute_network.demo.id uses the ID of the VPC declared elsewhere in this same file. This reference establishes the dependency on the VPC and associates the ODB network with it. labels adds identifying metadata; deletion_protection reads our protection setting.
The other blocks enable the APIs, create the VPC and application subnet, create the ODB client subnet, and define ADB-S, as explained above. The database block references both ODB resource IDs. Its properties block sets the workload, licensing, version, sizing, backups, maintenance, and mTLS settings.
The database resource uses count = var.create_database ? 1 : 0. This means one database when the input is true, and none when it is false. Its lifecycle preconditions check that a password of the required length, a database version, and a contact email are supplied before database creation. They do not replace every validation performed by the cloud service.
terraform.tfvars.example — provide our deployment values
The example is a template. Terraform does not automatically load a file ending in .example; we copy it to terraform.tfvars in the next step. A file named terraform.tfvars is loaded automatically.
project_id = "YOUR_PROJECT_ID"
region = "YOUR_VERIFIED_REGION"
name_prefix = "adbs-demo"
client_cidr = "10.20.0.0/24"
database_cidr = "10.21.0.0/24"
create_database = false
deletion_protection = true
These assignments provide values for variables declared in variables.tf. Replace the project and region placeholders and review the address ranges before planning. The example leaves the database version and contact email blank until we prepare the database stage. We supply the password separately and keep the populated input file outside Git.
outputs.tf — display the resource IDs
output "odb_network_id" {
value = google_oracle_database_odb_network.demo.id
}
This output returns the ODB network's ID after deployment. The file also returns the VPC, application subnet, ODB subnet, and database IDs. The database output uses try(..., null) so that the configuration handles the network-only stage, when no database exists. These IDs help us locate resources; they do not confirm that a SQL connection works.
.terraform.lock.hcl — keep provider selection consistent
Terraform maintains this file with the selected provider version and package checksums. We commit it with the source so the workstation and GitHub Actions use the same provider selection. We do not edit its checksums manually.
Shared state and GitHub Actions will be covered in Part 2. For this walkthrough, keep the local state in the same working directory throughout provisioning.
9. Configure the network stage
Copy the example input file:
Copy-Item terraform.tfvars.example terraform.tfvars
Open terraform.tfvars in VS Code. Set your project ID and the region confirmed for your linked Oracle service. Review the example CIDRs against existing and connected networks. Keep these settings for the first deployment:
project_id = "YOUR_PROJECT_ID"
region = "YOUR_VERIFIED_REGION"
name_prefix = "adbs-demo"
client_cidr = "10.20.0.0/24"
database_cidr = "10.21.0.0/24"
create_database = false
deletion_protection = true
The two CIDRs are examples, not a verified allocation for every customer. This stage creates networking and manages the Compute and Oracle Database API enablement. It does not create a database. Confirm account linking has become active and your account has the required permissions before applying.
Use a dedicated working folder outside automatic cloud synchronization for local state, or configure the private GCS backend described in Part 2 before applying. State and plan files may contain secrets; the ignore rules prevent Git commits but do not prevent file synchronization.
For this deployment, we selected us-east4 as the Google Cloud region and us-east4-b-r1 as the GCP Oracle Zone in the ODB network console. The Oracle zone is a separate input from a Compute Engine VM zone. Set these values in terraform.tfvars only after confirming availability for your own service.
region = "us-east4"
gcp_oracle_zone = "us-east4-b-r1"
The ODB network resource reads gcp_oracle_zone = var.gcp_oracle_zone. This fixes its placement to the selected Oracle zone; changing it after deployment requires replacement of the ODB network. Keep create_database = false for this first network deployment.

10. Initialize and validate
terraform init
terraform fmt -check
terraform validate
init downloads the provider selected in the configuration and prepares the working directory. fmt -check verifies formatting. validate checks the configuration against the installed provider schema.
Expected checkpoints are successful initialization and a valid configuration. These checks do not prove that your account has permission to create resources, that the selected region has capacity, or that Oracle onboarding is complete.
The initialization output confirms that Terraform installed Google provider 8.9.0, verified its HashiCorp signature, and created .terraform.lock.hcl to record the provider selection. Keep this lock file with the source configuration.

Next, terraform validate reports Success! The configuration is valid. This confirms that the configuration passes Terraform's local checks. It does not confirm cloud permissions, service capacity, or successful provisioning.

11. Review and apply the network plan
terraform plan '-out=network.tfplan'
A plan previews the cloud changes. Read the resource names, project, region, and CIDRs. A plus sign indicates a proposed creation; replacement or deletion proposals deserve separate review. With create_database = false, there should be no Autonomous Database creation in this plan.
After reviewing the plan, provision exactly those changes:
terraform apply network.tfplan
terraform output
Applying a saved plan executes it without another approval prompt. Run this command only when the saved plan is the one you intend to apply.
Check VPC networks and Oracle ODB network in the GCP console. Confirm the network and subnet have reached their ready states. A failed apply can leave partially created resources recorded in state; retain the state, investigate the error, and review a fresh plan before retrying.
The network deployment completed successfully with 6 resources added, 0 changed, and 0 destroyed. The outputs identify adbs-demo-vpc, the adbs-demo-client application subnet, adbs-demo-odb, and the adbs-demo-db-subnet ODB client subnet in the selected project and region.

In this run, Terraform reported 22 seconds for VPC creation, 13 seconds for the application subnet, 24 seconds for the ODB network, and 10 minutes 48 seconds for the ODB client subnet. These are individual resource timings from this run, not a guaranteed duration; some operations run in parallel. The six managed resources include the two API-enablement resources.
This completes the network stage. ADB-S and the client Compute VM have not been created yet. Preserve the Terraform state file: the next plan uses it to recognize this existing network.
Verify the resources in Google Cloud Console
Open VPC Network → VPC networks → adbs-demo-vpc → Subnets with the ADBS project selected. Confirm that adbs-demo-client appears in us-east4 with primary IPv4 range 10.20.0.0/24. This console view verifies the VPC and application subnet created by Terraform.

In Oracle AI Database@Google Cloud → ODB network, confirm that adbs-demo-odb has status Available, associated VPC adbs-demo-vpc, and Oracle zone us-east4-b-r1 (Northern Virginia).

Open adbs-demo-odb to view its details. Under Subnets, confirm that adbs-demo-db-subnet is Available, uses 10.21.0.0/24, and has subnet type Client. The screenshot also shows the network's VPC association and Oracle zone; the Oracle account name is obscured.

Open APIs & Services and select Compute Engine API. Confirm that its status is Enabled.

Next, open Oracle Database@Google Cloud API and confirm Status: Enabled for oracledatabase.googleapis.com. Together, these console views verify the four network resources and the two enabled APIs reported by Terraform.

What has been created so far
The successful network apply manages the following six resources:
| Resource | Name or setting |
|---|---|
| Google Cloud VPC | adbs-demo-vpc |
| Application subnet | adbs-demo-client — 10.20.0.0/24 |
| ODB network | adbs-demo-odb, associated with adbs-demo-vpc |
| ODB client subnet | adbs-demo-db-subnet — 10.21.0.0/24 |
| Compute Engine API enablement | compute.googleapis.com |
| Oracle Database API enablement | oracledatabase.googleapis.com |
These resources belong to the ADBS project. The regional resources use us-east4, and the ODB network uses GCP Oracle Zone us-east4-b-r1. The VPC is a global resource.
The network foundation is now ready for the next stage. The ADB-S database and Compute Engine client VM have not been created yet. We will provision the database next, using the existing ODB network and client subnet.
12. Provision ADB-S
In terraform.tfvars, set create_database = true, supply contact_email, and set database_version to the API value verified for your region. Do not guess the version label from a marketing name.
The prepared configuration proposes license-included OLTP, 2 ECPUs, 1 TB in the provider storage field, seven-day backup retention, disabled autoscaling, deletion protection, and mTLS. Review service limits and actual pricing before applying. PAYG means usage-based billing, not a free database.
Supply the ADMIN password without saving it in the input file:
$securePassword = Read-Host "Database ADMIN password" -AsSecureString
$env:TF_VAR_admin_password = [System.Net.NetworkCredential]::new("", $securePassword).Password
terraform plan "-out=database.tfplan"
Use a password meeting Oracle's service requirements. The environment variable must be readable by Terraform; sensitive inputs can still be stored in the state and saved plan.
Review the plan. Then, when ready:
terraform apply database.tfplan
terraform output
Remove-Item Env:TF_VAR_admin_password
Remove-Variable securePassword
In GCP, open Autonomous AI Database and verify the resulting database is available. The starter creates a private endpoint with mTLS. It does not yet create a client VM, download a wallet, or establish a connection from your desktop. Those steps and a successful SQL query are required before we call the full database connection exercise complete.
Verify successful provisioning
For this deployment, we selected version 26ai and named the database ADBS26AI, with display name ADBS-26ai and resource ID adbs-demo-26ai. The reviewed plan proposed 1 to add, 0 to change, 0 to destroy, leaving the existing network resources unchanged.
Terraform completed database creation in 18 minutes 47 seconds:
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Open Oracle AI Database@Google Cloud → Autonomous AI Database. The console shows ADBS-26ai as Available, with 2 ECPUs, 1 TiB storage, and the Transaction Processing workload in us-east4 (Northern Virginia). Oracle also sent a database creation confirmation email.

The database is provisioned. The following section verifies access from Windows SQL Developer through the private client VM.
13. Create the application VM and connect to ADB-S
With ADB-S available, we will create a Compute Engine VM in the application subnet of our Google Cloud VPC, then connect from SQL Developer on Windows. The database has a private endpoint, so the Compute Engine VM provides the network path into the VPC. Java and SQLcl do not need to be installed on the VM for this approach.
Windows SQL Developer → localhost:1522 → PuTTY SSH over IAP
→ adbs-demo-sqlclient (10.20.x.x) → ADB-S (10.21.x.x:1522)
How the VM provides database connectivity
SQL Developer runs on our Windows desktop, while ADB-S has a private endpoint in the ODB client subnet. Our desktop has no direct route to that private address. The Compute Engine VM sits in the application subnet of the VPC associated with the ODB network, providing the connection path to the database.
When we open the saved PuTTY session, its local proxy command starts an IAP connection to the VM's SSH service. IAP lets us reach this VM without assigning it a public IP. PuTTY then listens on 127.0.0.1:1522 on Windows and forwards traffic through SSH. The VM opens the onward connection to the database's private endpoint on port 1522.
Windows SQL Developer
→ Windows loopback: 127.0.0.1:1522
→ PuTTY SSH connection carried through Google IAP
→ Compute Engine VM in the application subnet
→ ADB-S private endpoint in the ODB client subnet:1522The VM acts as a forwarding host; it does not run the database or SQL Developer. The wallet supplies the client credentials for the database's mTLS connection, and SQL Developer authenticates with the database username and password. Keep PuTTY open while using SQL Developer. Closing PuTTY removes the forwarding path, so a new database connection will fail until the tunnel is reopened.
This approach gives our desktop access through one SSH forwarding host. Other access designs, such as a VPN or an application running within the VPC, can provide their own private network path.
Create the private client VM
Create client.tf in the same Terraform folder. It creates a private Ubuntu VM, enables IAP, allows SSH from Google's IAP range, and provides outbound access through Cloud NAT. OS Login authenticates the Linux user. The connecting user also needs the required IAP and OS Login IAM permissions.
# SQL client VM: uses the existing application subnet, not the ODB subnet.
# CUSTOMIZE: this Compute Engine zone is distinct from gcp_oracle_zone.
variable "client_vm_zone" {
type = string
default = "us-east4-b"
}
# CUSTOMIZE: e2-small is sufficient for this SSH forwarding demonstration.
variable "client_vm_machine_type" {
type = string
default = "e2-small"
}
resource "google_project_service" "iap" {
project = var.project_id
service = "iap.googleapis.com"
disable_on_destroy = false
}
# SSH is allowed only from Google's documented IAP TCP forwarding range.
resource "google_compute_firewall" "client_iap_ssh" {
project = var.project_id
name = "${var.name_prefix}-iap-ssh"
network = google_compute_network.demo.id
direction = "INGRESS"
source_ranges = ["35.235.240.0/20"]
target_tags = ["adbs-sqlclient"]
allow {
protocol = "tcp"
ports = ["22"]
}
}
# Outbound internet access for packages; the VM has no external IP.
# Cloud NAT and the VM incur usage charges. NAT applies only to this subnet.
resource "google_compute_router" "client" {
project = var.project_id
name = "${var.name_prefix}-client-router"
region = var.region
network = google_compute_network.demo.id
}
resource "google_compute_router_nat" "client" {
project = var.project_id
name = "${var.name_prefix}-client-nat"
region = var.region
router = google_compute_router.client.name
nat_ip_allocate_option = "AUTO_ONLY"
source_subnetwork_ip_ranges_to_nat = "LIST_OF_SUBNETWORKS"
subnetwork {
name = google_compute_subnetwork.client.id
source_ip_ranges_to_nat = ["PRIMARY_IP_RANGE"]
}
}
resource "google_compute_instance" "sqlclient" {
project = var.project_id
name = "${var.name_prefix}-sqlclient"
zone = var.client_vm_zone
machine_type = var.client_vm_machine_type
deletion_protection = var.deletion_protection
tags = ["adbs-sqlclient"]
labels = { environment = "demo", managed_by = "terraform" }
boot_disk {
initialize_params {
image = "ubuntu-os-cloud/ubuntu-2404-lts-amd64"
size = 20
type = "pd-balanced"
}
}
network_interface {
subnetwork = google_compute_subnetwork.client.id
# No access_config: no public IP address.
}
# No service account attached: the SQL client needs no Google API privileges.
metadata = {
enable-oslogin = "TRUE"
}
shielded_instance_config {
enable_secure_boot = true
enable_vtpm = true
enable_integrity_monitoring = true
}
depends_on = [google_project_service.iap, google_compute_router_nat.client]
}
output "client_vm_name" {
value = google_compute_instance.sqlclient.name
}
output "client_vm_zone" {
value = google_compute_instance.sqlclient.zone
}
output "client_vm_private_ip" {
value = google_compute_instance.sqlclient.network_interface[0].network_ip
}
Run these commands from the existing PowerShell session and Terraform directory. Review the plan before applying:
terraform fmt
terraform validate
terraform plan "-out=client.tfplan"
terraform apply "client.tfplan"
Our plan and apply added five resources, with no changes or deletions to the existing database or network. The VM is adbs-demo-sqlclient, its private IP is 10.20.x.x, and its Compute Engine zone is us-east4-b. This zone differs from the GCP Oracle zone us-east4-b-r1. The VM and Cloud NAT incur usage charges.

Save the IAP connection in PuTTY
Prepare the Google Cloud SSH key and register its public key using the CLI. On the first connection, follow the key-generation prompts:
gcloud compute ssh adbs-demo-sqlclient --project=YOUR_PROJECT_ID --zone=us-east4-b --tunnel-through-iap
Save a PuTTY session named ADBS SQL Client. Set Host Name to adbs-demo-sqlclient, port to 22, and the auto-login username to your OS Login username. Under Connection → SSH → Auth → Credentials, select the Google Cloud-generated .ppk private key.
Under Connection → Proxy, choose Local proxy command. Use the following command, replacing the two installation paths and project placeholder with your values:
"C:\PATH\google-cloud-sdk\platform\bundledpython\python.exe" -S "C:\PATH\google-cloud-sdk\lib\gcloud.py" compute start-iap-tunnel adbs-demo-sqlclient %port --listen-on-stdin --project=YOUR_PROJECT_ID --zone=us-east4-b --verbosity=warning
PuTTY now starts the IAP transport automatically; a separate PowerShell listener on port 2222 is unnecessary.
Add the database forwarding
Load the saved session and open Connection → SSH → Tunnels:
| Setting | Value |
|---|---|
| Source port | 127.0.0.1:1522 |
| Destination | 10.21.x.x:1522 |
| Type | Local |
Use your database's private endpoint IP from Google Cloud Console. Click Add, return to Session, and click Save → Open. Keep the listener restricted to loopback and leave PuTTY connected while using SQL Developer.

Download the wallet and configure hostname resolution
Open ADBS-26ai → Connections → Download Wallet. Enter and confirm a wallet password privately, then download the ZIP. Keep it outside the repository and source bundles. This database requires mTLS, so SQL Developer uses the wallet.
The wallet uses hostname adbs26ai.adb.us-ashburn-1.oraclecloud.com. Open Windows Notepad as Administrator, open C:\Windows\System32\drivers\etc\hosts, and add this line once:
127.0.0.1 adbs26ai.adb.us-ashburn-1.oraclecloud.com # ADBS PuTTY tunnel
Use the exact private endpoint hostname for your own database. The mapping routes it through the local tunnel while preserving the hostname used for TLS verification. Keep ssl_server_dn_match=yes. Fully restart SQL Developer after the change to clear cached DNS results. Remove this specific hosts-file entry when retiring the tunnel or switching to direct private-network access.
Configure SQL Developer and test
Create the following connection in SQL Developer on Windows:
| Setting | Value |
|---|---|
| Name | ADBS-26ai |
| Username | ADMIN |
| Password | The database ADMIN password |
| Connection Type | Cloud Wallet |
| Configuration File | The downloaded wallet ZIP |
| Service | adbs26ai_medium |
The database password and wallet password are separate. Click Test and confirm Status: Success, then Connect. We observed this working with SQL Developer 21.4.3. Keep PuTTY open throughout the connection.
Run each statement separately with Ctrl+Enter:
SELECT banner_full FROM v$version;
SELECT SYS_CONTEXT('USERENV', 'DB_NAME') AS database_name,
SYS_CONTEXT('USERENV', 'SESSION_USER') AS connected_user
FROM dual;
The session query returned the deployed database name and connected user ADMIN. The version query returned Oracle AI Database 26ai Enterprise Edition, release 23.26.4.1.0. This verifies the complete connection from Windows SQL Developer through PuTTY and the private VM to ADB-S.

Google IAP SSH documentation · Oracle SQL Developer wallet documentation
Conclusion
We provisioned Oracle Autonomous Database Serverless 26ai on Oracle Database@Google Cloud using Terraform and the public pay-as-you-go offer. The configuration created the VPC, application subnet, ODB network, ODB client subnet, and database. Database creation completed in 18 minutes 47 seconds in this deployment.
We then created a private Compute Engine VM and used PuTTY with IAP to connect Windows SQL Developer to the database's private endpoint. Successful SQL queries confirmed the connected ADMIN session and Oracle AI Database 26ai version.
The Terraform configuration provides a reusable starting point for provisioning these resources, while the connection test confirms that the deployed database is accessible through the private VM.
Share on LinkedIn ↗Keep your Oracle notebook growing
Get new Oracle walkthroughs in your inbox, or follow the blog in your favorite RSS reader.
Free email delivery through Blogtrottr. Enter and confirm your email on their site; unsubscribe from any email. The free service may include ads. Your email address is not collected by this blog.
Join the discussion
Ask a question, share a result, or add a useful tip.
Leave a comment
Your name and comment will be public. Keep passwords, email addresses, IP addresses, and other private details out of your comment. Cloudflare Turnstile checks submissions to help prevent spam.