Slide 1

Slide 1 text

ಥܸʂྡͷ Terraform Takeshi Kondo / @chaspy 2019/12/02 Terraform Meetup Tokyo#3

Slide 2

Slide 2 text

tl;dr • KyashɾϝϧΧϦͷ Terraform ͷӡ༻Λώ ΞϦϯά͠ʹಥܸͨ͠ • ඇৗʹֶͼ͕ଟ͔ͬͨͷͰɺಠΓ઎Ίͤ ͣɺίϛϡχςΟʹؐݩ͍ͨ͠ • ͏ͪʹ΋ಥܸ͠ʹ͖ͯͶʂ

Slide 3

Slide 3 text

Background • https://gist.github.com/suzuki-shunsuke/ 0f6f602571920e95be279044c2f44ea8 • 2 repositories, 3 states • Japan / Global • Production / Staging / Manage • ୭Ͱ΋ PR Λ౤͛ΒΕΔঢ়گͰ͸͋Δɺ͕ɺɺɺ • Өڹൣғ͕େ͖͍ • Release branch ӡ༻ʹݶք͕ݟ͖͑ͯͨ • SRE Λհͣ͞ Devs ͕ࣗ༝ʹ merge & release ͯ͠΄͍͠ • Splitting State • Delegation to devs

Slide 4

Slide 4 text

Background

Slide 5

Slide 5 text

Background

Slide 6

Slide 6 text

https://twitter.com/chaspy_/status/1187601882245582848

Slide 7

Slide 7 text

Slide 8

Slide 8 text

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Kyash https://kyash.co/company/

Slide 11

Slide 11 text

Kyash • @lamanotrama ͞Μʢݩฐࣾ Senior SREʣ • workspace Λ࢖༻ • ։ൃɾຊ൪͕Ұக͍ͯ͠Δ͜ͱΛώΞϦϯάͰ֬ೝ • remote stateͷ key check ࣗಈԽ • moduleԽͷࡍͷTips • module ͷ಺෦͕͋·ΓมΘΒͳ͍ͱ֬৴Ͱ͖Δ΋ͷ • ෳࡶͳ࢓༷Λ module ʹ͠ͳ͍ • State ࣗମΛ෼͚͍ͯΔͷͰ module Խ͢Δ͜ͱͰ DRY ʹ͸ͳΒͳ͍

Slide 12

Slide 12 text

mercari https://about.mercari.com/about/

Slide 13

Slide 13 text

mercari • @deeeet ͞Μ / @dtan4 ͞Μ • https://gist.github.com/tcnksm/ 7b430f7955beac1ebb5b4d2fb26b40f7 • GitHub flow • ಉ࣌ʹ1 service ͔͠มߋͰ͖ͳ੍͍໿ • Master branch Ͱͷ CI ͸ඞͣ 1 service ͷΈ͕ Apply • ৽αʔϏε࡞੒࣌ʹ͸ bootstrap Λ༻ҙ • microservices starter kit module • template_dir Λ༻͍࣭ͯ໰ʹ౴͑Δͱࣗಈੜ੒ • Stein ʹΑΔ lint

Slide 14

Slide 14 text

Future work By @suzuki-shunsuke • Conftest ʹΑΔ state ͷ Lint • Remote state ͷ key ͷ Lint • Kubernetes ͷ manifest ΋ςετͰ͖Δ • Service domain ୯ҐͰͷ෼ׂத • ڞ௨ɾωοτϫʔΫϦιʔε΁ͷґଘ͸ϋʔυίʔυ • Application in monorepo ͷ໊લͱҰகͤ͞Δ • Service ͱͦΕΒ͕ར༻͢Δ Infrastructure ͸Կ͔͠Β ͷن໿ͰҰகͤ͞Δඞཁ͕͋Δͱ൑அ

Slide 15

Slide 15 text

͓͠·͍ • ֶͼ͕ଟ͔ͬͨͷͰಥܸ͸ศར • ઈࢍ state ෼ׂத • Terraform ӡ༻ʹ͍ͭͯฉ͖͍ͨ͜ͱ͕ ͋ͬͨΒ͍ͭͰ΋༡ͼʹ͖͍ͯͩ͘͞

Slide 16

Slide 16 text

Thank You! chaspy chaspy_ Site Reliability Engineer Takeshi Kondo SRE Lounge Terraform-jp