Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
tfnotify - Show Terraform execution plan beauti...
Search
BABAROT
September 11, 2018
Technology
5
13k
tfnotify - Show Terraform execution plan beautifully on GitHub
https://hashicorp.connpass.com/event/98386/
BABAROT
September 11, 2018
Tweet
Share
More Decks by BABAROT
See All by BABAROT
SLOをゼロからつくる
b4b4r07
15
5.9k
Cloud Functions in Go at Mercari
b4b4r07
9
5.7k
Insert an Example of Software Engineer Here
b4b4r07
4
1.8k
Kubernetes manifests management and operation in Mercari
b4b4r07
27
6.9k
Testing with YAML
b4b4r07
5
5.1k
Micoservices Platform in Mercari
b4b4r07
3
150
Terraform Ops for Microservices
b4b4r07
16
15k
シェルスクリプトを書く技術
b4b4r07
3
1.1k
Other Decks in Technology
See All in Technology
Amazon Personalizeのレコメンドシステム構築、実際何するの?〜大体10分で具体的なイメージをつかむ〜
kniino
1
100
強いチームと開発生産性
onk
PRO
35
11k
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
410
個人でもIAM Identity Centerを使おう!(アクセス管理編)
ryder472
4
220
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
9
1k
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
600
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
480
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
200
Lambdaと地方とコミュニティ
miu_crescent
2
370
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
160
rootlessコンテナのすゝめ - 研究室サーバーでもできる安全なコンテナ管理
kitsuya0828
3
390
IBC 2024 動画技術関連レポート / IBC 2024 Report
cyberagentdevelopers
PRO
1
110
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
KATA
mclloyd
29
14k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Practical Orchestrator
shlominoach
186
10k
Designing for humans not robots
tammielis
250
25k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
130
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Transcript
tfnotify @b4b4r07 (Sep 11, 2018) / HashiCorp Meetup #3 DevOps
Λࢧ͑Δࠓͷ HashiCorp πʔϧ܈ʹ͍ͭͯ Show Terraform execution plan beautifully on GitHub
BABAROT / @b4b4r07 Mercari, Inc. SRE, Microservices Platform Blog /
tellme.tokyo
1. mercari/tfnotify 2. Why tfnotify? 3. Implementations Agenda
mercari/tfnotify
• Go CLI πʔϧ • Terraform ͷ࣮ߦ݁ՌΛύʔε͠ɺ దͳϑΥʔϚοτʹ͋ͯΊͯɺ ҙͷ௨ઌ
(GitHub ͷίϝϯτ) ௨͢Δ tfnotify ͱ
tfnotify Workflow DSFBUFE UFSSBGPSNQMBOcUGOPUJGZQMBO 1045DPN N FOU PVUQVU
tfnotify Workflow N FSHFE UFSSBGPSNBQQMZcUGOPUJGZBQQMZ 1045DPN N FOU PVUQVU
Example • fmt • plan • apply
Example {{.Title}} {{.Message}} {{.Result}} {{.Body}} ࣮ߦग़ྗͯ͢ ࣮ߦ݁ՌͷαϚϦ --messageͰͤΔ ҙͷλΠτϧ
Why tfnotify?
ͳͥඞཁͱͳͬͨͷ͔ • ϝϧΧϦͰ Microservices ྖҬͰ Terraform Λར༻͍ͯ͠Δ • Ownership ͷ؍͔ΒΠϯϑϥཧʹ͓͍ͯϨϏϡʔɾϚʔδ
֤ Micorservices νʔϜʹΑͬͯ͞ΕΔ͖ • ͱ͍ͬͯɺPlatform νʔϜʹϨϏϡʔ͞Ε͍ͨέʔε͋Δ
ͳͥඞཁͱͳͬͨͷ͔ • Platform νʔϜͱͯ͠ɺ֤ Microservices νʔϜͱͯ͠ɺ Infrastructure as Code ͷॏཁੑΛཧղ͠
Terraform ͰίʔυԽ͠ɺ ͦͷ࣮ߦܭըΛຖճݟΔ͜ͱΛश׳͚͍ͮͨ • ຖଟ͘ͷ P-R ͕͋ΔதɺCircle CI ʹݟʹ͍͘खؒΛল͖͍ͨ →ϨϏϡʔͷྲྀΕͰ GitHub ্ͰΫΠοΫʹ֬ೝ͍ͨ͠
ϝϧΧϦͰͷ HashiCorp πʔϧ
ϝϧΧϦͰͷ HashiCorp πʔϧ • ϝϧΧϦʹ 70 Ҏ্ͷ Microservices ͕͋Δ (ࠓݱࡏɽ૿͑ଓ͚͍ͯΔ)
• ͯ͢ͷ Microservices ͱͦͷ Platform ͷ Πϯϑϥߏஙʹ Terraform Λར༻͍ͯ͠Δ • Developers ʹ Infrastructure as Code Λ ࣮ફͯ͠Β͏
ϝϧΧϦͰͷ Terraform ར༻ࣄྫ
ϝϧΧϦͰͷ Terraform ར༻ࣄྫ
ϝϧΧϦͰͷ Terraform ར༻ࣄྫ
ϝϧΧϦͰͷ Terraform ར༻ࣄྫ
ϝϧΧϦͰͷ Terraform ར༻ࣄྫ • Insights • 110+ Contributors • 8
~ 10 Pull Requests / week (5 days) • 140+ state files (70+ Microservices * 2 Env) • ͻͱͭͷதԝϦϙδτϦͰͯ͢ͷ Terraform ίʔυΛཧ͍ͯ͠Δ • CI pipeline ͷߏங͕ҰͰࡁΉ • Platform νʔϜ͕ϨϏϡʔʹೖΓ͍͢
ϦϙδτϦߏ • ֤ Microservice ͝ͱʹ σΟϨΫτϦΛ͚Δ • Service ͝ͱʹ tfstate
Λ͚Δ • ӨڹΛଞٴͤ͞ͳ͍ • Resource ͝ͱʹ file Λ͚Δ • ϦιʔεఆٛॴΛ໌֬Խ • CODEOWNERS Ͱݖݶҕৡ
ϦϙδτϦߏ • ֤ Microservice ͝ͱʹ σΟϨΫτϦΛ͚Δ • Service ͝ͱʹ tfstate
Λ͚Δ • ӨڹΛଞٴͤ͞ͳ͍ • Resource ͝ͱʹ file Λ͚Δ • ϦιʔεఆٛॴΛ໌֬Խ • CODEOWNERS Ͱݖݶҕৡ தԝूݖ ཱࣗࢄ
ݖݶҕৡ IUUQTCMPHHJUIVCDPNJOUSPEVDJOHDPEFPXOFST • GitHub ͷػೳ • CODEOWNERS ʹهࡌ͞Ε ͨਓ͔Β Approve
͞ΕΔ ·ͰϚʔδͰ͖ͳ͍Α͏ʹ Ͱ͖Δ • ͜ΕʹΑΓݖݶҕৡΛ࣮ݱ • (উखʹมߋͰ͖ͳ͍)
ݖݶҕৡ IUUQTIFMQHJUIVCDPNBSUJDMFTBCPVUDPEFPXOFST
Ϟδϡʔϧ • microservices-starter-kit (Terraform Ϟδϡʔϧ) • Template Provider Λ͍σΟϨΫτϦ࡞ɺϑΝΠϧు͖ग़͠ •
Microservices ͷ্ཱͪ͛ʹඞཁͳϦιʔεΛ Bootstrap ͢Δ • GCP Project, Service account ͳͲ • PagerDuty, DataDog, Kubernetes (Namespace, Secret) ͳͲ • GitHub Teams (CODEOWNERS ͷݖݶҕৡʹ͏) IUUQTTQFBLFSEFDLDPNCCSUFSSBGPSNPQTGPSNJDSPTFSWJDFT
Implementations
࣮ • io.TeeReader Λ͍ͬͯΔ • GitHub ʹ POST ͢Δ͚ͩͰ ͳ͘
CI ͷ Console ʹग़ྗ • Terraform ͷ࣮ߦ݁Ռࣗલͷ ύʔαͰߏԽ͢Δ (regexp) • POST ͢Δϝοηʔδ Go ͷ ςϯϓϨʔτͰॻ͘͜ͱ͕Ͱ͖Δ • ઃఆ YAML Ͱ࣋ͭ
࣮ • ॏෳͨ͠༰͕͋Δ߹ɺ ݹ͍ͷ͕আ͞ΕΔ • ࣮ߦ݁Ռ͍ͷͰ Details λά ͰғͬͯંΓͨͨΈɺҰṮʹඞཁ ͳใ͚͕ͩݟ͘͢දࣔ͞ΕΔ
{{.Title}}, {{.Message}} ͷॏෳΛݟΔ
Conclusion
·ͱΊ • ϝϧΧϦͰ Microservices ྖҬͰ Terraform Λར༻͍ͯ͠Δ • ूݖͱࢄͷόϥϯεͰ Terraform
ϦϙδτϦΛӡ༻͍ͯ͠Δ • ͨ͘͞Μͷ P-R ΛޮΑ͘ϨϏϡʔ͢ΔͨΊ tfnotify Λॻ͍ͨ • Terraform ͷ࣮ߦ݁ՌΛखܰʹ֬ೝ͍ͨ͠ • Infrastructure as Code ͷจԽΛ͔ࠜͤΔ • ຖճ plan, apply ݁ՌΛݟΔश׳Λͭ / ͬͯΒ͏ • ઌߦ࣮͕ͳ͍ͨΊ OSS ʹͨ͠
Thanks