I'm working with Okta provider and I want to implement app_oauth
. There is an attribute like redirect_uris
(documentation) and this attrobute is required for all application types except service
. I was trying to solve this like that in my 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
}
Unfortunately while running terragrunt plan
I get:
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
Can somebody give me any tips how to deal with that?
EDIT: working solution
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
}
Since you have not posted a reproducible code block, I think you could achieve what you want by doing the following:
redirect_uris = var.type != "service" ? var.redirect_uris : null