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

Terraform 사용 후기

RIDI
December 01, 2017

Terraform 사용 후기

RIDI

December 01, 2017
Tweet

More Decks by RIDI

Other Decks in Technology

Transcript

  1. TERRAFORM੄ ౠ૚ (1) ▸ࢲߡܳ ؀࢚ਵ۽ provision
 ࢲߡ ղࠗ ߸҃ী݅ ઁೠغ૑

    ঋ਺ ▸௿ۄ਋٘ ജ҃ী ݒ਋ ੸೤
 ࢲߡ ࢤࢿ, ઁѢ ಞܻ
  2. ࢲߡ AMI ࢲߡ AMI ৘) ࢜ ߡ੹੄ OPENSSLਸ ࢸ஖ ▸ࣻ੿

    ߑध੄ ҃਋
 ӝઓ ೐۽Ӓ۔ਸ ࢜ ߡ੹ਵ۽ সؘ੉౟ (߸҃) OpenSSL 1.0.2 OpenSSL 1.1.0 ߸҃ ੹ ߸҃ റ
  3. ࢲߡ AMI ࢲߡ AMI ৘) ࢜ ߡ੹੄ OPENSSLਸ ࢸ஖ ▸Ү୓

    ߑध੄ ҃਋
 ࢜ ߡ੹੉ ࢸ஖ػ ࢲߡ ੉޷૑ܳ प೯ ߸҃ ੹ ߸҃ റ OpenSSL 1.0.2 OpenSSL 1.1.0
  4. Ү୓ ߑध੄ ੢੼ ▸ݒߣ ജ҃ ࢜۽ ࢤࢿ ▸ ߸҃੉ ־੸غ૑

    ঋ਺ ▸ ജ҃ ҳࢿ ࠛੌ஖ ޙઁীࢲ ੗ਬ܂׮.
  5. ജ҃ ҳࢿ ࠛੌ஖ ޙઁ (CONFIGURATION DRIFT) ▸ ࣗ೐౟ਝযա ೞ٘ਝযо ߸҃ؼ

    ٸ݃׮,
 ӝ۾غ૑ ঋח ޷ࣁೠ ର੉о ߊࢤ ▸ ־੸غ׮ࠁݶ ޙઁо ߊࢤ
  6. ৘) EC2 ੋझఢझ 10ѐ ࢤࢿ द - ec2: count: 10

    image: ami-v1 instance_type: t2.micro resource "aws_instance" "example" { count = 10 ami = "ami-v1" instance_type = "t2.micro" }
  7. ৘) EC2 ੋझఢझ 10ѐ → 15ѐ - ec2: count: 10

    image: ami-v1 instance_type: t2.micro - ec2: count: 5 image: ami-v1 instance_type: t2.micro resource "aws_instance" "example" { count = 15 ami = "ami-v1" instance_type = "t2.micro" }
  8. ੺ର੸ ೐۽Ӓې߁੄ ױ੼ ▸௏٘݅ ࠊࢲח ੋ೐ۄо যڃ ࢚కੋ૑
 ঌӝ ൨ٜ׮.

    - ec2: count: 5 image: ami-v1 instance_type: t2.micro ੉Ѫ݅ ࠊࢲח ࢲߡо 15ѐо ؼ૑
 ঌ ࣻ হ׮.
  9. ▸ইې ղਊਸ Terraformਵ۽ ҳഅೞ۰ݶ? ৘) BLUE-GREEN DEPLOY ҳഅ 1. GREENਸ

    द੘ೠ ٍ
 GREENী ߓನ 2. ࢲ࠺झܳ BLUEীࢲ
 GREENਵ۽ ߸҃
 
 3. BLUEܳ ੿૑

  10. TERRAFORM ಴അ੄ ೠ҅ ▸ఋ੉߁ ઁয
 “~ೡ ٸө૑ ӝ׮۷׮о..” ▸ઑѤ ࠙ӝ


    “~ ೠ׮ݶ..” ※ ੿ഛ൤ח ࠛоמೠѤ ইפ૑݅ ಞߨਸ ॄঠೞѢա ࢚׼൤ ઁೠ੸ੑפ׮.
  11. ੘স੄ ൒ܴ 2ױ҅: PLAN ‣ ௏٘ܳ ੸ਊ೮ਸ ٸ ߸҃ؼ ղਊਸ

    ޷ܻ ୹۱ ‣ पࣻܳ ޷োী ߑ૑ೡ ࣻ ੓׮. WRITE ௏٘ ੘ࢿ PLAN Ѩష APPLY ߈৔
  12. पઁ ࢎਊ೧ࠄ ࣗх ▸৘࢚ೞ૑ ޅೠ ୶о ࠺ਊ (1) ▸ HCLਸ

    ੊൤ח ؘ ೙ਃೠ ೟ण ࠺ਊ Terraform ੗୓঱য
  13. STATE ҙܻ ▸ ౱ਗ рী ҕਬ ▸ lockਸ ੜ ࢸ੿೧ঠ

    ೣ ▸ ؕ஖о ழ૑ݶ ࢿמ੉ աࡅ૗ ▸ ࠙࢑ ࢸ҅ܳ ೞח ಞ੉ જ׮.
  14. STATE ҙܻ ▸ ౱ਗ рী ҕਬ ▸ lockਸ ੜ ࢸ੿೧ঠ

    ೣ ▸ ؕ஖о ழ૑ݶ ࢿמ੉ աࡅ૗ ▸ ࠙࢑ ࢸ҅ܳ ೞח ಞ੉ જ׮. ➠DBܳ ਍৔ೞח Ѫҗ
 ࠺तೞ׮.
 (=ҙܻ࠺ਊ)
  15. Ѿۿ ▸Terraform਷ ୭Ҋ੄ ࢶఖ੉ ইק૑ب.. ▸ ই૒ ખ ࠛউೠ 0.x

    ؀ ߡ੹ ▸ ৘࢚ࠁ׮ ࠛಞ೮؍ Ѿҗ ࢶ঱ ߑध ▸ Ansibleҗ ߽೯ೞח Ѫب Ҋ۰೧ࠅ ೙ਃо ੓ਸ ٠..
  16. Ѿۿ ▸ೞ૑݅ IAC بҳח ԙ ࢎਊ೤द׮! ▸ ࢸ۸ Ӓѱ Terraform੉

    ইפ؊ۄب.. ▸ ੉۱ ҙܻ, ੗زച, ࡅܲ ࣘب, ੤ࢎਊ … Why not? ▸ ݽٚ ੉۱җ ߸҃੉ ౵ঈغҊ ੓ਸ ٸ੄ बܻ੸ উ੿х
 ঐࣁನо ࢎۄ઎णפ׮.
  17. ଵҊ੗ܐ ▸ Gruntwork - Why we use Terraform and not

    Chef, Puppet, Ansible, SaltStack, or CloudFormation
 (https://blog.gruntwork.io/why-we-use-terraform-and-not-chef-puppet-ansible- saltstack-or-cloudformation-7989dad2865c) ▸ TERRAFORM, VPC, AND WHY YOU WANT A TFSTATE FILE PER ENV
 (https://charity.wtf/2016/03/30/terraform-vpc-and-why-you-want-a-tfstate-file-per- env/)
  18. Q&A