Oracle

Provision Tessell for Oracle with Terraform

Rajnikant Rakesh
Rajnikant Rakesh
,
July 4, 2023
Share this blog
arrow icon
Provision Tessell for Oracle with Terraform

Sometime back, we announced the Oracle database service on Tessell making deploying Oracle databases extremely simple, elegant, and hassle-free. Tessell for Oracle is a fully managed database-as-a-service (DBaaS) for Azure and AWS that handles your data infrastructure, data management, and data migration needs, whether you're running Oracle Enterprise Edition or Oracle Standard Edition 2.

After the announcement, we have seen growing interest in using Tessell for Oracle and we have been talking to quite a few enterprise customers who want to leverage this service in their existing public environment landscape.

One of the things that has always come up in the discussion is how to best use their existing DevOps platform to deploy Tessell for Oracle service. This guide will help you clear that hurdle.

First things first, we at Tessell want to meet our customers where they are right now and enable them with all the tools & services required to make integrations pain-free.

Tessell for Oracle can be provisioned programmatically using our APIs or if you are someone who relies a lot on Terraform to provision services we have got your back.

So let's get rolling.

Over the past few years, Terraform has become a de-facto industry standard for provisioning services across clouds, and we at Tessell provide the required extensibility in our services to be integrated into your existing provisioning setup.

The first step to using Tessell API services is to generate an API Key which will be used to call Tessell services from your existing landscape.

1. Generate Tessell API Key

To generate an API key login to your Tessell Instance and go to the user profile.

Save the generated API Key locally as we are going to use this later to provide services through Terraform.

Now that we have the API Key generated next step is to generate Terraform code from the Tessell console.

2. Terraform Script

a. Login to the Tessell consoleClick on to provision an Oracle Database service.
b. Provide the Name of the service and description (Optional)
c. Configure all other required settings for the database.
d. Once done Click on the code section at the bottom left to generate

This is how the Terraform code snippet will look like.

Copied to clipboard!

terraform {
  required_providers {
    tessell = {
      source  = "tessell-cloud/tessell"
    }
  }
}

provider "tessell" {
  api_address = "https://api.tessell.tessell.com"
  tenant_id = "edd25540-b3e2-4570-a458-fa308186ef89"
  api_key =  #Provide you Tessell API KEY
}

resource "tessell_db_service" "Tessell_for_oracle" {
  name = "Tessell_for_oracle"
  description = "Tessell For Oracle"
  subscription = "default"
  engine_type = "ORACLE"
  topology = "single_instance"
  software_image = "Oracle 19c SE2"
  software_image_version = "19.17.0.0.221018"
  auto_minor_version_update = true
  enable_deletion_protection = false
  enable_stop_protection = false
  infrastructure {
    cloud = "azure"
    region = "eastUS"
    availability_zone = null
    vpc = "tessellstage-default-3f508fa2"
    compute_type = "tesl_4_a"
    enable_encryption = true
    encryption_key = "default-encryption-key"
    additional_storage = 0
  }
  service_connectivity {
    service_port = "1521"
    enable_public_access = true
    allowed_ip_addresses = [
      "122.161.95.188",
    ]
    enable_s_s_l = true
  }
  creds {
    master_user = "master"
    master_password = "Tessell123"
  }
  maintenance_window {
    day = "Sunday"
    time = "02:00"
    duration = 30
  }
  snapshot_configuration {
    auto_snapshot = true
    sla = "2-days-pitr"
    snapshot_window {
      time = "01:00"
      duration = 30
    }
  }
  engine_configuration {
    oracle_config {
      multi_tenant = false
      parameter_profile = "Tesl_4_a Default Oracle 19c"
      options_profile = "Oracle 19c Options Profile"
      character_set = "AL32UTF8"
      national_character_set = "AL16UTF16"
    }
  }
  databases {
    database_name = "orcl"
    database_configuration {
      oracle_config {
        parameter_profile = "Tesl_4_a Default Oracle 19c"
        options_profile = "Oracle 19c Options Profile"
      }
    }
  }
}
 

This script needs to be updated with the API Key of your Tessell account, the script can then be committed to your Terraform code repository in this case we are going to download it locally and use local Terraform instance to provision the service.

3. Database Provisioning with Terraform

a. Install Terraform if required, ignore this step if it's already installed
b. Save the download terraform file to a location.
c. When running Terraform in automation, the focus is usually on the core plan/apply cycle which provisions the required service i.e. in this case Tessell for Oracle database.

d. Go to the folder where terraform script is saved and run the following command.

terraform init

e. Once the initialization is complete, run the plan. If the plan is successful it will show up the required details of the service that will be provisioned. Verify all the details before proceeding to the next step.

terraform plan

f. The final step is to apply the plan using the following command. Tessell API service will keep sending status provisioning responses until the resource is provisioned.

terraform apply

g. Once the execution is successful navigate to your Tessell portal to verify the provisioned database service from the Tessell console.

Follow us
Youtube Button