Add production-ready Azure lab with identity chain - #14
Conversation
Agent-Logs-Url: https://github.com/lonegunmanb/terraform-tutorial/sessions/7985c27b-443f-4090-8211-4b41374fb0d8 Co-authored-by: lonegunmanb <2233414+lonegunmanb@users.noreply.github.com>
Agent-Logs-Url: https://github.com/lonegunmanb/terraform-tutorial/sessions/7985c27b-443f-4090-8211-4b41374fb0d8 Co-authored-by: lonegunmanb <2233414+lonegunmanb@users.noreply.github.com>
|
@copilot 请按下面这份升级方案改 PR #14,把它从"教模块化"升级成"教完整生产姿势"。 上下文(请先读,省你重新探查)1. 上游 miniblue 现状(已就绪,不用再等)
也就是说:100% Terraform 原生 lab、无需 2. 本仓库现状
PR #15 的代码内容应当合并进 PR #14;PR #15 完成后会被关闭。 你要做的任务Task 1 — 合并 PR #15 的代码把
Task 2 — VM 升级为 SSH key + UAIPR #15 的 resource "azurerm_linux_virtual_machine" "app" {
# ...
admin_username = "azureuser"
disable_password_authentication = true # ✅ 不再有密码
admin_ssh_key {
username = "azureuser"
public_key = var.web_ssh_public_key # 新增 var
}
identity {
type = "UserAssigned"
identity_ids = [var.app_identity_id]
}
lifecycle {
ignore_changes = [custom_data] # 移除原来的 admin_password / identity ignore
}
}
Task 3 — KV 改用 RBAC 授权模式PR #15 的 resource "azurerm_key_vault" "app" {
# ...
enable_rbac_authorization = true # ✅ 关键
# ❌ 删除 access_policy {} 块
}
Task 4 — setup-common.sh 加
|
Agent-Logs-Url: https://github.com/lonegunmanb/terraform-tutorial/sessions/4672f8ae-b75b-4260-ba63-80c093309260 Co-authored-by: lonegunmanb <2233414+lonegunmanb@users.noreply.github.com>
... 已在 e5ec40e 完成:合入 PR #15 场景升级,VM 改为生成 SSH key + UAI,Key Vault 改为 RBAC 授权,补充 vault host 注册,并新增 step 6 端到端身份链验证。已跑 Terraform fmt/validate、npm run build 和 CodeQL checker。 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Summary
terraform-production-ready-azureKillercoda scenario using miniblue Azure resources, VM support, module refactoring, moved blocks, and Terragrunt state isolation.sha-cf2cb7ftag and synced generated references.Validation
npm run build/tmp/terraform fmt -check -recursive terraform-tutorial/terraform-production-ready-azureterraform init -backend=false+terraform validatefor step1-step4 and step5 layer configs