如何使用 Terraform 输出 URL 的 Azure Logic Apps?
How to output URL of Azure Logic Apps with Terraform?
我想获取 url 个 logicapps,但出现错误。
如何修改 Terraform 代码以使输出有效?
我不是如何引用 Logic App 实例以及获取 url.
的正确方法
logicapp-main.tf
resource "azurerm_resource_group" "example" {
name = "workflow-resources"
location = "West Europe"
}
resource "azurerm_logic_app_workflow" "example" {
name = "workflow1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}
resource "azurerm_logic_app_trigger_http_request" "example" {
name = "some-http-trigger"
logic_app_id = azurerm_logic_app_workflow.example.id#
schema = <<SCHEMA
{
"type": "object",
"properties": {
"Message": {
"type": "string"
}
}
}
SCHEMA
}
output "logic_app_get_url" {
value = some-http-trigger.logic_app_get_url
description = "fetch url"
}
错误:
Error: Reference to undeclared resource
│
│ on logicapp-main.tf line 91, in output "logic_app_get_url":
│ 91: value = some-http-trigger.logic_app_get_url
│
│ A managed resource "some-http-trigger" "logic_app_get_url" has not been declared in the root module.
请修改上述共享 Terraform 代码中的输出块以获取逻辑应用程序的回调 url。
output "url" {
value = azurerm_logic_app_trigger_http_request.example.callback_url
}
这里是修改后的 Terraform 代码:
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "example" {
name = "workflow-resources"
location = "West Europe"
}
resource "azurerm_logic_app_workflow" "example" {
name = "workflow1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}
resource "azurerm_logic_app_trigger_http_request" "example" {
name = "some-http-trigger"
logic_app_id = azurerm_logic_app_workflow.example.id
schema = <<SCHEMA
{
"type": "object",
"properties": {
"hello": {
"type": "string"
}
}
}
SCHEMA
}
output "url" {
value = azurerm_logic_app_trigger_http_request.example.callback_url
}
这里是示例输出以供参考:
我想获取 url 个 logicapps,但出现错误。
如何修改 Terraform 代码以使输出有效? 我不是如何引用 Logic App 实例以及获取 url.
的正确方法logicapp-main.tf
resource "azurerm_resource_group" "example" {
name = "workflow-resources"
location = "West Europe"
}
resource "azurerm_logic_app_workflow" "example" {
name = "workflow1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}
resource "azurerm_logic_app_trigger_http_request" "example" {
name = "some-http-trigger"
logic_app_id = azurerm_logic_app_workflow.example.id#
schema = <<SCHEMA
{
"type": "object",
"properties": {
"Message": {
"type": "string"
}
}
}
SCHEMA
}
output "logic_app_get_url" {
value = some-http-trigger.logic_app_get_url
description = "fetch url"
}
错误:
Error: Reference to undeclared resource
│
│ on logicapp-main.tf line 91, in output "logic_app_get_url":
│ 91: value = some-http-trigger.logic_app_get_url
│
│ A managed resource "some-http-trigger" "logic_app_get_url" has not been declared in the root module.
请修改上述共享 Terraform 代码中的输出块以获取逻辑应用程序的回调 url。
output "url" {
value = azurerm_logic_app_trigger_http_request.example.callback_url
}
这里是修改后的 Terraform 代码:
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "example" {
name = "workflow-resources"
location = "West Europe"
}
resource "azurerm_logic_app_workflow" "example" {
name = "workflow1"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
}
resource "azurerm_logic_app_trigger_http_request" "example" {
name = "some-http-trigger"
logic_app_id = azurerm_logic_app_workflow.example.id
schema = <<SCHEMA
{
"type": "object",
"properties": {
"hello": {
"type": "string"
}
}
}
SCHEMA
}
output "url" {
value = azurerm_logic_app_trigger_http_request.example.callback_url
}
这里是示例输出以供参考: