基础设施即代码(IaC)的重构与故障修复
1. 拆解单体式IaC配置
在管理基础设施时,单体式的IaC配置可能带来诸多问题,例如移除一个资源可能导致整个配置失败。为了解决这些问题,我们需要对单体式IaC进行拆解和重构。
1.1 拆解前的检查
在开始拆解之前,我们可以使用Terraform来检查基础设施状态。以下是一段示例输出:
google_service_account.blue: Refreshing state...
google_compute_network.blue: Refreshing state...
google_compute_subnetwork.blue: Refreshing state...
google_container_cluster.blue: Refreshing state...
google_container_node_pool.blue: Refreshing state…
No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration
➥and found no differences, so no changes are needed.
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
如果在预运行(dry run)中包含了已重构
超级会员免费看
订阅专栏 解锁全文
481

被折叠的 条评论
为什么被折叠?



