Skip links

Building Oracle GoldenGate Cloud Service (GGS) with Terraform

A couple of weeks ago Oracle released Oracle GoldenGate Service (aka. Oracle GoldenGate Cloud Service)(GGS).  This is the OCI version of Oracle GoldenGate and is mostly the Oracle GoldenGate Microservices platform once built.  As with all OCI items, you can login to the Oracle Cloud and build the service via a click through process.  In this post, I want to show you a quick way to deploying the service using HashiCorp Terraform and few items I found.

Note: The items I’m pointing out, Oracle Product Management is aware of these and should be working on fixing them.

After logging into Oracle Cloud (OCI), you will find GoldenGate under Database Related Services.  In this menu item, there are three options.  The Deployment option is what you need to be concern with.

After selecting the Deployment option, you will end up at a page where you will see the deployments that have been created already.  In the image below, I’ve been testing and it takes 24 hours to remove a deployment once it is deleted.

ggs_deployment_page.png

Now that you know where you want to look to see the deployments after they are created, lets look at how to build an Oracle GoldenGate Service (GGS) using Terraform.

The information you need to build Oracle GoldenGate Service (GGS) via Terraform is located in the Terraform Registry. This information will tell you all the required and optional items needed to build the service.  There are a few things to be aware of though, the first is deployment_type.  What type of deployment are you going to build?  The short story is that the only deployment type is “OGG”.  If you do not provide this value, then the Terraform deployment will error with the following:

Error: Missing required argument

on main.tf line 40, in resource “oci_golden_gate_deployment” “ggdemo”:
40: resource “oci_golden_gate_deployment” “ggdemo” {

The argument “deployment_type” is required, but no definition was found.

After resolving this issue, the next issue to watch out for has to do with the License.  In the GUI, you can select “BYOL” or “License Included”.  These two options provide you a way to either minimize the cost (BYOL) or incur more costs (License Included), depending on how you look at it.  If you go the “BYOL” approach, this assumes you already have a license of Oracle GoldenGate that you are transferring to the cloud.  The “License Included” approach adds a minimal amount of cost to you cloud credit rate.  Use what benefits your organization.  Where the problem comes in at is that with Terraform, both values are valid but only one actually works.  The one that actually works for now, is “License Included”.

What happens if you choose “BYOL” from the Terraform side is that the process will error out after two minutes.  An error similar to this will be displayed:

Error: 500-InternalError 
Service: GoldenGateDeployment 
Error Message: Internal error occurred 
OPC request ID: acf6c14f0506ae2d4b3ee53ac4f694f9/0A147B86DFDB4F91B6AA1E24629864C4/B449B42E1D181A4D5C5A6CFBF3F603FB 
Suggestion: The service for this resource encountered an error. Please contact support for help with service: GoldenGateDeployment

Now that the “gotchas” are out of the way, what does a simple Terraform script look like for building Oracle GoldenGate Service (GGS)?  The below script is what I use to build a quick deployment for testing:

resource "oci_golden_gate_deployment" "ggdemo" {
#Required
compartment_id = "ocid1.compartment.oc1..aaaaaaaade5bxtniugmwuiynsonpq74fo2djk6hd64qu3lzw2xybym….q"
cpu_core_count = "2"
deployment_type = "OGG"
display_name = "GGDEMO"
is_auto_scaling_enabled = "false"
is_public = "true"
license_model = "LICENSE_INCLUDED"
subnet_id = var.testsubnet
ogg_data {
          admin_password = “**************”
          admin_username = “oggadmin"
          deployment_name = “GGDEMO"
     }

}

The above script is using only the required options for the Oracle GoldenGate Service (GGS) deployment. In this script, I’m setting the compartment where I want the deployment built at.  Then I’m telling is how many OCPU it should have.  Already covered the deployment type. What name I want to call the deployment and if the deployment should be auto scaling.  In this case, didn’t turn on auto-scaling.  Then I’m making sure I assign a public IP address and adding to an existing subnet (VCN).  Lastly, I’m providing what I want for the GoldenGate Microservices login.

After running a terraform plan -out plan.out and terraform apply plan.out; Terraform will begin building the GGS deployment.  This can be seen in the deployment page that was mentioned earlier.

ggs_deployment_page2.png

After about 11-15 minutes, you will have an Oracle GoldenGate Service that you can access by a given URL.

With the deployment done, I’m presented with the following output:

oci_golden_gate_deployment.ggdemo: Creation complete after 13m2s [id=ocid1.goldengatedeployment.oc1.iad.amaaaaaaxbdlgqiancxr3umcvfatxlztc4llzztudhlpicbb3la57ob4zpoa]
data.oci_golden_gate_deployment.ggdemo: Reading...
data.oci_golden_gate_deployment.ggdemo: Read complete after 0s [id=ocid1.goldengatedeployment.oc1.iad.amaaaaaaxbdlgqiancxr3umcvfatxlztc4llzztudhlpicbb3la57ob4zpoa]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.

State path: terraform.tfstate

Outputs:

ggdemo = “https://3la57ob4zpoa.deployment.goldengate.us-ashburn-1.oci.oraclecloud.com/”

By using the URL given, I can access the Oracle GoldenGate Service and login.

ggs_ma_21_page.png

At this point, if everything is setup correctly, I can quickly build out the replication environment using the REST APIs.

Enjoy!!

Leave a comment