Upgrade to Pro — share decks privately, control downloads, hide ads and more …

IaC運用を続けて出会うイシューたち

 IaC運用を続けて出会うイシューたち

coconala_engineer

April 23, 2024
Tweet

More Decks by coconala_engineer

Other Decks in Technology

Transcript

  1. Copyright coconala Inc. All Rights Reserved. 2 ࣗݾ঺հ ٢઒୓ݟʢΑ͔͠Θ ͨ͘Έʣ

    • ੜ·Ε ੩Ԭ → จܥେֶ͔ΒΤϯδχΞ΁ • ܦྺ ۚ༥SIer → ελʔτΞοϓ → ίίφϥ • झຯ ϥΠϒɾΠϕϯτʹߦ͘
  2. Copyright coconala Inc. All Rights Reserved. 4 ຊ೔ͷ֓ཁ • Iac(Terraform)ӡ༻Λ୊ࡐͱͯ͠

    ◦ ͲͷΑ͏ͳ໰୊͕ͲͷΑ͏ͳաఔͰੜ·ΕΔ͔ ◦ ʢ͔ΜͨΜʹʣͲ͏͍ͬͨ͜ͱ͕ཁҼͰͲΜͳํࡦ͕ͱΕΔ͔ ɹΛத৺ʹ͓఻͑͠·͢ɻ ɹ˞ هࡌ಺༰ʹ͸Սۭͷྺ࢙ΛؚΈ·͢
  3. Copyright coconala Inc. All Rights Reserved. 6 Πγϡʔ͕ੜ·ΕΔաఔ ॳظஈ֊ •

    ౰ॳαʔϏεن໛͸ݱࡏ΄ͲͰ͸ͳ͘ ΠϯϑϥपΓ͸΄΅ϫϯΦϖʹ͔ۙͬͨ • ୲౰ऀ͕ཧղͰ͖͍ͯΕ͹Α͍ɺͱ͍͏ঢ়ଶͱͳ͍ͬͯΔ
  4. Copyright coconala Inc. All Rights Reserved. 7 Πγϡʔ͕ੜ·ΕΔաఔ Πϕϯτ1ɿΑ͘Θ͔Βͳ͍͚ΕͲτϨϯυͷٕज़Λ࢖͏͜ͱʹͨ͠ •

    Πϯϑϥίʔυ؅ཧͰτϨϯυʹͳ͍ͬͯΔπʔϧ͸ͳΜͩΖ͏ͱ͍͏͜ ͱͰTerraformΛऔΓ্͛ͨ • એݴܕʹ͸͡ΊͯνϟϨϯδͨ͠ • ࢼߦࡨޡͯ͠ɺΑ͏΍͘ಋೖ͕Ͱ͖͕ͨɺ͜͜·ͰͰखҰഋͩͬͨͷͰͦ ͷঢ়ଶͰίϛοτΛ͠ɺࠓޙ͸TerraformΛ࢖͏͜ͱΛܾΊͨ
  5. Copyright coconala Inc. All Rights Reserved. 8 Πγϡʔ͕ੜ·ΕΔաఔ Πϕϯτ1ɿΑ͘Θ͔Βͳ͍͚ΕͲτϨϯυͷٕज़Λ࢖͏͜ͱʹͨ͠ •

    Πϯϑϥίʔυ؅ཧͰτϨϯυʹͳ͍ͬͯΔπʔϧ͸ͳΜͩΖ͏ͱ͍͏͜ͱͰ TerraformΛऔΓ্͛ͨ • એݴܕʹ͸͡ΊͯνϟϨϯδͨ͠ ◦ ࣮͸όοΫΤϯυΤϯδχΞܦݧͷ΄͏͕௕͘ɺϓϩάϥϜݴޠʹ׳Ε͍ͯͨͨ ΊɺPulumi΍AWS CDKͷ΄͏͕ຊਓͷಋೖɾӡ༻ίετ͸௿͔ͬͨ • ࢼߦࡨޡͯ͠ɺΑ͏΍͘ಋೖ͕Ͱ͖͕ͨɺ͜͜·ͰͰखҰഋͩͬͨͷͰͦͷঢ়ଶͰί ϛοτΛ͠ɺࠓޙ͸TerraformΛ࢖͏͜ͱΛܾΊͨ ◦ ͱΓ͋͑ͣͰ͖ͨʂͷঢ়ଶ͕݁ہ͍··Ͱੜ͖Δ͜ͱʹͳͬͨ
  6. Copyright coconala Inc. All Rights Reserved. 9 Πγϡʔ͕ੜ·ΕΔաఔ Πϕϯτ2ɿϝϯόʔͷ૿һ •

    ͠͹Βͯ͘͠৽ͨʹνʔϜϝϯόʔͷ૿һ͕͋ͬͨ ◦ υΩϡϝϯτ΍ϙϦγʔ͸ଘࡏ͠ͳ͍ ◦ ͋·ΓTerraformʹৄ͘͠ͳ͍ͷͰɺॻ͔Ε͍ͯΔίʔυΛ΋ͱʹ஌ࣝ Λ͚ͭΔ͜ͱʹͨ͠ ͏ͪͰ͸Terraform࢖ͬͯ ΔΜͩ ίʔυಡΊ͹Θ͔ΔΑ Terraform஌Βͳ͍ ͔Βษڧ͢Δ͔
  7. Copyright coconala Inc. All Rights Reserved. 10 Πγϡʔ͕ੜ·ΕΔաఔ Πϕϯτ2ɿϝϯόʔͷ૿һ •

    ͠͹Βͯ͘͠৽ͨʹνʔϜϝϯόʔͷ૿һ͕͋ͬͨ ◦ υΩϡϝϯτ΍ϙϦγʔ͸ଘࡏ͠ͳ͍ ▪ ϝϯόʔ͝ͱʹಠࣗղऍͯͦ͠ΕͧΕ͝ͱͷϙϦγʔ͕҉໧஌ͱͯ͠Ͱ͖ͨ ▪ ͦΕͧΕ͕ྑ͍ͱࢥͬͨίʔυ͕૿͍͑ͯͬͨ ◦ ͋·ΓTerraformʹৄ͘͠ͳ͍ͷͰɺॻ͔Ε͍ͯΔίʔυΛ΋ͱʹ஌ࣝΛ͚ͭΔ͜ ͱʹͨ͠ ▪ ͱΓ͋͑ͣͰ͖ͨʂঢ়ଶͷ૿৩
  8. Copyright coconala Inc. All Rights Reserved. 11 Πγϡʔ͕ੜ·ΕΔաఔ Πϕϯτ3ɿαʔϏεͷਐԽ •

    ৽نαʔϏε্ཱ͕͕ͪΓɺͦͪΒ΋Πϯϑϥ౳Λߏங͢Δ͜ͱʹͳͬͨ • αʔϏεͷར༻ऀ૿Ճ΍ػೳ֦ுʹΑΓɺߏங͢Δαʔό͕૿͑ͨ ◦ ͍ΘΏΔϚΠΫϩαʔϏε • ͱΓ͋͑ͣσΟϨΫτϦ΍εςʔτΛ෼͚ͯ࡞Δ͜ͱʹͨ͠ ΋ͱͷαʔϏε΋api෼͔Εͨ͠ ৽نαʔϏε΋্ཱ͕ͪΔ͠େมͩͳ
  9. Copyright coconala Inc. All Rights Reserved. 12 Πγϡʔ͕ੜ·ΕΔաఔ Πϕϯτ3ɿαʔϏεͷਐԽ •

    ৽نαʔϏε্ཱ͕͕ͪΓɺͦͪΒ΋Πϯϑϥ౳Λߏங͢Δ͜ͱʹͳͬͨ • αʔϏεͷར༻ऀ૿Ճ΍ػೳ֦ுʹΑΓɺߏங͢Δαʔό͕૿͑ͨ • ͱΓ͋͑ͣσΟϨΫτϦ΍εςʔτΛ෼͚ͯ࡞Δ͜ͱʹͨ͠ ◦ ϙϦγʔ΋ͳ͍··ʹεςʔτ΍σΟϨΫτϦ͕ཚཱ࢝͠Ίͨ ◦ ϞδϡʔϧΛద੾ʹ੾Δ͜ͱ͕͔ͳΘͣɺंྠͷ࠶ൃ໌͕࢝·ͬͨ
  10. Copyright coconala Inc. All Rights Reserved. 13 Πγϡʔ͕ੜ·ΕΔաఔ Πϕϯτ4ɿॳظϝϯόʔͷ୤ୀ •

    ಋೖ౰ॳʹ͍ͨϝϯόʔ͕࢓ࣄ͔Β཭ΕΔ͜ͱʹͳͬͨ • ผͷϝϯόʔͰ΋͠͹Β͘ӡ༻ͦͷ΋ͷ͕Ͱ͖ͯ͸͍ΔͷͰͳΜͱ͔ͳΔ ঢ়ଶͰ͸͋ͬͨ ͋ͱ͸ΑΖ͘͠
  11. Copyright coconala Inc. All Rights Reserved. 14 Πγϡʔ͕ੜ·ΕΔաఔ Πϕϯτ4ɿॳظϝϯόʔͷ୤ୀ •

    ಋೖ౰ॳʹ͍ͨϝϯόʔ͕࢓ࣄ͔Β཭ΕΔ͜ͱʹͳͬͨ • ผͷϝϯόʔͰ΋͠͹Β͘ӡ༻ͦͷ΋ͷ͕Ͱ͖ͯ͸͍ΔͷͰ ͳΜͱ͔ͳΔঢ়ଶͰ͸͋ͬͨ ◦ ͳͥݱࡏͷߏ੒Ͱ؅ཧΛ͍ͯ͠Δͷ͔ɺΛઆ໌Ͱ͖Δਓ͕ݮ͍ͬͯ͘ ◦ ಠࣗղऍͷԣߦ
  12. Copyright coconala Inc. All Rights Reserved. 17 Πγϡʔ͕ൃੜ͢ΔཁҼΛߟ͑Δ • ϙϦγʔ͕ଘࡏ͠ͳ͍

    ◦ Ͳ͏͍͏ߏ੒͕͋Δ΂͖ͱ͞Ε͍ͯΔ͔ཧղ͢Δෛՙ͕ߴ͍ • ϝϯόʔ͝ͱʹεΩϧηοτ͕ҟͳΔ ◦ A͞ΜʹཧղͰ͖ͯB͞Μʹ͸ཧղ͕೉͍͠ • αʔϏε͸ม༰ʹରԠͰ͖ͳ͍ ◦ ͋ͱͰίʔυԽ͠Α͏ɾɾɾ ◦ ͣͬͱಉ͡ߏ੒ΛอͯΔ΋ͷ͸ͳ͍ɾɾɾ͸ͣ
  13. Copyright coconala Inc. All Rights Reserved. 18 σΟϨΫτϦߏ଄Λ੔ཧ͢Δ ɾεςʔτϑΝΠϧΛͲͷΑ͏ʹ෼͚Δ͔Λ ߟ͑Δ

    ɾαʔϏε / module ϨϕϧͰಉ༷ͷߏ੒Λ ͱΔΑ͏ʹ͢Δ ɾਖ਼ղ͸ͳ͘ɺ౎౓ߏ଄มߋΛߟ͑Δ ɾ৽ن࡞੒͔Βద༻͠ɺաڈͷ΋ͷ͸ਵ࣌ Ҡߦ͍ͯ͘͠ ҙਤͷ͋Δ౷Ұతͳߏ੒ΛͱΖ͏ͱ͢Δ࢟੎Λ΋ͭ
  14. Copyright coconala Inc. All Rights Reserved. 19 ϙϦγʔͷ໌จԽ • ࠷ۙɺެ͔ࣜΒΨΠυϥΠϯ͕ग़͞Εͨ

    جຊతʹ͸ͪ͜Βʹ४ڌ • ͜Ε͚ͩͰ͸౷Ұ౓߹͍͕ऑ͍ͷͰ ಠࣗͷن໿Λ໌จԽ • ҙਤ͕໌֬ͳͷͰɺʮ͜Ε͸Ͳ͜ʹஔ͘ʯ ΂͖͔ͷ࣭໰͕૿͑ͨ • ຊن໿͸ఆظతʹݟ௚͠
  15. Copyright coconala Inc. All Rights Reserved. 21 มԽ΁ͷରԠ • ͋ͱ͔ΒίʔυԽ͠Α͏ͱ͍͏ಈ͖͕ग़͖͕ͯͪͰ͋Δ

    ◦ Ұ֓ʹޡΓͱ͸ݴ͑ͳ͍͕ɺ࣮ࡍʹίʔυԽ͞Εͳ͍έʔε͕ଟ͍ʢࢲݟʣ ◦ IaCίʔυ͕ਖ਼͍͠ͷ͔৴ጪੑ͕ٙΘΕ࢝ΊΔ ◦ ඞͣίʔυԽ→ద༻ͷྲྀΕΛͱΔΑ͏ʹ࢓૊ΈԽ͢Δ ▪ ຊ݅΋ϙϦγʔͱͯ͠૊ΈࠐΉ ▪ Terraform CloudͰ΋GithubActionsͰ΋CI/CDΛ૊ΈࠐΉ • ͋Γ͕ͪͳࣄ৘ ◦ Ұ౓ΠϯϑϥετϥΫνϟ͕ηοτΞοϓ͞ΕΕ͹௕ظؒʹΘͨͬͯͷมߋ͸ඞཁ ͕ͳ͍ͱΈͳ͞Ε͕ͪ ▪ ࣮ࡍɺձࣾͷಛੑ΍ϑΣʔζʹΑͬͯ͸ޡΓͰ͸ͳ͍
  16. Copyright coconala Inc. All Rights Reserved. 22 ͍͞͝ʹ • ίʔυԽ͞ΕͨΠϯϑϥετϥΫνϟʹΑͬͯ؀ڥͷҰ؏ੑ΍มߋ؅ཧ͕༰қʹͳΔ͸

    ͕ͣͩɺIaCࣗମ͕͖ͪΜͱӡ༻͞Ε͍ͯͳ͚Ε͹ҙຯΛͳ͞ͳ͍ • Ͳ͏͕͍͋ͯ΋Πγϡʔ͸ൃੜ͢Δ͕ɺ཈੍͸Ͱ͖Δ • ঺հ͖͠Εͳ͍͜ͱ͸ϒϩάΛࢀর͍͖͍ͨͩͨ ◦ https://zenn.dev/coconala/articles/7a49fee9893c95 ◦ ʮzenn ίίφϥ terraformʯͰݕࡧ
  17. Copyright coconala Inc. All Rights Reserved. 23 ίίφϥ ΤϯδχΞͷX(Twitter) X

    /Twitterʢ@coconala_engʣ https://twitter.com/coconala_eng ஥ؒΛืूதͰ͢ʂʂ ࠾༻ϗʔϜϖʔδ https://coconala.co.jp/recruit ΤϯδχΞ࠾༻ϗʔϜϖʔδ https://coconala.co.jp/recruit/engineer ίίφϥͷਓͱ૊৫Λ఻͑Δϒϩά ίίφϥLIVE https://blog.coconala.co.jp/m/m4e4abe8b17e5 ਓੜͷՄೳੑΛ޿͛ͨϢʔβʔετʔϦʔ Θͨ͠ͷεΩϧղ์ه https://blog.coconala.co.jp/m/me8a586112ad2 ίίφϥʹॴଐ͢ΔΤϯδχΞʹΑΔϒϩά ςοΫϒϩά https://zenn.dev/coconala