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

More Related Content

What's hot (20)

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

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

More from Simon Haslam (20)

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

Recently uploaded (20)

PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 

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