DevOps Insider: บอกลาข้อผิดพลาดใน Terraform ด้วย 3 เครื่องมือทำ Automation & Security Scanning

ไทย

Infrastructure as a Code (IaC) อย่าง Terraform Tool เป็นหัวใจของการสร้าง Infrastructure ที่ช่วย Compile Code แบบอัตโนมัติ ที่แชร์ให้ทีมงานใช้ได้ด้วย แต่เพื่อให้โค้ด แม่นยำ ปลอดภัย และพร้อมใช้งานจริง คุณตอง Senior Platform Services Engineer จาก SCB TechX จะมาแชร์ Tools ทำ Automation Testing, Linting และ Security Scanning ที่ส่งเสริม Terraform ให้ดีขั้นสุด ไปอัพเดต Tools ตัวแรกกันเลย

1. Terratest คือ Automate IaC Testing ใช้ภาษา Go ทดสอบ Infra ในสภาพแวดล้อมจริง ซึ่งมีประโยชน์ดังนี้

– ได้ทดสอบการสร้าง Infra ในสภาพแวดล้อมจริง จึงมั่นใจว่า Infra ที่เขียนไว้จะทำงานได้ตามต้องการ

– ใช้ภาษา Go ที่มีความสามารถสูง เขียน Test ที่ซับซ้อนได้ง่าย และ Mock ค่าได้

– เมื่อ Code เปลี่ยน สามารถตรวจสอบ behavior ของ resource ได้

2. TFLint เป็น Linting Tool ตรวจจับ Syntax Error และ Anti-Pattern ก่อน Apply ซึ่งมีประโยชน์ดังนี้

– ตรวจจับ Syntax Error และ Anti-Pattern ได้เร็ว ก่อนจะไปถึง Terraform Plan/Apply

– ตรวจจับการใช้ Resource หรือ Attribute ที่ผิด Format

3. Trivy เป็น Security Scanner ตรวจช่องโหว่ในโค้ด รองรับมาตรฐาน Compliance ซึ่งมีประโยชน์ดังนี้

– ตรวจสอบช่องโหว่ใน Terraform Code เช่น S3 แบบ public, security group เปิด 0.0.0.0/0

– รองรับมาตรฐาน Security Compliance เช่น CIS Benchmark, NSA Hardening Guide ฯลฯ

ท้ายนี้เราควรผสาน 3 เครื่องมือ Terratest, TFLint และ Trivy ไปใช้งานใน CI/CD Workflow เช่น Jenkins Pipeline เพื่อสร้าง Automation Pipeline ที่มั่นคงและปลอดภัย

Related Content

  • ทั้งหมด
  • Blogs
  • Insights
  • News
  • Uncategorized
    •   Back
    • Careers
    • Data Science
    • Lifestyle
    • Product
    • Strategy
    • Technology
    • User Experience
    • xPlatform
    • DevOps
    •   Back
    • PointX Products
    • Events
    • Others
    • Leadership
    • Partnership
    • Services & Products
    • Joint ventures
    •   Back
    • Blockchain
    • Finance
    • Tech innovation

Your consent required

If you want to message us, please give your consent to SCB TechX to collect, use, and/or disclose your personal data.

| การเพิกถอนความยินยอม

หากคุณต้องการเพิกถอนการให้ความยินยอมในการเก็บรวบรวม ใช้ และ/หรือเปิดเผยข้อมูลส่วนบุคคล กรุณาส่งคำร้องหาเรา

Vector

Message sent

We have receive your message and We will get back to you shortly.