【问题标题】:Is it possible to use Terraform to recycle the azurerm_kubernetes_cluster service_principal:client_secret only是否可以仅使用 Terraform 回收 azurerm_kubernetes_cluster service_principal:client_secret
【发布时间】:2019-08-23 05:31:19
【问题描述】:

我正在尝试回收 AKS 集群中的 service_principal:client_secret 值,该集群由 terraform 使用 azurerm_kubernetes_cluster 上的文档进行配置。

但是,例如,当我将 client_secret 的值从 00000000000000000000000000000000 更改为 00000000000000000000000000000000new=

service_principal {
  client_id     = "00000000-0000-0000-0000-000000000000"
  client_secret = "00000000000000000000000000000000new"
}

Terraform 不支持更改:

我原以为 Terraform 会注意到 client_secret 不同并尝试进行更改,但我看到了:

Resources: 0 added, 0 changed, 0 destroyed. 

我查看了 tfstate 文件,发现没有为 client_secret 设置值,我认为这就是 terraform 似乎没有回收密钥的原因。

这是它的样子:

service_principal.555555555.client_id: "00000000-0000-0000-0000-000000000000",
service_principal.555555555.client_secret: "",

这是预期的行为,当您仅更新 client_secret 时,terraform 没有反映更改?

谢谢!

【问题讨论】:

    标签: azure terraform azure-aks terraform-provider-azure


    【解决方案1】:

    您可以使用 AZ cli 重置 aks 凭据:https://docs.microsoft.com/en-us/azure/aks/update-credentials

    但目前还没有使用 terraform。

    这是公开的 API 调用:https://docs.microsoft.com/en-us/rest/api/aks/managedclusters/resetserviceprincipalprofile

    您甚至可以使用 arm 模板而不是 terraform 来做到这一点

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-16
      • 2021-05-12
      • 2019-03-03
      • 1970-01-01
      • 2020-04-17
      • 1970-01-01
      • 2021-05-27
      • 2021-03-25
      相关资源
      最近更新 更多