Spinnaker Application management by Terraform Plugins

46fdd2ebc85d68659b83d5eb5c6a49aa?s=47 Keke
July 03, 2020

Spinnaker Application management by Terraform Plugins

HashiTalk Japan 2020/7/3 16:00 ~ 16:15での発表です。

46fdd2ebc85d68659b83d5eb5c6a49aa?s=128

Keke

July 03, 2020
Tweet

Transcript

  1. Spinnaker Application management by Terraform Plugins HashiTalk Japan 2020/7/3 16:00~16:15

    Keisuke Yamashita (Twitter: @_k_e_k_e) Copyright © 2019 HashiCorp
  2. Keisuke Yamashita Twitter: @_k_e_k_e Merpay SRE ・ Microservices Platform CI/CD

    Team
  3. Agenda ・About Terraform Plugins ・Manage Spinnaker Applications w/ Terraform Providers

    ・Operation by Terraform Provisioners ・Wrap up
  4. About Terraform Plugins

  5. Terraform When terraform is executed...

  6. Terraform = Terraform Core + Terraform Plugins Terraform Cores •

    Entrypoint for Terraform • Resource state management • Communicate with Terraform Plugins Terraform Plugins • Executable binary called by Terraform Core • Exposes an implementation for a specific services(GCP, AWS, local host, etc)
  7. Terraform Plugins = Terraform Providers + Terraform Provisioners

  8. Terraform Plugins = Terraform Providers + Terraform Provisioners Terraform Providers

    • Access external service APIs and CRUD resources • Managed Terraform State Terraform Provisioners • Run model specific actions for preparing the resources
  9. Manage Spinnaker Applications by Terraform Provider

  10. Spinnaker Spinnaker is an open source, multi-cloud continuous delivery platform

  11. Spinnaker Spinnaker is an open source, multi-cloud continuous delivery platform

    Service Team Spinnaker Application Trigger Deploy
  12. Spinnaker Spinnaker is an open source, multi-cloud continuous delivery platform

    Service Team Spinnaker Application Trigger Deploy How to manage Spinnaker Applications?
  13. Terraform Providers The three kinds 1. Built-in Providers • Null

    provider • Secret provider • … 2. Hashicorp distributed Providers • terraform-provider-gcp • terraform-provider-aws • terraform-provider-vault
  14. Terraform Providers The three kinds 3. Custom Providers • Third-party

    developed providers • Develop by yourself
  15. mercari/terraform-provider-spinnaker Originally forked from armory-io/terraform-provider-spinnaker

  16. Manage Spinnaker Applications CODE EDITOR resource “spinnaker_application” “my_app” { application

    = “my-app” email = “keke@hello.com” } resource “spinnaker_application” “my_test_app” { application = “my-test-app” email = “keke@hello.com” }
  17. Manage Spinnaker Applications CODE EDITOR resource “spinnaker_application” “my_app” { application

    = “my-app” email = “keke@hello.com” } resource “spinnaker_application” “my_test_app” { application = “my-test-app” email = “keke@hello.com” }
  18. Terraform Providers Take away To Terraform manage resources… 1. Check

    if there are built-in providers 2. Check if Hashicorp distributes the provider 3. Check custom provider in the community, GitHub, etc 4. Develop by yourself! Ideally, there are no limits what you can manage!
  19. Terraform Providers Take away But… • Built-in provider: It’s built-in

    • Hashicorp distributed provider: Terraform will download on terraform init • Custom Provider: You need to manually download to your environment
  20. Operation by Terraform Provisioner

  21. Spinnaker Spinnaker is an open source, multi-cloud continuous delivery platform

    New Spinnaker Application Create Old Spinnaker Application
  22. Spinnaker Spinnaker is an open source, multi-cloud continuous delivery platform

    New Spinnaker Application Create Old Spinnaker Application How to delete old application? Delete
  23. Terraform Provisioners List of provisioners • Chef • File •

    habitat • puppet • remote-exec • salt-masterless • local-exec: Run any script on resource create or delete. See details Provisioners(https://www.terraform.io/docs/provisioners/index.html)
  24. local-exec Terraform Provisioner Runs script on resource create CODE EDITOR

    resource “spinnaker_application” “my_app” { application = “my-app” email = “keke@hello.com provisioner “local-exec” { command = “./script/delete-app.sh my-old-app” } }
  25. Terraform Provisioners Take away There are many actions provided by

    Terraform Provisioners. Ideally, you can run any operation by local-exec provisioner. Very useful for many use cases.
  26. Terraform Provisioners Take away There are many actions provided by

    Terraform Provisioners. Ideally, you can run any operation by local-exec provisioner. Very useful for many use cases. No custom provisioners!
  27. Wrap up

  28. Manage Spinnaker Application by Terraform Plugins Managed Spinnaker application by

    custom Providers By developing custom Terraform Providers, you can ideally manage any resource. Start building one!
  29. Manage Spinnaker Application by Terraform Plugins Managed Spinnaker application by

    custom Providers By developing custom Terraform Providers, you can ideally manage any resource. Start building one! Provisions are done by local-exec Provisioners Terraform is mainly used as provisioning tool but can be also used as configuration management tool.
  30. Terraform has high extensibility which fits is many use cases

  31. Thank You! HashiTalk Japan 2020 Keisuke Yamashita (Twitter: @_k_e_k_e) 31