我正在与 Okta 提供商合作,我想实施
app_oauth
。有一个像redirect_uris
(documentation)这样的属性,除了service
之外的所有应用程序类型都需要这个属性。我试图在我的vars.tf
中解决这个问题:
variable "type" {
description = "Application Type"
type = string
nullable = false
}
variable "redirect_uris" {
description = "Application Grant Types"
type = list(string)
nullable = var.type == "service" ? true : false
}
不幸的是在跑步时
terragrunt plan
我得到:
Error: Variables not allowed
│
│ on vars.tf line 23, in variable "redirect_uris":
│ 23: nullable = var.type == "service" ? true : false
│
│ Variables may not be used here.
╵
╷
│ Error: Unsuitable value type
│
│ on vars.tf line 23, in variable "redirect_uris":
│ 23: nullable = var.type == "service" ? true : false
│
│ Unsuitable value: value must be known
有人可以给我任何处理方法的提示吗?
编辑:工作解决方案
resource "okta_app_oauth" "app" {
label = var.label
type = var.type
grant_types = var.grant_types
redirect_uris = var.type != "service" ? var.redirect_uris : null
response_types = var.response_types
}
由于您没有发布可重现的代码块,我认为您可以通过执行以下操作来实现您想要的:
redirect_uris = var.type != "service" ? var.redirect_uris : null