Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

London Hashicorp Meetup (8th Mar 2016)

227 views

Published on

Slides from London's first Hashicorp Meetup. OpenCredo consultants Brett Mack and Nicki Watt give a run down on Terraform and how they created a Terraform Provider to use VMWare's vCloud Director

Published in: Technology
  • Be the first to comment

  • Be the first to like this

London Hashicorp Meetup (8th Mar 2016)

  1. 1. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Developing a (VCD) Terraform Provider Brett Mack Nicki Watt @phpops @techiewatt 28/01/2016 1
  2. 2. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 Who are we? • Hands on consultants
 • Worked with a variety of clients using various HashiCorp products
 • HashiCorp partner
 
 

  3. 3. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3 https://www.opencredo.com/2015/08/10/ boot-my-secure-government-cloud
  4. 4. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4 Agenda • Terraform Introduction
 • The VCD Terraform provider 
 approach and lessons learned
 • Conclusion 

  5. 5. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- The Super Quick 5 Terraform Introduction ^
  6. 6. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 6 Creates, manages, and manipulates infrastructure resources.
  7. 7. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 7 Multiple Infrastructure Providers - IAAS, PAAS, SAAS
  8. 8. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 8
  9. 9. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 9
  10. 10. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 10 Developing a (VCD) Terraform provider
  11. 11. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 11 What is a Terraform Provider Plugin?
  12. 12. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 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. 13. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 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. 14. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 14 Define what you want to control with Terraform
  15. 15. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- vCloud Director 15 Edge Gateway Internal Network Destination NAT Source NATFirewall Rules VApp VApp
  16. 16. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- vCloud Director 16 Edge Gateway Internal Network Destination NAT Source NATFirewall Rules VApp VApp
  17. 17. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 17 Core Terraform Provider Plugin Concepts
  18. 18. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 18 Provider
  19. 19. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 19 Provider Resource
  20. 20. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 20 Resource Schema Provider
  21. 21. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Plugin 21 Resource Schema Provider
  22. 22. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 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. 23. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 23 How do these concepts map to VCD?
  24. 24. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 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. 25. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 25 Schema Provider user password org url vdc
  26. 26. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 26 Schema user ValueType Flags Description Default Computed Required Optional ForceNew
  27. 27. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 27 Schema user ValueType Flags Description Default Computed Required Optional ValueType: TypeString Description: vCD Username Required: True Computed ForceNew
  28. 28. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 28 Resource Provider Network VApp Firewall Rules DNAT SNAT
  29. 29. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 29 Resource Create Read Update Delete
  30. 30. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 30 Resource Create Read Update Delete Exists
  31. 31. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 31 Defining the Provider in Go
  32. 32. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 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. 33. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 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. 34. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 34 Issues we encountered
  35. 35. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 35 Conclusion
  36. 36. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 36 Thanks Questions

×