azure - 通过 terraform 创建 azuread_application_password 时无法输出 client_secret

标签 azure terraform azure-rm

您好,我正在尝试为 azure_application 创建一个 azure_application_password,以在 backend configuration 期间使用它进行身份验证。 .

resource "azuread_application_password" "application_password" {
  application_object_id  = azuread_application.app-tf.object_id
  end_date       = timeadd(timestamp(), "720h")
}

output "client_secret" {
  description = "Client Secret"
  value       = azuread_application_password.application_password.value
}

由于我是通过 terraform 进行配置,因此我需要在创建后查看 application_passwordclient_secret 以便我可以使用该值。

│ Error: Output refers to sensitive values
│
│   on main.tf line 47:
│   47: output "client_secret" {
│
│ To reduce the risk of accidentally exporting sensitive data that was intended to be only internal, Terraform requires  
│ that any root module output containing sensitive data be explicitly marked as sensitive, to confirm your intent.       
│
│ If you do intend to export this data, annotate the output value as sensitive by adding the following argument:
│     sensitive = true

我知道这现在可能是最安全的,但我相信这是在使用 terraform 时创建和检索 client_secret 的唯一方法,那么我如何解决此错误并获取值?

最佳答案

使用nonsensitive禁用屏蔽功能:

output "client_secret" {
  description = "Client Secret"
  value       = nonsensitive(azuread_application_password.application_password.value)
}

关于azure - 通过 terraform 创建 azuread_application_password 时无法输出 client_secret,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70991553/

相关文章:

python - 托管 Flask(Python) 应用程序抛出 CGI 错误

terraform - aws_cloudwatch_log_resource_policy创建哪些资源?

kubernetes - Terraform EKS 在节点组上指定 node-role.kubernetes.io 标签

azure-rm - 地形 - azurerm。 Standard_LRS 和 StandardSSD_LRS 之间的区别

spring-boot - Spring Boot、带有 azure 的 OAuth2 和另一个提供商(例如 google)

azure - 通过 Visual Studio 2017 发布 Azure 函数项目后,所有函数应用程序都转为只读模式

azure - 使用 Microsoft.Identity.Web 在状态参数中设置不同的 ReturnUrl

amazon-s3 - 读取CDK中的bucket对象

azure - 创建 azure vpn 网关时不支持的参数

powershell - Get-AzureAccount 在 Az 模块中不起作用