$30 off During Our Annual Pro Sale. View Details »

FOLIOのterraform運用tips/folio-terraform-operation-tips

 FOLIOのterraform運用tips/folio-terraform-operation-tips

こちらの登壇資料です https://terraform-jp.connpass.com/event/142041/

Shohei Koyama

October 02, 2019
Tweet

More Decks by Shohei Koyama

Other Decks in Programming

Transcript

  1. 1
    FOLIOͷterraformӡ༻tips
    2019/10/02 Shohei Koyama
    Copyright © 2019 FOLIO Co., Ltd. All Rights Reserved.

    View Slide

  2. 自己紹介
    ބࢁᠳฏ!TJPO@DPKQ
    ݩ'14ϓϩήʔϚʔͰΞδΞνϟϯϐΦϯ
    גࣜձࣾ'0-*043&

    View Slide

  3. View Slide

  4. 73 ⟎䟝植㹋
    73 ⟎䟝植㹋

    㼐぀ 㼐぀
    ؝أفٖ ؝أفٖ
    ❨鿪 ❨鿪
    ➂䊨濼腉 ➂䊨濼腉
    鍑犜 ؕآظ鍑犜
    ϑΥϦΦ͸ʮVRʯ΍ʮژ౎ʯͳͲɺ
    ଟ࠼ͳςʔϚΛ͑ΒΜͰ౤ࢿ͕
    Ͱ͖ΔΦϯϥΠϯূ݊Ͱ͢ɻ
    σʔλ౳͸αϯϓϧͰ͋Γɺকདྷͷӡ༻੒Ռ౳Λࣔࠦຢ͸อূ͢Δ΋ͷͰ͸͋Γ·ͤΜɻ

    ۚ༥঎඼ͷऔҾʹ͓͍ͯ͸ɺגՁͷมಈ౳ʹΑΓଛࣦ͕ੜ͡Δ͓ͦΕ͕͋Γ·͢ɻৄࡉ͸ܖ໿క݁લަ෇ॻ໘Λ͓ಡΈ͍ͩ͘͞ɻ
    גࣜձࣾFOLIO ۚ༥঎඼औҾۀऀ ؔ౦ࡒ຿ہ௕ʢۚ঎ʣୈ2983߸ɹՃೖڠձɿ೔ຊূ݊ۀڠձɺҰൠࣾஂ๏ਓ೔ຊ౤ࢿސ໰ۀڠձ

    View Slide

  5. 目次
    UFSSBGPSNίϚϯυͷӡ༻
    σΟϨΫτϦߏ੒
    ม਺ͷ֨ೲ
    UFSSBGPSNͷॻ͖ํ
    શମઃܭϨϏϡʔ

    View Slide

  6. UFSSBGPSNίϚϯυͷӡ༻

    View Slide

  7. terraformコマンドの実行
    ϩʔΧϧPSBUMBOUJT͔Β࣮ߦͰ͖·͢
    ͲͪΒ΋.BLFpMFΛ௨࣮ͯ͠ߦͯ͠·͢
    ϩʔΧϧ͸TMBDLTʹBQQMZ݁Ռ͕࢒Γ
    BUMBOUJT͸HJUMBCTʹBQQMZ݁Ռ͕࢒Γ·͢

    View Slide

  8. terraformバージョンの固定
    .BLFpMFΛ௨ͯ͠UFSSBGPSNίϚϯυΛଧͭ͜ͱʹΑΓ
    ձࣾશମͰόʔδϣϯΛݻఆͯ͠·͢
    ࠷ۙʹVQEBUF͕ͨ͠ɺॻ͕ࣜશ͘ҧ͏ͷͰ
    ݻఆͯ͠Α͔ͬͨͱࢥ͍·ͨ͠

    View Slide

  9. atlantisとは?
    XFCIPPLΛհͯ͠UFSSBGPSNϓϧϦΫΤετΠϕϯτΛ
    Ϧοεϯ͢Δࣗݾϗετܕͷ(PΞϓϦέʔγϣϯ
    BUMBOUJT͸HJUMBCܦ༝ͰɺQMBO͸$*ͰࣗಈతʹߦΘΕ·͢
    BQQMZ͸ίϝϯτʹ
    BUMBOUJTBQQMZͱॻ͚͹࣮ߦ͞Ε·͢

    View Slide

  10. 便利!

    View Slide

  11. σΟϨΫτϦߏ੒

    View Slide

  12. こんな感じ
    ʜBUMBOUJTΛ࢖͏ͨΊͷZBNMɻ(PͰࣗಈੜ੒ͯ͠Δ
    ʜશମͰ࢖͏ม਺ɻ*1ͱ͔TMBDLͷXFCIPPL63-ͱ͔
    ʜࣗࣾNPEVMFT
    ʜUFSSBGPSNΛ࢖͏ͨΊͷπʔϧΛ֨ೲɻશQMBO࣮ߦ͢Δπʔϧ΋ೖͬͯͨΓ͢Δ
    ʜUFSSBGPSNEFTUSPZִ͚ͩ཭ͯ͠Δ
    ʜUFSSBGPSNίϚϯυΛ͜͜ʹམͱ࣮ͯ͠ߦͯ͠Δ
    ʜ͜͜ʹUFSSBGPSNίʔυΛ֨ೲ

    View Slide

  13. envs/
    ֤ΞΧ΢ϯτຖʹσΟϨΫτϦ͕͋Γ·͢

    View Slide

  14. 安全にapply
    ͳΔ΂͘BQQMZͷӨڹΛগͳ͘͢ΔͨΊͷσΟϨΫτϦʹͯ͠·͢
    BQQMZʹ͕͔͔࣌ؒΔͱӨڹ΋େ͖͘ɺ
    ৺ཧతʹྑ͘ͳ͍ɻɻ
    ͔ͱݴͬͯࡉ͔͘EJS੾Γա͗ͯ΋Θ͔ΓͮΒ͘ͳΔ
    ͦ͜ͷ͍͍Ԙക͸ܦݧͱؾ߹͍
    ࢲ͸ΈΜͳ͕ӡ༻͠΍͘͢ͳΔͳ
    ΒUFSSBGPSNNWͳͲ΋ੵۃతʹ
    ΍ͬͯมߋ͍͖ͯ͠·͢

    View Slide

  15. ม਺ͷ֨ೲ

    View Slide

  16. 2種類
    HMPCBMUGWBSTʜશମͰ࢖͏ม਺ɻ*1$*%3΍ϝϧΞυ΍
    4MBDLͷXFCIPPL63-
    QSPWJFSUGʜΞΧ΢ϯτ୯ҐͰ࢖͏ม਺ɻ
    Α͘࢖ΘΕΔEBUBTPVSDFͳͲɻHMPCBMUGWBSTͷ஋΋͜͜Ͱ
    ಡΈࠐΉɻ

    View Slide

  17. 自動生成
    QSPWJEFSUGͱCBDLFOEUG͸.BLFpMFΛୟ͘ͱ͖ʹ
    ର৅σΟϨΫτϦʹࣗಈੜ੒͞Ε·͢
    ͜ΜͳίϚϯυΛୟ͍ͯ·͢
    ͪͳΈʹ.BLFpMFͳͷ͸֤ࣗϩʔ
    Χϧ؀ڥͷґଘ͕গͳ͍͔ΒͰ͢

    View Slide

  18. UFSSBGPSNͷॻ͖ํ

    View Slide

  19. よく私がするレビューコメント
    ͳͥͦͷᮢ஋ʹ͔ͨ͠ɺཧ༝ΛίϝϯτΞ΢τʹॻ͖·͠ΐ͏
    SFTPVSDFʹ͸ίϝϯτΞ΢τΛॻ͖·͠ΐ͏
    ࢀߟʹͨ͠هࣄͷ63-͕͋Ε͹ίϝϯτΞ΢τʹॻ͖·͠ΐ͏
    ྫ͑͹͸ࣗ໌ͳͷͰ
    ΍
    ʹ͠·͠ΐ͏
    JBNͷTUBUFNFOUͷ্ʹ͸ͳͥͦͷݖݶ͕ඞཁͳͷ͔ॻ͖·͠ΐ͏
    SFTPVSDFBXT@JBN@SPMFlJBN@SPMF@IPHF
    SFTPVSDFBXT@JBN@SPMFlUIJTz
    SFTPVSDFBXT@JBN@SPMFlIPHF

    View Slide

  20. 運用するということ
    େࣄͳͷ͸ޙ͔Βೖࣾ͢ΔਓͰ΋Θ͔ΔΑ͏ʹ͠·͠ΐ͏
    UFSSBGPSN͸ഁյతมߋ΋ଟ͘ߦ͍·͢
    ग़དྷΔݶΓίϝϯτΛॻ͍ͯώϯτΛ༩͑ɺ
    ҆৺ײͱӡ༻ͷॿ͚Λ༩͍͑ͯ͘Α͏ʹͯ͠·͢

    View Slide

  21. શମઃܭϨϏϡʔ

    View Slide

  22. 全体設計レビュー
    αʔϏεΛ࡞ΔࡍɺUFSSBGPSN͸৭ΜͳίϯϙʔωϯτΛࡉ͔͘
    DPNNJUΛ͢ΔͨΊશମ૾͕ݟ͑ͳ͍͜ͱ͕ଟ͍Ͱ͢
    ͳͷͰฐࣾ͸·ͣ͸TUHͰಈ͔͢͜ͱΛҙࣝͯ͠
    TUH׬੒ޙͷશମઃܭ΍தؒϨϏϡʔʹ஫ྗΛೖΕͯ·͢
    ʢͳͷͰόϯόϯϨϏϡʔ͕௨͍͖ͬͯ·͢ʣ
    ϓϥϞσϧΈ͍ͨʂ

    View Slide

  23. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠
    以上

    View Slide