SlideShare a Scribd company logo
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Developing a (VCD)
Terraform Provider
Brett Mack Nicki Watt
@phpops @techiewatt
28/01/2016
1
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2
Who are we?
• Hands on consultants

• Worked with a variety of clients using
various HashiCorp products

• HashiCorp partner





----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3
https://www.opencredo.com/2015/08/10/
boot-my-secure-government-cloud
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4
Agenda
• Terraform Introduction

• The VCD Terraform provider 

approach and lessons learned

• Conclusion 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The
Super Quick
5
Terraform
Introduction
^
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 6
Creates, manages, and manipulates
infrastructure resources.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 7
Multiple Infrastructure Providers -
IAAS, PAAS, SAAS
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 8
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 9
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 10
Developing a (VCD)
Terraform provider
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 11
What is a
Terraform Provider Plugin?
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 12
Atlas DNSMadeEasy PowerDNS
AWS Docker Rundeck
Azure Dyn StatusCake
CloudFlare Google Cloud Template
CloudStack Heroku Terraform
Consul Mailgun TLS
Datadog OpenStack VMware vCloud Director
DigitalOcean Packet VMware vSphere
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 13
Atlas DNSMadeEasy PowerDNS
AWS Docker Rundeck
Azure Dyn StatusCake
CloudFlare Google Cloud Template
CloudStack Heroku Terraform
Consul Mailgun TLS
Datadog OpenStack VMware vCloud Director
DigitalOcean Packet VMware vSphere
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 14
Define what you want to control with
Terraform
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
vCloud Director
15
Edge Gateway
Internal Network
Destination NAT Source NATFirewall Rules
VApp VApp
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
vCloud Director
16
Edge Gateway
Internal Network
Destination NAT Source NATFirewall Rules
VApp VApp
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 17
Core Terraform Provider
Plugin Concepts
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 18
Provider
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 19
Provider
Resource
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 20
Resource
Schema
Provider
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Plugin
21
Resource
Schema
Provider
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 22
provider "vcd" {
…
}
resource “vcd_vapp” “web”
…
}
vms.tf
VCD Provider
Terraform launches provider binary
Preferred method of communication
Starts listening
Address given back to Terraform
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 23
How do these concepts
map to VCD?
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 24
vCloud Director
Edge Gateway
VDC Network
Destinati SourceFirewall
VApp VApp
Plugin
Details to
establish
connection
Individual
components
which can be
controlled
Contract
defining rules
when interacting
with resources
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 25
Schema
Provider
user
password
org
url
vdc
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 26
Schema
user
ValueType
Flags
Description
Default
Computed
Required
Optional
ForceNew
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 27
Schema
user
ValueType
Flags
Description
Default
Computed
Required
Optional
ValueType: TypeString
Description: vCD Username
Required: True
Computed
ForceNew
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 28
Resource
Provider Network
VApp
Firewall Rules
DNAT
SNAT
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 29
Resource
Create
Read
Update
Delete
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 30
Resource
Create
Read
Update
Delete
Exists
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 31
Defining the Provider in Go
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 32
func Provider() terraform.ResourceProvider {
return &schema.Provider{
Schema: map[string]*schema.Schema{
"user": &schema.Schema{
Type: schema.TypeString,
Required: true,
Description: “vCloud Director Username.",
},
"password": &schema.Schema{
Type: schema.TypeString,
Required: true,
Description: “vCloud Director Password.",
},
…
provider.go
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 33
func Provider() terraform.ResourceProvider {
return &schema.Provider{
Schema: …,
ResourcesMap: map[string]*schema.Resource{
"vcd_network": resourceVcdNetwork(),
"vcd_vapp": resourceVcdVApp(),
"vcd_firewall_rules": resourceVcdFirewallRules(),
"vcd_dnat": resourceVcdDNAT(),
"vcd_snat": resourceVcdSNAT(),
},
}
provider.go
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 34
Issues we encountered
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 35
Conclusion
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 36
Thanks 

Questions

More Related Content

What's hot

7 Deadly Sins of Sales
7 Deadly Sins of Sales7 Deadly Sins of Sales
7 Deadly Sins of Sales
Nanette Bajador
 
Formato para crear carta
Formato para crear carta Formato para crear carta
Formato para crear carta
Fabián Cuevas
 
Formato de carta
Formato de cartaFormato de carta
Formato de carta
Alejandra Janylla
 
Hitzak banatu II
Hitzak banatu IIHitzak banatu II
Hitzak banatu II
idoialariz
 
Hitzak banatu I
Hitzak banatu  IHitzak banatu  I
Hitzak banatu I
idoialariz
 
Sagardoaren prozesua
Sagardoaren prozesuaSagardoaren prozesua
Sagardoaren prozesua
MargaGutierrez
 
Aashura urdu
Aashura urduAashura urdu
GEOMETRÍA ANIMAL
GEOMETRÍA ANIMALGEOMETRÍA ANIMAL
GEOMETRÍA ANIMAL
SilviaGGuzmán Guzman
 
fun with english G1 U1
fun with english G1 U1fun with english G1 U1
fun with english G1 U1
fatma aljanoubi
 
มติ+1+ปณ...[1]
มติ+1+ปณ...[1]มติ+1+ปณ...[1]
มติ+1+ปณ...[1]
Nbtc Rights
 
Clase 8 al 12 septiembre
Clase 8 al 12 septiembreClase 8 al 12 septiembre
Clase 8 al 12 septiembre
Pablo Ronquillo
 

What's hot (17)

7 Deadly Sins of Sales
7 Deadly Sins of Sales7 Deadly Sins of Sales
7 Deadly Sins of Sales
 
مخرجات الدرس
مخرجات الدرسمخرجات الدرس
مخرجات الدرس
 
Formato para crear carta
Formato para crear carta Formato para crear carta
Formato para crear carta
 
Formato de carta
Formato de cartaFormato de carta
Formato de carta
 
Hitzak banatu II
Hitzak banatu IIHitzak banatu II
Hitzak banatu II
 
Hitzak banatu I
Hitzak banatu  IHitzak banatu  I
Hitzak banatu I
 
Sagardoaren prozesua
Sagardoaren prozesuaSagardoaren prozesua
Sagardoaren prozesua
 
Aashura urdu
Aashura urduAashura urdu
Aashura urdu
 
GEOMETRÍA ANIMAL
GEOMETRÍA ANIMALGEOMETRÍA ANIMAL
GEOMETRÍA ANIMAL
 
fun with english G1 U1
fun with english G1 U1fun with english G1 U1
fun with english G1 U1
 
Analisis novel
Analisis novelAnalisis novel
Analisis novel
 
El koala
El koalaEl koala
El koala
 
มติ+1+ปณ...[1]
มติ+1+ปณ...[1]มติ+1+ปณ...[1]
มติ+1+ปณ...[1]
 
تكنو 6
تكنو 6تكنو 6
تكنو 6
 
Exercices a saja
Exercices a sajaExercices a saja
Exercices a saja
 
Clase 8 al 12 septiembre
Clase 8 al 12 septiembreClase 8 al 12 septiembre
Clase 8 al 12 septiembre
 
VOCABULARIO
VOCABULARIOVOCABULARIO
VOCABULARIO
 

More from London HashiCorp User Group

London HUG 15/8/17 - Elseviers World using Nomad
London HUG 15/8/17 - Elseviers World using NomadLondon HUG 15/8/17 - Elseviers World using Nomad
London HUG 15/8/17 - Elseviers World using Nomad
London HashiCorp User Group
 
London HUG 15/8/17 - Lifeguard
London HUG 15/8/17 - LifeguardLondon HUG 15/8/17 - Lifeguard
London HUG 15/8/17 - Lifeguard
London HashiCorp User Group
 
London Hug 20/6 - Clustering RabbitMQ using Consul
London Hug 20/6 - Clustering RabbitMQ using ConsulLondon Hug 20/6 - Clustering RabbitMQ using Consul
London Hug 20/6 - Clustering RabbitMQ using Consul
London HashiCorp User Group
 
London Hug 20/6 - Vault production
London Hug 20/6 - Vault productionLondon Hug 20/6 - Vault production
London Hug 20/6 - Vault production
London HashiCorp User Group
 
London HUG 12/4
London HUG 12/4London HUG 12/4
London HUG 14/3
London HUG 14/3London HUG 14/3
London Hug 19/5 - Terraform in Production
London Hug 19/5 - Terraform in ProductionLondon Hug 19/5 - Terraform in Production
London Hug 19/5 - Terraform in Production
London HashiCorp User Group
 
London HUG 19/5 - Kubernetes and vault
London HUG 19/5 - Kubernetes and vaultLondon HUG 19/5 - Kubernetes and vault
London HUG 19/5 - Kubernetes and vault
London HashiCorp User Group
 
London HUG 14/4 - Infratructure mgmt
London HUG 14/4 - Infratructure mgmtLondon HUG 14/4 - Infratructure mgmt
London HUG 14/4 - Infratructure mgmt
London HashiCorp User Group
 
London HUG 14/4 - Deploying and Discovering at Scale with Consul and Nomad
London HUG 14/4 - Deploying and Discovering at Scale with Consul and NomadLondon HUG 14/4 - Deploying and Discovering at Scale with Consul and Nomad
London HUG 14/4 - Deploying and Discovering at Scale with Consul and Nomad
London HashiCorp User Group
 
London HUG 8/3 - Nomad
London HUG 8/3 - NomadLondon HUG 8/3 - Nomad
London HUG 8/3 - Nomad
London HashiCorp User Group
 
London HUG 8/3 - JustEat - Andrew Brown / Alberto Blanco
London HUG 8/3 - JustEat - Andrew Brown / Alberto BlancoLondon HUG 8/3 - JustEat - Andrew Brown / Alberto Blanco
London HUG 8/3 - JustEat - Andrew Brown / Alberto Blanco
London HashiCorp User Group
 

More from London HashiCorp User Group (12)

London HUG 15/8/17 - Elseviers World using Nomad
London HUG 15/8/17 - Elseviers World using NomadLondon HUG 15/8/17 - Elseviers World using Nomad
London HUG 15/8/17 - Elseviers World using Nomad
 
London HUG 15/8/17 - Lifeguard
London HUG 15/8/17 - LifeguardLondon HUG 15/8/17 - Lifeguard
London HUG 15/8/17 - Lifeguard
 
London Hug 20/6 - Clustering RabbitMQ using Consul
London Hug 20/6 - Clustering RabbitMQ using ConsulLondon Hug 20/6 - Clustering RabbitMQ using Consul
London Hug 20/6 - Clustering RabbitMQ using Consul
 
London Hug 20/6 - Vault production
London Hug 20/6 - Vault productionLondon Hug 20/6 - Vault production
London Hug 20/6 - Vault production
 
London HUG 12/4
London HUG 12/4London HUG 12/4
London HUG 12/4
 
London HUG 14/3
London HUG 14/3London HUG 14/3
London HUG 14/3
 
London Hug 19/5 - Terraform in Production
London Hug 19/5 - Terraform in ProductionLondon Hug 19/5 - Terraform in Production
London Hug 19/5 - Terraform in Production
 
London HUG 19/5 - Kubernetes and vault
London HUG 19/5 - Kubernetes and vaultLondon HUG 19/5 - Kubernetes and vault
London HUG 19/5 - Kubernetes and vault
 
London HUG 14/4 - Infratructure mgmt
London HUG 14/4 - Infratructure mgmtLondon HUG 14/4 - Infratructure mgmt
London HUG 14/4 - Infratructure mgmt
 
London HUG 14/4 - Deploying and Discovering at Scale with Consul and Nomad
London HUG 14/4 - Deploying and Discovering at Scale with Consul and NomadLondon HUG 14/4 - Deploying and Discovering at Scale with Consul and Nomad
London HUG 14/4 - Deploying and Discovering at Scale with Consul and Nomad
 
London HUG 8/3 - Nomad
London HUG 8/3 - NomadLondon HUG 8/3 - Nomad
London HUG 8/3 - Nomad
 
London HUG 8/3 - JustEat - Andrew Brown / Alberto Blanco
London HUG 8/3 - JustEat - Andrew Brown / Alberto BlancoLondon HUG 8/3 - JustEat - Andrew Brown / Alberto Blanco
London HUG 8/3 - JustEat - Andrew Brown / Alberto Blanco
 

London HUG 8/3 - Developing a (VCD) Terraform Provider