Terraform Infrastructure as Code: Atlantis

This article is part of 從零開始的 Infrastructu as Code: Terraform Get-started examples / SOP on Github Introducation to Terraform Iac: Speaker transcript Presentation Check my website chechia.net for other blog. Follow my page to get notification. Like my page if you really like it :) 需求與問題 隨著 terraform 在團隊內的規模持續成長,團隊需要讓工作流程更加順暢,來面對大量的 tf 變更查核與變更請求。想像幾十個工程師同時在修改幾十個不同的 terraform projects / modules,這時可能會有幾個問題 需要一個穩定乾淨的環境執行 terraform 工程師的開發本機不是個好選擇 需要 24/7 的 terraform 執行中心 執行中心會有各個環境 (dev / stage / prod) 的存取權限,希望設置在內部 下列兩個工作會切換工作平台,例如 Github review,檢視 difference,與討論 PR review 完有時會忘記 merge,merge 完有時會忘記 apply repository 越多,忘得越多… 團隊已經導入 Git-flow,希望把工作流程做得更完整自動化更加便利 ...

October 7, 2020 · 2 min · 395 words · chechiachang

Terraform Infrastructure as Code: Terragrunt

This article is part of 從零開始的 Infrastructu as Code: Terraform Get-started examples / SOP on Github Introducation to Terraform Iac: Speaker transcript Presentation Check my website chechia.net for other blog. Follow my page to get notification. Like my page if you really like it :) 上面講解 Terraform 的基本操作流程,提供範本原始碼,以及一步一步導入的詳細步驟。各位應該都可以依照上面幾篇的說明,開始快樂的使用 Terraform 了。 而當使用 Terraform 的規模越來越大,管理的資料越來越多時,開始會出現一些問題,例如重複的 terraform code 越來越多,協同工作 review 不太容易,state 的內容管理與鎖管理,等等。這些問題可以透過一些工作流程的改進,或是導入新的小工具,來改善工作效率。 接下來筆者推薦幾個心得與工具,希望能提升使用 Terraform 的效率與產值 以下幾篇文章,適合已經使用過 terraform 一點時間,有經驗的團隊,並打算更大規模導入 terraform,正在尋求改善的方向。 心得 CI/CD 全自動化 State backend 選擇 最佳實踐 https://www.terraform.io/docs/cloud/guides/recommended-practices/index.html 工具 Terraform Atlantis Terragrunt 問題與需求 當團隊已經開始大規模使用 terraform,tf 檔案越來越多。我們為了增加程式碼的重複利用性,會使用 terraform module 將常用的 tf 檔案封裝。 ...

October 6, 2020 · 3 min · 608 words · chechiachang

Terraform Infrastructure as Code: Recommended Practices

This article is part of 從零開始的 Infrastructu as Code: Terraform Get-started examples / SOP on Github Introducation to Terraform Iac: Speaker transcript Presentation Check my website chechia.net for other blog. Follow my page to get notification. Like my page if you really like it :) 上面講解 Terraform 的基本操作流程,提供範本原始碼,以及一步一步導入的詳細步驟。各位應該都可以依照上面幾篇的說明,開始快樂的使用 Terraform 了。 以下幾篇文章,適合已經使用過 terraform 一點時間,有經驗的團隊,並打算更大規模導入 terraform,正在尋求改善的方向。 心得 CI/CD 全自動化 State backend 選擇 最佳實踐 工具 Terraform Atlantis Terragrunt 工具與文化 新工具提供解決方案,然而單純導入工具後不是就一勞永逸,許多實務上的問題,還是要依賴改善工作流程,並且避免整體運作的錯誤。 其次,不同團隊已有既有的團隊文化,整合新的工具後還是需要磨合,不一定要照單全收。換句話說,工作流程的不斷改進也是解決方案的一環。 建議實踐 Recommended Practices Terraform 官網有許多建議的實作與導入流程,其中大部分的建議我們都已經在前面的幾篇文章中提到,這邊要來說明一下,並補充其他官方推薦的實踐。 ...

October 5, 2020 · 2 min · 314 words · chechiachang

Terraform Infrastructure as Code: Backends

This article is part of 從零開始的 Infrastructu as Code: Terraform Get-started examples / SOP on Github Introducation to Terraform Iac: Speaker transcript Presentation Check my website chechia.net for other blog. Follow my page to get notification. Like my page if you really like it :) 上面講解 Terraform 的基本操作流程,提供範本原始碼,以及一步一步導入的詳細步驟。各位應該都可以依照上面幾篇的說明,開始快樂的使用 Terraform 了。 而當使用 Terraform 的規模越來越大,管理的資料越來越多時,開始會出現一些問題,例如重複的 terraform code 越來越多,協同工作 review 不太容易,state 的內容管理與鎖管理,等等。這些問題可以透過一些工作流程的改進,或是導入新的小工具,來改善工作效率。 接下來筆者推薦幾個心得與工具,希望能提升使用 Terraform 的效率與產值 以下幾篇文章,適合已經使用過 terraform 一點時間,有經驗的團隊,並打算更大規模導入 terraform,正在尋求改善的方向。 心得 CI/CD 全自動化 State backend 選擇 最佳實踐 https://www.terraform.io/docs/cloud/guides/recommended-practices/index.html 工具 Terraform Atlantis Terragrunt Terraform Backend 剛開始使用 terraform 的時候,大家的第一個範例應該都是 local backend 吧,就是直接在本地 terraform apply,在目前的工作目錄下產生 state 檔案。這個 state 檔案直接 cat 打開來看後,可以發現裡面一切都是明碼的。初學時筆者感覺所謂的 Terraform backend 只是一個存放中繼的 state 資料的 workspace,後來發現完全不是這麼回事,便立刻棄用了 local backend。 ...

October 4, 2020 · 3 min · 518 words · chechiachang

Terraform Infrastructure as Code: CI/CD automation

This article is part of 從零開始的 Infrastructu as Code: Terraform Get-started examples / SOP on Github Introducation to Terraform Iac: Speaker transcript Presentation Check my website chechia.net for other blog. Follow my page to get notification. Like my page if you really like it :) 上面講解 Terraform 的基本操作流程,提供範本原始碼,以及一步一步導入的詳細步驟。各位應該都可以依照上面幾篇的說明,開始快樂的使用 Terraform 了。 而當使用 Terraform 的規模越來越大,管理的資料越來越多時,開始會出現一些問題,例如重複的 terraform code 越來越多,協同工作 review 不太容易,state 的內容管理與鎖管理,等等。這些問題可以透過一些工作流程的改進,或是導入新的小工具,來改善工作效率。 接下來筆者推薦幾個心得與工具,希望能提升使用 Terraform 的效率與產值 以下幾篇文章,適合已經使用過 terraform 一點時間,有經驗的團隊,並打算更大規模導入 terraform,正在尋求改善的方向。 心得 CI/CD 全自動化 State backend 選擇 最佳實踐 https://www.terraform.io/docs/cloud/guides/recommended-practices/index.html 工具 Terraform Atlantis Terragrunt CI/CD 全自動化 當公司成功導入 terraform ,並且整合 Git-flow 的工作流程後,應該可以很明顯的感受到,整體的 infrastructure 產出穩定度有大幅提升,畢竟軟體工程中 code review 是穩定度的核心關鍵之一,而導入 terraform 與 infrastructure as code 讓 infrastructure 也能在合理的工作流程中被層層 review。 ...

October 3, 2020 · 3 min · 447 words · chechiachang