I would like fetch url of logicapps, but getting errors.
How to modify Terraform code so that output works? I'm not how to reference to Logic App instance and what is correct way to get 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:
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.
Please do modify the output block in the above shared terraform code to fetch the callback url of the logic app.
output "url" {
value = azurerm_logic_app_trigger_http_request.example.callback_url
}
Here is the modified Terraform Code:
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
}
Here is the sample output for reference :