# Terraform ขั้นสูง (DevOps) > Modules, workspaces, remote state, data sources, dynamic blocks, provisioners, การตรวจจับ drift - 22 คำถามสัมภาษณ์ - Mid-Level - [คำถามสัมภาษณ์: DevOps](https://sharpskill.dev/th/technologies/devops/interview-questions.md) ## 1. Terraform module คืออะไร? **คำตอบ** Terraform module คือ container ที่นำกลับมาใช้ใหม่ได้สำหรับ resources และตรรกะของโครงสร้างพื้นฐาน ช่วยให้ห่อหุ้มชุดของ resources ที่เกี่ยวข้องและนำกลับมาใช้ใหม่ในโปรเจกต์หรือ environment ต่างๆ Modules รับ variables ที่เป็น input และสามารถเปิดเผย outputs เพื่อให้สามารถประกอบและเชื่อมโยงระหว่าง modules ได้ ## 2. ความแตกต่างหลักระหว่าง workspace และ module คืออะไร? **คำตอบ** Workspaces ช่วยจัดการหลาย instance ของโค้ดเดียวกันโดยมี state files แยกกัน ในขณะที่ modules ห่อหุ้มโค้ดที่นำกลับมาใช้ใหม่ได้ Workspace ใช้สำหรับแยก state ของ environment ต่างๆ ในขณะที่ module ใช้สำหรับนำตรรกะของโครงสร้างพื้นฐานกลับมาใช้ใหม่ Workspaces แชร์โค้ดเดียวกันแต่ state ต่างกัน modules แชร์โค้ดข้ามโปรเจกต์ ## 3. ข้อดีหลักของการใช้ remote backend เช่น S3 แทนที่จะเป็น state ในเครื่องคืออะไร? **คำตอบ** Remote backend ช่วยให้สามารถแชร์ state ระหว่างสมาชิกในทีมและรับประกันความสอดคล้องของการ deploy ด้วย state ในเครื่อง นักพัฒนาแต่ละคนมีสำเนาของตัวเอง ทำให้เกิดความขัดแย้งและความไม่สอดคล้อง Remote backend ยังมี state locking เพื่อป้องกันการแก้ไขพร้อมกันและอำนวยความสะดวกในการทำงานร่วมกันโดยรวมศูนย์แหล่งข้อมูลที่เชื่อถือได้ ## มีอีก 19 คำถาม - จะสร้าง Terraform workspace ใหม่ได้อย่างไร? - ความแตกต่างระหว่าง data source และ resource ใน Terraform คืออะไร? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ DevOps อื่นๆ - [การควบคุมเวอร์ชัน & Git](https://sharpskill.dev/th/technologies/devops/interview-questions/version-control-git.md): 20 คำถาม, Junior - [พื้นฐาน Linux](https://sharpskill.dev/th/technologies/devops/interview-questions/linux-fundamentals.md): 22 คำถาม, Junior - [Shell Scripting & Bash](https://sharpskill.dev/th/technologies/devops/interview-questions/shell-scripting-bash.md): 20 คำถาม, Mid-Level - [พื้นฐาน Networking](https://sharpskill.dev/th/technologies/devops/interview-questions/networking-basics.md): 22 คำถาม, Junior - [พื้นฐาน Docker](https://sharpskill.dev/th/technologies/devops/interview-questions/docker-fundamentals.md): 24 คำถาม, Junior - [พื้นฐาน CI/CD](https://sharpskill.dev/th/technologies/devops/interview-questions/ci-cd-fundamentals.md): 18 คำถาม, Junior - [GitHub Actions](https://sharpskill.dev/th/technologies/devops/interview-questions/github-actions.md): 22 คำถาม, Mid-Level - [GitLab CI/CD](https://sharpskill.dev/th/technologies/devops/interview-questions/gitlab-ci.md): 22 คำถาม, Mid-Level - [Jenkins](https://sharpskill.dev/th/technologies/devops/interview-questions/jenkins.md): 22 คำถาม, Mid-Level - [พื้นฐาน Kubernetes](https://sharpskill.dev/th/technologies/devops/interview-questions/kubernetes-basics.md): 26 คำถาม, Mid-Level - [Networking ของ Kubernetes](https://sharpskill.dev/th/technologies/devops/interview-questions/kubernetes-networking.md): 24 คำถาม, Mid-Level - [Kubernetes ขั้นสูง](https://sharpskill.dev/th/technologies/devops/interview-questions/kubernetes-advanced.md): 24 คำถาม, Mid-Level - [Ingress & API Gateway](https://sharpskill.dev/th/technologies/devops/interview-questions/ingress-api-gateway.md): 20 คำถาม, Mid-Level - [พื้นฐาน Terraform](https://sharpskill.dev/th/technologies/devops/interview-questions/terraform-basics.md): 22 คำถาม, Mid-Level - [Ansible & Configuration Management](https://sharpskill.dev/th/technologies/devops/interview-questions/ansible-configuration.md): 20 คำถาม, Mid-Level - [พื้นฐาน AWS](https://sharpskill.dev/th/technologies/devops/interview-questions/aws-essentials.md): 26 คำถาม, Mid-Level - [พื้นฐาน Azure](https://sharpskill.dev/th/technologies/devops/interview-questions/azure-fundamentals.md): 22 คำถาม, Mid-Level - [พื้นฐาน GCP](https://sharpskill.dev/th/technologies/devops/interview-questions/gcp-fundamentals.md): 22 คำถาม, Mid-Level - [การมอนิเตอร์และ Prometheus](https://sharpskill.dev/th/technologies/devops/interview-questions/monitoring-prometheus.md): 22 คำถาม, Mid-Level - [Logging & ELK Stack](https://sharpskill.dev/th/technologies/devops/interview-questions/logging-elk.md): 20 คำถาม, Mid-Level - [Alerting & Incident Response](https://sharpskill.dev/th/technologies/devops/interview-questions/alerting-incident-response.md): 20 คำถาม, Mid-Level - [Cloud Identity & Secrets](https://sharpskill.dev/th/technologies/devops/interview-questions/cloud-identity-secrets.md): 22 คำถาม, Mid-Level - [ความปลอดภัยของ CI/CD Pipeline](https://sharpskill.dev/th/technologies/devops/interview-questions/cicd-pipeline-security.md): 20 คำถาม, Mid-Level - [Helm & Kubernetes](https://sharpskill.dev/th/technologies/devops/interview-questions/helm-kubernetes.md): 20 คำถาม, Mid-Level - [ความปลอดภัย Runtime และ Cluster](https://sharpskill.dev/th/technologies/devops/interview-questions/runtime-cluster-security.md): 24 คำถาม, Senior - [Container Supply Chain Security](https://sharpskill.dev/th/technologies/devops/interview-questions/container-supply-chain.md): 22 คำถาม, Senior - [Service Mesh & Istio](https://sharpskill.dev/th/technologies/devops/interview-questions/service-mesh-istio.md): 24 คำถาม, Senior - [GitOps & ArgoCD](https://sharpskill.dev/th/technologies/devops/interview-questions/gitops-argocd.md): 22 คำถาม, Senior - [Progressive Delivery](https://sharpskill.dev/th/technologies/devops/interview-questions/progressive-delivery.md): 20 คำถาม, Senior - [Observability แบบกระจาย](https://sharpskill.dev/th/technologies/devops/interview-questions/observability-distributed.md): 22 คำถาม, Senior - [Disaster Recovery & Backup](https://sharpskill.dev/th/technologies/devops/interview-questions/disaster-recovery.md): 20 คำถาม, Senior - [การปรับแต่งประสิทธิภาพ](https://sharpskill.dev/th/technologies/devops/interview-questions/performance-optimization.md): 22 คำถาม, Senior - [การเพิ่มประสิทธิภาพต้นทุน Cloud](https://sharpskill.dev/th/technologies/devops/interview-questions/infrastructure-cost.md): 20 คำถาม, Senior - [หลักการ SRE](https://sharpskill.dev/th/technologies/devops/interview-questions/sre-principles.md): 24 คำถาม, Senior - [Chaos Engineering](https://sharpskill.dev/th/technologies/devops/interview-questions/chaos-engineering.md): 20 คำถาม, Senior - [Platform Engineering](https://sharpskill.dev/th/technologies/devops/interview-questions/platform-engineering.md): 22 คำถาม, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/technologies/devops/interview-questions/terraform-advanced