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.
- How to use Terraform to provision Oracle Integration Cloud, click here.
- How to use Terraform, click here.
- How to use PSM CLI, click here.
- How to use Vagrant. click here.
-
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.
-
In your new Build Server, choose a folder to once again git clone my devops repo.
-
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 12.1.0.2 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) 12.2.1.2 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.
2 thoughts on “Teaching How to use Terraform to automate Provisioning of Oracle API Platform”