我正在使用 Terraform 創建 LogicApps。Logic Apps 將做 webhook,我想發布文本。
我想用 If 陳述句自定義 Terraform 代碼的文本欄位。我想僅在 prod 環境中顯示文本的某些部分。但是,我的 terraform 代碼將整個 if 陳述句傳遞給 LogicApps,并且我在執行 LogicApps 時遇到有效負載錯誤。
resource "azurerm_logic_app_action_http" "example" {
name = "webhook"
logic_app_id = azurerm_logic_app_workflow.example.id
method = "GET"
uri = "http://example.com/some-webhook"
method = "POST"
headers = { "Content-Type" = "application/json" }
body = <<-BODY
{
"blocks": [
{
"text": {
"text": "[${var.environment_name}] == "prod" ? *This is prod alert* : *---*",
"type": "mrkdwn"
}
}
uj5u.com熱心網友回復:
您可以BODY按如下方式使用條件:
body = <<-BODY
{
"blocks": [
{
"text": {
"text": "Alert: ${var.environment_name == "prod" ? "*This is prod alert*" : "*---*"}",
"type": "mrkdwn"
}
}
BODY
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/313771.html
上一篇:將嵌套的模板路徑作為一個變數
