<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Infrastructure as Code on Chen Kai Blog</title><link>https://www.chenk.top/zh/tags/infrastructure-as-code/</link><description>Recent content in Infrastructure as Code on Chen Kai Blog</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Sat, 09 May 2026 09:00:00 +0000</lastBuildDate><atom:link href="https://www.chenk.top/zh/tags/infrastructure-as-code/index.xml" rel="self" type="application/rss+xml"/><item><title>阿里云全栈实战（十二）：Terraform 全栈统一交付</title><link>https://www.chenk.top/zh/aliyun-fullstack/12-terraform-e2e/</link><pubDate>Sat, 09 May 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/zh/aliyun-fullstack/12-terraform-e2e/</guid><description>&lt;p>十一篇文章。几十条 CLI 命令。上百个手动步骤。现在我们把它们全部扔掉，只用一条 &lt;code>terraform apply&lt;/code> 重建整个栈。这正是基础设施即代码（IaC）的核心价值。&lt;/p>
&lt;p>在这个系列的过去十一部分里，我们点击过控制台，敲过 &lt;code>aliyun&lt;/code> CLI 命令，手动配置了从 VPC 到 Function Compute 触发器的一切。这种方式可行：亲手搭建每个资源，熟悉所有细节。但在新地域重建整套栈——三层双可用区 VPC、带 cloud-init 的 ECS 实例、RDS MySQL HA、带生命周期规则和 CORS 配置的 OSS bucket、RAM 策略、SLS 日志管道、Function Compute 事件触发器——至少需要一整天的精细操作。难免会遗漏安全组规则、备份策略或 CORS 配置。&lt;/p></description></item><item><title>Terraform 实战（二）：Provider 认证与 State</title><link>https://www.chenk.top/zh/terraform-agents/02-provider-and-state-setup/</link><pubDate>Sat, 14 Mar 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/zh/terraform-agents/02-provider-and-state-setup/</guid><description>&lt;p>读到这里，关掉页面，打开终端吧。等你回来时，应该已经准备好以下内容：&lt;/p>
&lt;ol>
&lt;li>安装好且版本锁定的 &lt;code>alicloud&lt;/code> Terraform Provider。&lt;/li>
&lt;li>配置妥当的认证方式——用的是正确的方法，而非图省事的做法。&lt;/li>
&lt;li>基于 OSS Bucket 和 Tablestore 锁定的远程状态存储。&lt;/li>
&lt;li>三个工作空间（&lt;code>dev&lt;/code>、&lt;code>staging&lt;/code>、&lt;code>prod&lt;/code>），共用后端但状态相互隔离。&lt;/li>
&lt;li>能跑通的 &lt;code>terraform plan&lt;/code>，哪怕配置文件还是空的。&lt;/li>
&lt;/ol>
&lt;p>至此，Agent 尚未部署——本阶段仅搭建基础设施底座，后续所有文章都以此为基础。如果跳过此步骤，等到第三篇文章再临时补救，一周内遭遇 tfstate 损坏的概率极高。&lt;/p></description></item><item><title>Terraform 实战（一）：为何 IaC 是唯一出路</title><link>https://www.chenk.top/zh/terraform-agents/01-why-terraform-for-agents/</link><pubDate>Thu, 12 Mar 2026 09:00:00 +0000</pubDate><guid>https://www.chenk.top/zh/terraform-agents/01-why-terraform-for-agents/</guid><description>&lt;p>过去十八个月，我在阿里云上交付了四个 Agent 系统。其中三个起步都是某人在控制台点出来的单台 ECS 上的 &lt;code>tmux&lt;/code> 会话。这三个项目，通常在第二位工程师加入、生产环境资源告急，或安全团队索要网络拓扑图时，迫使我不得不在某个手忙脚乱的周末紧急重构。&lt;/p></description></item><item><title>云计算（七）：运维与 DevOps 实践</title><link>https://www.chenk.top/zh/cloud-computing/operations-devops/</link><pubDate>Fri, 26 May 2023 09:00:00 +0000</pubDate><guid>https://www.chenk.top/zh/cloud-computing/operations-devops/</guid><description>&lt;p>2017 年，GitLab 丢失了六个小时的数据库状态。一位疲惫不堪的工程师在处理事故时，误对生产服务器执行了 &lt;code>rm -rf&lt;/code> 命令。更糟的是，备份流程其实早已静默失效数月之久，却无人察觉——因为从来没人真正尝试过从备份恢复数据。这次事件的教训绝非“用 &lt;code>rm&lt;/code> 要小心”，而是：&lt;strong>运维是一个系统&lt;/strong>——它由工具、运行手册、监控、自动化以及围绕它们建立的协作仪式共同构成。当这个系统健康运转时，再疲惫的工程师也无法单枪匹马搞垮生产环境；而一旦系统腐朽，每一次深夜救火都可能因一次误操作滑向深渊。&lt;/p></description></item></channel></rss>