Teaching How to use Terraform to automate Provisioning of Oracle API Platform

Previously, I showed how to use Terraform and PSM CLI to spin up a “Build Server” and use it to provision Oracle Integration Cloud (OIC) environments. You can find this blog here.

In this blog I am going to show you how to do the same, but to provision Oracle API Platform environments.

The approach that I will be following is the same:

Before we start

  • I encourage you to read the previous blogs, which I am building on top.
  • You need an Oracle Cloud account, if you don’t have one yet, request a trial, they are free. Go to: https://cloud.oracle.com/tryit

Create your Build Server:

I already explained with step by step instructions how to build your “Build Server” in a previous blog. Please refer to this blog if you have not yet created your “Build Server”.

The way I create the “Build Server” allows you to deploy any Oracle PaaS, this is a list of some of the available services in my Oracle Cloud environment:

o ANALYTICS: Oracle Analytics Cloud

o APICS: Oracle API Platform Cloud Service

o BDCSCE: Oracle Big Data Cloud

o CONTAINER: Oracle Container Cloud Service

o ContainerRegistry: Oracle Container Registry Service

o DHCS: Oracle Data Hub Cloud Service

o DevServiceApp: Oracle Developer Cloud Service

o IDCS: Oracle Identity Cloud Service

o IntegrationCloud: Oracle Integration Cloud

o jcs: Oracle Java Cloud Service

o MySQLCS: Oracle MySQL Cloud Service

o OEHCS: Oracle Event Hub Cloud Service

o OMCE: Oracle Mobile Cloud Metering Service

o OMCEXTERNAL: Oracle Management Cloud Service

o SOA: Oracle SOA Cloud Service

o SSI: Oracle Self-Service Integration Cloud Service

o VisualBuilder: Oracle Visual Builder Cloud Service

o accs: Oracle Application Container Cloud Service

o caching: Oracle Application Cache

o dbcs: Oracle Database Cloud Service

o dics: Oracle Data Integration Platform Cloud Service

o ggcs: Oracle GoldenGate Cloud Service

o stack: Oracle Cloud Stack Manager

Among others…

Let’s provision a new API Platform environment

Once that you have created your Build Server and have ssh into it, let’s provision a new API Platform environment.

  • Go into the provisionAPIPlatform directory:

    cd devops/provisionAPIPlatform

  • Create a folder called ssh and bring your public SSH key. Call it: “myPublic_sshKey.pub
  • Rename/Copy “terraform.tfvars_sample” to “terraform.tfvars“,

cp terraform.tfvars_sample terraform.tfvars

  • Open “terraform.tfvars” and set your variables, depending on where you want to deploy your APICS environment.

Note: use “prefix” to name your target resources. For example, a prefix dev would ultimately produce devAPICS, devDB, devXXX, etc.

  • Now, inside the templates folder, you will find the JSON payloads that will ultimately configure your new APICS environment. Although I tried to parameterise with @xxx@ notations all those values that are more likely to change, I still encourage you to have a good look at the different configuration settings and make sure that they match your requirements. Especially in terms of region, api, shapes, editions, sizes, feature set, versions, etc. In my case I used Chicago DC in US.

    These are the two JSON payloads that you want to look at:

    • psm_APICS_Dev_DBCS_Template.json: This template contains all the DBCS configuration to be applied to the underlying DB for your new APICS environment. Have a look at it and make sure all is correct. In my example, I assume a EE DBCS with 1 OCPU shape (oc3) and 25 GB of storage. The rest of the values with @xxx@ notations are automatically replaced at runtime by using the values provided in your terraform.tfvars file.
    • psm_APICS_Dev_Template.json: This template contains the APICS configuration to be applied to the new environment. In my example, I assume a 2 x 1 OCPU (oc1m) cluster with HA enabled via OTD using Round Robin as the balance algorithm. The rest of the values with @xxx@ notations are automatically replaced at runtime by using the values provided in your terraform.tfvars file.
    • psm_APICS_original_Template.ref: This is just for references purposes as well. Nothing to update here. It is the full JSON payload with all optional and mandatory fields. I just used a subset of them in the actual JSON payload file.
  • Once you feel comfortable with your settings, go to the top provisionAPIPlatform directory and run terraform init to download and configure the providers being used i.e. opc and null:

    terraform init

  • Then apply the Terraform plan:

    terraform apply

    Review and accept the changes by typing yes + enter

  • First, it is going to create the required Object storage containers.

  • Then it will start the DBCS provisioning.

  • Usually the DBCS provisioning takes around 30 minutes to complete. Then, it will start the APICS provisioning.

  • After a little more, your new APICS environment will be ready to go:

I hope you found this blog useful. If you have any question or comment, feel free to contact me directly at https://www.linkedin.com/in/citurria/

Thanks for reading.


Author: Carlos Rodriguez Iturria

I am extremely passionate about people, technology and the most effective ways to connect the two by sharing my knowledge and experience. Working collaboratively with customers and partners inspires and excites me, especially when the outcome is noticeable valuable to a business and results in true innovation. I enjoy learning and teaching, as I recognise that this is a critical aspect of remaining at the forefront of technology in the modern era. Over the past 10+ years, I have developed and defined solutions that are reliable, secure and scalable, working closely with a diverse range of stakeholders. I enjoy leading engagements and am very active in the technical communities – both internal and external. I have stood out as a noticeable mentor running technology events across major cities in Australia and New Zealand, including various technology areas such as, Enterprise Integrations, API Management, Cloud Integration, IaaS and PaaS adoption, DevOps, Continuous Integration, Continuous Automation among others. In recent years, I have shaped my role and directed my capabilities towards educating and architecting benefits for customers using Oracle and AWS Cloud technologies. I get especially excited when I am able to position both as a way to exceed my customers’ expectations. I hold a bachelor degree in Computer Science and certifications in Oracle and AWS Solutions Architecture.

2 thoughts on “Teaching How to use Terraform to automate Provisioning of Oracle API Platform”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: