SlideShare a Scribd company logo
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
BEST PRACTICES WHEN USING
TERRAFORM TO MANAGE ORACLE
CLOUD INFRASTRUCTURE
Simon Haslam
eProseed
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
ABOUT ME
2
Simon Haslam
• Platform / Infrastructure
Architect
• Focus includes HA, DR,
security, automation
Relevant to this session
• WebLogic / FMW installations
since 2000s
• First research/webcast on JCS
in 2016
• Designed & built SOA CS
integration platform for global
use since Oct 2017
• On team migrating eProseed
Lux data centres to OCI@simon_haslam
since
2009
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
ABOUT EPROSEED?
3
Oracle ACE
Directors
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
DISCLAIMER
What is are “best practices” anyway…? ☺
4
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.5
➢ Why automate OCI provisioning?
➢ Real-world Terraform OCI examples
➢ Terraform ‘better practices’
➢ A few more tips ☺
AGENDA
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.6
➢ Why automate OCI provisioning?
➢ Real-world Terraform OCI examples
➢ Terraform ‘better practices’
➢ A few more tips ☺
AGENDA
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
WHY AUTOMATE OCI PROVISIONING?
7
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
PAAS PROVISIONING
8
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
PAAS PROVISIONING
9
Terraform provides an abstraction layer above OCI’s REST APIs
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
TERRAFORM’S PURPOSE
“Terraform is a tool for building, changing and versioning
infrastructure safely and efficiently”
10
Cloud-agnostic
but not generic
(each cloud has own
providers)
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
BOUNDARIES
12
resourcesPROVISIONING
This provisions resources
& optionally calls
“provisioner”
e.g.
network
VM instance
PaaS instance
VM images might be
Oracle supplied plain
ones, Oracle-supplied
PaaS ones, or your own
(e.g. from Packer),
Maintains state of infra
Optional
Provisioner
CONFIGURATION
MANAGEMENT
This configures
resources
e.g.
TLS certificates & identity
CM self-registration
Maintains internal state of
resources (instances)
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
TERRAFORM PROVIDERS
• A provider tells Terraform how to build and manage one or many resource types
• Providers are supplied by Hashicorp, a resource provider (like Oracle), or 3rd
party/community
13
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
MORE ABOUT TERRAFORM PROVIDERS
• Providers are either:
– Integrated: downloaded by Terraform when needed
– Non-integrated: install from 3rd party or write your own
• 3 Oracle-developed providers available:
14
oci oracle
paas
opc
More about these in a minute..These 3 Oracle providers are all
now integrated into TF
X X
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.15
oci
oracle
paas
opc
almost
legacy
legacy
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
OCI PROVIDER
Infrastructure & OCI-native PaaS
https://www.terraform.io/docs/providers/oci/index.html
16
Lots of resources
- examples:
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.17
➢ Why automate OCI provisioning?
➢ Real-world Terraform OCI examples
➢ Terraform ‘better practices’
➢ A few more tips ☺
AGENDA
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
GETTING STARTED
• You need a host to run Terraform from
– could be your PC, a cloud instance, or build server
• Oracle Linux 7 example:
sudo yum install -y terraform
• Create/reuse .tf config files & set up .tfvars for your account/env
• The .tf files need to have one or more providers specified
18
terraform init
terraform plan
terraform apply
…terraform destroy
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.19
DEMO
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
BIG PICTURE EXAMPLE
20
DRG
Dynamic
Routing
Gateway
On-prem
Another
VCN
Another
cloud
admin
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.21
➢ Why automate OCI provisioning?
➢ Real-world Terraform OCI examples
➢ Terraform ‘better practices’
➢ A few more tips ☺
AGENDA
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
1. IT’S NEVER TOO EARLY TO START TERRAFORM
• Using the OCI consoles can be time consuming
• Cumulative effect
• You want to experiment as much as possible
• Exception:
Compartment creation: slow, leaves trail don’t
(re)create compartments often
22
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
2. USE SOURCE CODE CONTROL
• Infrastructure as Code… naturally you want to version it
– You probably can’t go back far but you can see who changed what & when
• Use git
– De-facto SCM these days
• Don’t use branches
– Or if you do, have branches for different environments (e.g. Puppet model)
23
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
3. STORE YOUR .TFSTATE CENTRALLY
• OCI Object storage (simple), or,
• terraform.io service (more advanced)
24
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
4. USE TERRAFORM 0.12
• Language updates from 0.11 to 0.12
• There’s an auto upgrade from 0.11 to 0.12 but I found a
couple of things broke
https://www.terraform.io/upgrade-guides/0-12.html
25
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
5. STRUCTURE MULTIPLE TF CONFIGURATIONS
• You only want one person at a time making changes in same area
• Probably best to have TF by top-level compartment plus one
global
• Depends on organisation structure
26
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
6. DON’T USE -AUTO-APPROVE
• This is my opinion of a best practice ☺
• -auto-approve means an apply makes changes without prompting
• You get into habit of up-up-return… errors can easily happen
(once, twice,…)
• Exception: use -auto-approve on CI server ☺
27
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
7. DECIDE WHEN TO USE TF & WHEN NOT
• Terraform:
– Its strength is converged state – use it often but for few changes
– State convergence sophistication is up to the provider developer
• Update OCI Instance hostname - good
• Update OCI Database Service PDB name – not so good
– Use for static deployments – compartments, networks, load balancers etc
• Ansible
– Can manage state but often run in fire & forget mode
– Fire & forget is more aligned to traditional change processes
– You need a tool to customise most PaaS instances anyway
– Use for most types of instances
28
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
8. UPDATE YOUR OCI PROVIDER REGULARLY
• Terraform Provider for OCI changes in 2 ways:
– New features & bug fixes
– Changes to OCI REST APIs
• You may be forced to update it in a hurry otherwise
29
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
9. USE A MODERN EDITOR + TF PLUG-IN
Extension available for
Microsoft VS Code editor
30
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
10. SUBSCRIBE TO TERRAFORM-PROVIDER-OCI ISSUES
31
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.32
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
TERRAFORM FOR OCI – BETTER PRACTICES
1. Start with Terraform early, really early, on your OCI journey
2. Use Git, but one branch (or one per env for separate TF state)
3. Store your .tfstate centrally (e.g. in OCI object storage bucket)
4. Use Terraform 0.12, especially if starting from scratch
5. Structure multiple TF configurations, probably by compartment
6. Don’t use -auto-approve (except from CI server)
7. Decide when to use TF & when not
8. Update your OCI provider regularly (you may be forced to in a hurry otherwise)
9. Use a modern editor (like VS Code) + TF plug-in
10. Subscribe to terraform-provider-oci issues33
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.34
➢ Why automate OCI provisioning?
➢ Real-world Terraform OCI examples
➢ Terraform ‘better practices’
➢ A few more tips ☺
AGENDA
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
A FEW MORE TIPS
• Watch your costs! This is cloud after all…
• Environment variables
• TF modules are very handy for scaling number of instances
35
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
ENVIRONMENT VARIABLES FOR DIFFERENT TENANCIES
36
From OCI provider doc:
https://www.terraform.io/docs/providers/oci/index.html
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
TERRAFORM MODULES
Our example use case
• Lots of identical compute instances needed for on-prem
provisioning automation
• 3 different types of modules:
– Fusion Middleware
– Database
– Provisioning Server
• All VMs identical for module type – pick how many you
want
• But YMMV - there may be a better way than this for you ☺
37
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
TERRAFORM FOR OCI – BETTER PRACTICES
1. Start with Terraform early, really early, on your OCI journey
2. Use Git, but one branch (or one per env for separate TF state)
3. Store your .tfstate centrally (e.g. in OCI object storage bucket)
4. Use Terraform 0.12, especially if starting from scratch
5. Structure multiple TF configurations, probably by compartment
6. Don’t use -auto-approve (except from CI server)
7. Decide when to use TF & when not
8. Update your OCI provider regularly (you may be forced to in a hurry otherwise)
9. Use a modern editor (like VS Code) + TF plug-in
10. Subscribe to terraform-provider-oci issues38
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
ORACLE EXAMPLES
• https://github.com/oracle/terraform-examples
Starting point for some cases – reasonable activity (91 commits)
• https://oracle.rainfocus.com/widget/oracle/oow18/catalogoow18?search=HOL6376
39
Start here!
Probably takes
1-3h
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.
HANDS-ON-LAB TIP
Trial account does not have sufficient compute resources to run the HOL:
=> Raise an SR to get this increased, e.g. to 10 for 2.1 shape (change shape in .tf config):
40Paid for accounts have default limit of 40 per AD for small VMs
https://docs.cloud.oracle.com/iaas/Content/General/Concepts/servicelimits.htm
Copyright © 2019, eProseed and/or its affiliates. All rights reserved.41
@simon_haslam
Q
&
A
Mobile Process /
Integration
Analytics /
Big Data
Database /
Data
Management
Identity &
Access
Management
Oracle Cloud
eProseed Confidential42
Ad

Recommended

Terrraform meet Oracle Cloud: Platform Provisioning Automation
Terrraform meet Oracle Cloud: Platform Provisioning Automation
Simon Haslam
 
The Kubernetes WebLogic revival (part 1)
The Kubernetes WebLogic revival (part 1)
Simon Haslam
 
The Kubernetes WebLogic revival (part 2)
The Kubernetes WebLogic revival (part 2)
Simon Haslam
 
Heterogeneous Computing on POWER - IBM and OpenPOWER technologies to accelera...
Heterogeneous Computing on POWER - IBM and OpenPOWER technologies to accelera...
Cesar Maciel
 
Ibm power ha v7 technical deep dive workshop
Ibm power ha v7 technical deep dive workshop
solarisyougood
 
SD Times - Docker v2
SD Times - Docker v2
Alvin Richards
 
Advanced resource management and scalability features for cloud environment u...
Advanced resource management and scalability features for cloud environment u...
Grigale LTD
 
Accelerate with ibm storage ibm spectrum virtualize hyper swap deep dive
Accelerate with ibm storage ibm spectrum virtualize hyper swap deep dive
xKinAnx
 
Oracle ASM 11g - The Evolution
Oracle ASM 11g - The Evolution
Alex Gorbachev
 
Accelerate with ibm storage ibm spectrum virtualize hyper swap deep dive dee...
Accelerate with ibm storage ibm spectrum virtualize hyper swap deep dive dee...
xKinAnx
 
Se training storage grid webscale technical overview
Se training storage grid webscale technical overview
solarisyougood
 
High Availability Options for IBM i
High Availability Options for IBM i
HelpSystems
 
Emc vipr srm workshop
Emc vipr srm workshop
solarisyougood
 
Highly Available And Distributed Containers - ContainerCon NA 2016
Highly Available And Distributed Containers - ContainerCon NA 2016
{code}
 
Time finder
Time finder
Juby Manoj
 
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
WASdev Community
 
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
WASdev Community
 
Deploying Baremetal Instances with OpenStack
Deploying Baremetal Instances with OpenStack
Etsuji Nakai
 
Emc data domain technical deep dive workshop
Emc data domain technical deep dive workshop
solarisyougood
 
Scaling Xen within Rackspace Cloud Servers
Scaling Xen within Rackspace Cloud Servers
The Linux Foundation
 
Liberty management
Liberty management
WASdev Community
 
LinuxCon Japan 13 : 10 years of Xen and Beyond
LinuxCon Japan 13 : 10 years of Xen and Beyond
The Linux Foundation
 
Cisco cloud computing deploying openstack
Cisco cloud computing deploying openstack
solarisyougood
 
WebSphere Application Server Liberty Profile and Docker
WebSphere Application Server Liberty Profile and Docker
David Currie
 
EMC VNX
EMC VNX
Gokser GUL
 
Linux container & docker
Linux container & docker
ejlp12
 
Emc vplex deep dive
Emc vplex deep dive
solarisyougood
 
EMC World 2016 - Deep Dive with Mesos and Persistent Storage for Applications
EMC World 2016 - Deep Dive with Mesos and Persistent Storage for Applications
David vonThenen
 
Platform Provisioning Automation for Oracle Cloud
Platform Provisioning Automation for Oracle Cloud
Simon Haslam
 
Mastering Terraform and the Provider for OCI
Mastering Terraform and the Provider for OCI
Gregory GUILLOU
 

More Related Content

What's hot (20)

Oracle ASM 11g - The Evolution
Oracle ASM 11g - The Evolution
Alex Gorbachev
 
Accelerate with ibm storage ibm spectrum virtualize hyper swap deep dive dee...
Accelerate with ibm storage ibm spectrum virtualize hyper swap deep dive dee...
xKinAnx
 
Se training storage grid webscale technical overview
Se training storage grid webscale technical overview
solarisyougood
 
High Availability Options for IBM i
High Availability Options for IBM i
HelpSystems
 
Emc vipr srm workshop
Emc vipr srm workshop
solarisyougood
 
Highly Available And Distributed Containers - ContainerCon NA 2016
Highly Available And Distributed Containers - ContainerCon NA 2016
{code}
 
Time finder
Time finder
Juby Manoj
 
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
WASdev Community
 
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
WASdev Community
 
Deploying Baremetal Instances with OpenStack
Deploying Baremetal Instances with OpenStack
Etsuji Nakai
 
Emc data domain technical deep dive workshop
Emc data domain technical deep dive workshop
solarisyougood
 
Scaling Xen within Rackspace Cloud Servers
Scaling Xen within Rackspace Cloud Servers
The Linux Foundation
 
Liberty management
Liberty management
WASdev Community
 
LinuxCon Japan 13 : 10 years of Xen and Beyond
LinuxCon Japan 13 : 10 years of Xen and Beyond
The Linux Foundation
 
Cisco cloud computing deploying openstack
Cisco cloud computing deploying openstack
solarisyougood
 
WebSphere Application Server Liberty Profile and Docker
WebSphere Application Server Liberty Profile and Docker
David Currie
 
EMC VNX
EMC VNX
Gokser GUL
 
Linux container & docker
Linux container & docker
ejlp12
 
Emc vplex deep dive
Emc vplex deep dive
solarisyougood
 
EMC World 2016 - Deep Dive with Mesos and Persistent Storage for Applications
EMC World 2016 - Deep Dive with Mesos and Persistent Storage for Applications
David vonThenen
 
Oracle ASM 11g - The Evolution
Oracle ASM 11g - The Evolution
Alex Gorbachev
 
Accelerate with ibm storage ibm spectrum virtualize hyper swap deep dive dee...
Accelerate with ibm storage ibm spectrum virtualize hyper swap deep dive dee...
xKinAnx
 
Se training storage grid webscale technical overview
Se training storage grid webscale technical overview
solarisyougood
 
High Availability Options for IBM i
High Availability Options for IBM i
HelpSystems
 
Highly Available And Distributed Containers - ContainerCon NA 2016
Highly Available And Distributed Containers - ContainerCon NA 2016
{code}
 
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
WASdev Community
 
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
WASdev Community
 
Deploying Baremetal Instances with OpenStack
Deploying Baremetal Instances with OpenStack
Etsuji Nakai
 
Emc data domain technical deep dive workshop
Emc data domain technical deep dive workshop
solarisyougood
 
Scaling Xen within Rackspace Cloud Servers
Scaling Xen within Rackspace Cloud Servers
The Linux Foundation
 
LinuxCon Japan 13 : 10 years of Xen and Beyond
LinuxCon Japan 13 : 10 years of Xen and Beyond
The Linux Foundation
 
Cisco cloud computing deploying openstack
Cisco cloud computing deploying openstack
solarisyougood
 
WebSphere Application Server Liberty Profile and Docker
WebSphere Application Server Liberty Profile and Docker
David Currie
 
Linux container & docker
Linux container & docker
ejlp12
 
EMC World 2016 - Deep Dive with Mesos and Persistent Storage for Applications
EMC World 2016 - Deep Dive with Mesos and Persistent Storage for Applications
David vonThenen
 

Similar to Better Practices when Using Terraform to Manage Oracle Cloud Infrastructure (20)

Platform Provisioning Automation for Oracle Cloud
Platform Provisioning Automation for Oracle Cloud
Simon Haslam
 
Mastering Terraform and the Provider for OCI
Mastering Terraform and the Provider for OCI
Gregory GUILLOU
 
Getting Started with Terraform
Getting Started with Terraform
Revelation Technologies
 
Oracle Cloud deployment with Terraform
Oracle Cloud deployment with Terraform
Stefan Oehrli
 
Terraform: Taming the Machines Through Continuous Integration
Terraform: Taming the Machines Through Continuous Integration
Justin Rice
 
OracleBeer_Terraform_soe.pdf
OracleBeer_Terraform_soe.pdf
Stefan Oehrli
 
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
Tal Hibner
 
Infrastructure as Code with Terraform.pptx
Infrastructure as Code with Terraform.pptx
Samuel862293
 
Configuration management II - Terraform
Configuration management II - Terraform
Xavier Serrat Bordas
 
Terraform
Terraform
Phil Wilkins
 
DevOps Training - Introduction to Terraform
DevOps Training - Introduction to Terraform
Rauno De Pasquale
 
Oracle CloudWorld 2023 - A Practical Guide to Implementing DevOps with IaC fo...
Oracle CloudWorld 2023 - A Practical Guide to Implementing DevOps with IaC fo...
Juarez Junior
 
GDG Cloud Southlake #8 Steve Cravens: Infrastructure as-Code (IaC) in 2022: ...
GDG Cloud Southlake #8 Steve Cravens: Infrastructure as-Code (IaC) in 2022: ...
James Anderson
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
ssuser705051
 
Terraform-2.pdf
Terraform-2.pdf
rutiksankapal21
 
Introduction to IAC and Terraform
Introduction to IAC and Terraform
Venkat NaveenKashyap Devulapally
 
Instant download Terraform in Depth (MEAP V01) Robert Hafner pdf all chapter
Instant download Terraform in Depth (MEAP V01) Robert Hafner pdf all chapter
akceyohros
 
Unlocking the Cloud Operating Model: The Provisioning Strategy
Unlocking the Cloud Operating Model: The Provisioning Strategy
Mitchell Pronschinske
 
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
AkwasiBoateng6
 
Terraform Interview Questions By Scholarhat.pdf
Terraform Interview Questions By Scholarhat.pdf
Scholarhat
 
Platform Provisioning Automation for Oracle Cloud
Platform Provisioning Automation for Oracle Cloud
Simon Haslam
 
Mastering Terraform and the Provider for OCI
Mastering Terraform and the Provider for OCI
Gregory GUILLOU
 
Oracle Cloud deployment with Terraform
Oracle Cloud deployment with Terraform
Stefan Oehrli
 
Terraform: Taming the Machines Through Continuous Integration
Terraform: Taming the Machines Through Continuous Integration
Justin Rice
 
OracleBeer_Terraform_soe.pdf
OracleBeer_Terraform_soe.pdf
Stefan Oehrli
 
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
A case study why Zoominfo uses Terraform Cloud in high-scale environment.
Tal Hibner
 
Infrastructure as Code with Terraform.pptx
Infrastructure as Code with Terraform.pptx
Samuel862293
 
Configuration management II - Terraform
Configuration management II - Terraform
Xavier Serrat Bordas
 
DevOps Training - Introduction to Terraform
DevOps Training - Introduction to Terraform
Rauno De Pasquale
 
Oracle CloudWorld 2023 - A Practical Guide to Implementing DevOps with IaC fo...
Oracle CloudWorld 2023 - A Practical Guide to Implementing DevOps with IaC fo...
Juarez Junior
 
GDG Cloud Southlake #8 Steve Cravens: Infrastructure as-Code (IaC) in 2022: ...
GDG Cloud Southlake #8 Steve Cravens: Infrastructure as-Code (IaC) in 2022: ...
James Anderson
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
ssuser705051
 
Instant download Terraform in Depth (MEAP V01) Robert Hafner pdf all chapter
Instant download Terraform in Depth (MEAP V01) Robert Hafner pdf all chapter
akceyohros
 
Unlocking the Cloud Operating Model: The Provisioning Strategy
Unlocking the Cloud Operating Model: The Provisioning Strategy
Mitchell Pronschinske
 
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
Linode_eBook_Declarative_Cloud_Infrastructure_Management_with_Terraform.pptx
AkwasiBoateng6
 
Terraform Interview Questions By Scholarhat.pdf
Terraform Interview Questions By Scholarhat.pdf
Scholarhat
 
Ad

More from Simon Haslam (20)

Platform Engineering for the Modern Oracle World
Platform Engineering for the Modern Oracle World
Simon Haslam
 
What You Need to Know about Oracle Cloud Connectivity
What You Need to Know about Oracle Cloud Connectivity
Simon Haslam
 
Tips & Tricks for Oracle PaaS Admins
Tips & Tricks for Oracle PaaS Admins
Simon Haslam
 
Delivering Mobile Apps to the Field with Oracle
Delivering Mobile Apps to the Field with Oracle
Simon Haslam
 
Provisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack Manager
Simon Haslam
 
Oracle SOA Cloud - Skanska Customer Journey
Oracle SOA Cloud - Skanska Customer Journey
Simon Haslam
 
Tips & Tricks for Oracle PaaS Admins
Tips & Tricks for Oracle PaaS Admins
Simon Haslam
 
Delivering Mobile Apps to the Field with Oracle JET
Delivering Mobile Apps to the Field with Oracle JET
Simon Haslam
 
JET Hybrid Mobile Apps - taster for Oracle CodeOne
JET Hybrid Mobile Apps - taster for Oracle CodeOne
Simon Haslam
 
Delivering Mobile Apps to the field using Oracle
Delivering Mobile Apps to the field using Oracle
Simon Haslam
 
Provisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack Manager
Simon Haslam
 
Connecting Oracle Cloud to your Data Centre (Part A)
Connecting Oracle Cloud to your Data Centre (Part A)
Simon Haslam
 
Running SOA in the Cloud: SOA CS for SOA Suite Customers
Running SOA in the Cloud: SOA CS for SOA Suite Customers
Simon Haslam
 
Tips & Tricks for Java & SOA Cloud Service
Tips & Tricks for Java & SOA Cloud Service
Simon Haslam
 
SOA & WebLogic - Lift & Shift to the Cloud
SOA & WebLogic - Lift & Shift to the Cloud
Simon Haslam
 
Driving DevOps for Oracle with the orawls Puppet Modules
Driving DevOps for Oracle with the orawls Puppet Modules
Simon Haslam
 
Experiences of SOACS
Experiences of SOACS
Simon Haslam
 
3 Ways to Connect to the Oracle Cloud
3 Ways to Connect to the Oracle Cloud
Simon Haslam
 
SSL Everywhere!
SSL Everywhere!
Simon Haslam
 
Oracle Traffic Director - a vital part of your Oracle infrastructure
Oracle Traffic Director - a vital part of your Oracle infrastructure
Simon Haslam
 
Platform Engineering for the Modern Oracle World
Platform Engineering for the Modern Oracle World
Simon Haslam
 
What You Need to Know about Oracle Cloud Connectivity
What You Need to Know about Oracle Cloud Connectivity
Simon Haslam
 
Tips & Tricks for Oracle PaaS Admins
Tips & Tricks for Oracle PaaS Admins
Simon Haslam
 
Delivering Mobile Apps to the Field with Oracle
Delivering Mobile Apps to the Field with Oracle
Simon Haslam
 
Provisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack Manager
Simon Haslam
 
Oracle SOA Cloud - Skanska Customer Journey
Oracle SOA Cloud - Skanska Customer Journey
Simon Haslam
 
Tips & Tricks for Oracle PaaS Admins
Tips & Tricks for Oracle PaaS Admins
Simon Haslam
 
Delivering Mobile Apps to the Field with Oracle JET
Delivering Mobile Apps to the Field with Oracle JET
Simon Haslam
 
JET Hybrid Mobile Apps - taster for Oracle CodeOne
JET Hybrid Mobile Apps - taster for Oracle CodeOne
Simon Haslam
 
Delivering Mobile Apps to the field using Oracle
Delivering Mobile Apps to the field using Oracle
Simon Haslam
 
Provisioning with Oracle Cloud Stack Manager
Provisioning with Oracle Cloud Stack Manager
Simon Haslam
 
Connecting Oracle Cloud to your Data Centre (Part A)
Connecting Oracle Cloud to your Data Centre (Part A)
Simon Haslam
 
Running SOA in the Cloud: SOA CS for SOA Suite Customers
Running SOA in the Cloud: SOA CS for SOA Suite Customers
Simon Haslam
 
Tips & Tricks for Java & SOA Cloud Service
Tips & Tricks for Java & SOA Cloud Service
Simon Haslam
 
SOA & WebLogic - Lift & Shift to the Cloud
SOA & WebLogic - Lift & Shift to the Cloud
Simon Haslam
 
Driving DevOps for Oracle with the orawls Puppet Modules
Driving DevOps for Oracle with the orawls Puppet Modules
Simon Haslam
 
Experiences of SOACS
Experiences of SOACS
Simon Haslam
 
3 Ways to Connect to the Oracle Cloud
3 Ways to Connect to the Oracle Cloud
Simon Haslam
 
Oracle Traffic Director - a vital part of your Oracle infrastructure
Oracle Traffic Director - a vital part of your Oracle infrastructure
Simon Haslam
 
Ad

Recently uploaded (20)

Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
Daily Lesson Log MATATAG ICT TEchnology 8
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
UserCon Belgium: Honey, VMware increased my bill
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
Daily Lesson Log MATATAG ICT TEchnology 8
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
 
"Scaling in space and time with Temporal", Andriy Lupa.pdf
"Scaling in space and time with Temporal", Andriy Lupa.pdf
Fwdays
 
Lessons Learned from Developing Secure AI Workflows.pdf
Lessons Learned from Developing Secure AI Workflows.pdf
Priyanka Aash
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Using the SQLExecutor for Data Quality Management: aka One man's love for the...
Safe Software
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 

Better Practices when Using Terraform to Manage Oracle Cloud Infrastructure

  • 1. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. BEST PRACTICES WHEN USING TERRAFORM TO MANAGE ORACLE CLOUD INFRASTRUCTURE Simon Haslam eProseed
  • 2. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. ABOUT ME 2 Simon Haslam • Platform / Infrastructure Architect • Focus includes HA, DR, security, automation Relevant to this session • WebLogic / FMW installations since 2000s • First research/webcast on JCS in 2016 • Designed & built SOA CS integration platform for global use since Oct 2017 • On team migrating eProseed Lux data centres to OCI@simon_haslam since 2009
  • 3. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. ABOUT EPROSEED? 3 Oracle ACE Directors
  • 4. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. DISCLAIMER What is are “best practices” anyway…? ☺ 4
  • 5. Copyright © 2019, eProseed and/or its affiliates. All rights reserved.5 ➢ Why automate OCI provisioning? ➢ Real-world Terraform OCI examples ➢ Terraform ‘better practices’ ➢ A few more tips ☺ AGENDA
  • 6. Copyright © 2019, eProseed and/or its affiliates. All rights reserved.6 ➢ Why automate OCI provisioning? ➢ Real-world Terraform OCI examples ➢ Terraform ‘better practices’ ➢ A few more tips ☺ AGENDA
  • 7. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. WHY AUTOMATE OCI PROVISIONING? 7
  • 8. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. PAAS PROVISIONING 8
  • 9. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. PAAS PROVISIONING 9 Terraform provides an abstraction layer above OCI’s REST APIs
  • 10. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. TERRAFORM’S PURPOSE “Terraform is a tool for building, changing and versioning infrastructure safely and efficiently” 10 Cloud-agnostic but not generic (each cloud has own providers)
  • 11. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. BOUNDARIES 12 resourcesPROVISIONING This provisions resources & optionally calls “provisioner” e.g. network VM instance PaaS instance VM images might be Oracle supplied plain ones, Oracle-supplied PaaS ones, or your own (e.g. from Packer), Maintains state of infra Optional Provisioner CONFIGURATION MANAGEMENT This configures resources e.g. TLS certificates & identity CM self-registration Maintains internal state of resources (instances)
  • 12. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. TERRAFORM PROVIDERS • A provider tells Terraform how to build and manage one or many resource types • Providers are supplied by Hashicorp, a resource provider (like Oracle), or 3rd party/community 13
  • 13. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. MORE ABOUT TERRAFORM PROVIDERS • Providers are either: – Integrated: downloaded by Terraform when needed – Non-integrated: install from 3rd party or write your own • 3 Oracle-developed providers available: 14 oci oracle paas opc More about these in a minute..These 3 Oracle providers are all now integrated into TF X X
  • 14. Copyright © 2019, eProseed and/or its affiliates. All rights reserved.15 oci oracle paas opc almost legacy legacy
  • 15. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. OCI PROVIDER Infrastructure & OCI-native PaaS https://www.terraform.io/docs/providers/oci/index.html 16 Lots of resources - examples:
  • 16. Copyright © 2019, eProseed and/or its affiliates. All rights reserved.17 ➢ Why automate OCI provisioning? ➢ Real-world Terraform OCI examples ➢ Terraform ‘better practices’ ➢ A few more tips ☺ AGENDA
  • 17. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. GETTING STARTED • You need a host to run Terraform from – could be your PC, a cloud instance, or build server • Oracle Linux 7 example: sudo yum install -y terraform • Create/reuse .tf config files & set up .tfvars for your account/env • The .tf files need to have one or more providers specified 18 terraform init terraform plan terraform apply …terraform destroy
  • 18. Copyright © 2019, eProseed and/or its affiliates. All rights reserved.19 DEMO
  • 19. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. BIG PICTURE EXAMPLE 20 DRG Dynamic Routing Gateway On-prem Another VCN Another cloud admin
  • 20. Copyright © 2019, eProseed and/or its affiliates. All rights reserved.21 ➢ Why automate OCI provisioning? ➢ Real-world Terraform OCI examples ➢ Terraform ‘better practices’ ➢ A few more tips ☺ AGENDA
  • 21. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. 1. IT’S NEVER TOO EARLY TO START TERRAFORM • Using the OCI consoles can be time consuming • Cumulative effect • You want to experiment as much as possible • Exception: Compartment creation: slow, leaves trail don’t (re)create compartments often 22
  • 22. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. 2. USE SOURCE CODE CONTROL • Infrastructure as Code… naturally you want to version it – You probably can’t go back far but you can see who changed what & when • Use git – De-facto SCM these days • Don’t use branches – Or if you do, have branches for different environments (e.g. Puppet model) 23
  • 23. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. 3. STORE YOUR .TFSTATE CENTRALLY • OCI Object storage (simple), or, • terraform.io service (more advanced) 24
  • 24. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. 4. USE TERRAFORM 0.12 • Language updates from 0.11 to 0.12 • There’s an auto upgrade from 0.11 to 0.12 but I found a couple of things broke https://www.terraform.io/upgrade-guides/0-12.html 25
  • 25. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. 5. STRUCTURE MULTIPLE TF CONFIGURATIONS • You only want one person at a time making changes in same area • Probably best to have TF by top-level compartment plus one global • Depends on organisation structure 26
  • 26. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. 6. DON’T USE -AUTO-APPROVE • This is my opinion of a best practice ☺ • -auto-approve means an apply makes changes without prompting • You get into habit of up-up-return… errors can easily happen (once, twice,…) • Exception: use -auto-approve on CI server ☺ 27
  • 27. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. 7. DECIDE WHEN TO USE TF & WHEN NOT • Terraform: – Its strength is converged state – use it often but for few changes – State convergence sophistication is up to the provider developer • Update OCI Instance hostname - good • Update OCI Database Service PDB name – not so good – Use for static deployments – compartments, networks, load balancers etc • Ansible – Can manage state but often run in fire & forget mode – Fire & forget is more aligned to traditional change processes – You need a tool to customise most PaaS instances anyway – Use for most types of instances 28
  • 28. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. 8. UPDATE YOUR OCI PROVIDER REGULARLY • Terraform Provider for OCI changes in 2 ways: – New features & bug fixes – Changes to OCI REST APIs • You may be forced to update it in a hurry otherwise 29
  • 29. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. 9. USE A MODERN EDITOR + TF PLUG-IN Extension available for Microsoft VS Code editor 30
  • 30. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. 10. SUBSCRIBE TO TERRAFORM-PROVIDER-OCI ISSUES 31
  • 31. Copyright © 2019, eProseed and/or its affiliates. All rights reserved.32
  • 32. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. TERRAFORM FOR OCI – BETTER PRACTICES 1. Start with Terraform early, really early, on your OCI journey 2. Use Git, but one branch (or one per env for separate TF state) 3. Store your .tfstate centrally (e.g. in OCI object storage bucket) 4. Use Terraform 0.12, especially if starting from scratch 5. Structure multiple TF configurations, probably by compartment 6. Don’t use -auto-approve (except from CI server) 7. Decide when to use TF & when not 8. Update your OCI provider regularly (you may be forced to in a hurry otherwise) 9. Use a modern editor (like VS Code) + TF plug-in 10. Subscribe to terraform-provider-oci issues33
  • 33. Copyright © 2019, eProseed and/or its affiliates. All rights reserved.34 ➢ Why automate OCI provisioning? ➢ Real-world Terraform OCI examples ➢ Terraform ‘better practices’ ➢ A few more tips ☺ AGENDA
  • 34. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. A FEW MORE TIPS • Watch your costs! This is cloud after all… • Environment variables • TF modules are very handy for scaling number of instances 35
  • 35. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. ENVIRONMENT VARIABLES FOR DIFFERENT TENANCIES 36 From OCI provider doc: https://www.terraform.io/docs/providers/oci/index.html
  • 36. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. TERRAFORM MODULES Our example use case • Lots of identical compute instances needed for on-prem provisioning automation • 3 different types of modules: – Fusion Middleware – Database – Provisioning Server • All VMs identical for module type – pick how many you want • But YMMV - there may be a better way than this for you ☺ 37
  • 37. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. TERRAFORM FOR OCI – BETTER PRACTICES 1. Start with Terraform early, really early, on your OCI journey 2. Use Git, but one branch (or one per env for separate TF state) 3. Store your .tfstate centrally (e.g. in OCI object storage bucket) 4. Use Terraform 0.12, especially if starting from scratch 5. Structure multiple TF configurations, probably by compartment 6. Don’t use -auto-approve (except from CI server) 7. Decide when to use TF & when not 8. Update your OCI provider regularly (you may be forced to in a hurry otherwise) 9. Use a modern editor (like VS Code) + TF plug-in 10. Subscribe to terraform-provider-oci issues38
  • 38. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. ORACLE EXAMPLES • https://github.com/oracle/terraform-examples Starting point for some cases – reasonable activity (91 commits) • https://oracle.rainfocus.com/widget/oracle/oow18/catalogoow18?search=HOL6376 39 Start here! Probably takes 1-3h
  • 39. Copyright © 2019, eProseed and/or its affiliates. All rights reserved. HANDS-ON-LAB TIP Trial account does not have sufficient compute resources to run the HOL: => Raise an SR to get this increased, e.g. to 10 for 2.1 shape (change shape in .tf config): 40Paid for accounts have default limit of 40 per AD for small VMs https://docs.cloud.oracle.com/iaas/Content/General/Concepts/servicelimits.htm
  • 40. Copyright © 2019, eProseed and/or its affiliates. All rights reserved.41 @simon_haslam Q & A
  • 41. Mobile Process / Integration Analytics / Big Data Database / Data Management Identity & Access Management Oracle Cloud eProseed Confidential42