Azure / terraform-provider-azapi

Terraform provider for Azure Resource Manager Rest API
https://registry.terraform.io/providers/Azure/azapi/latest
Mozilla Public License 2.0
184 stars 48 forks source link

Can AzAPI accept an xml response? #288

Open scottfischer-8451 opened 1 year ago

scottfischer-8451 commented 1 year ago

I'm attempting to use AzAPI to retrieve the publishing profile of an Azure Function. Publishing Profile

I'm using the "azapi_resource_action" data source for this retrieval. Enabling tracing, I can see the successful call and response (200) as well as the return xml. However, since the response is xml it doesn't appear to be captured and stored in the state file.

`data "azurerm_resource_group" "rg" { name = "rg-sftest2-dev" }

data "azurerm_function_app" "funcapp" { name = "sftest22" resource_group_name = data.azurerm_resource_group.rg.name }

data "azapi_resource_action" "fa_xml" { type = "Microsoft.Web/sites@2022-03-01" resource_id = data.azurerm_function_app.funcapp.id action = "publishxml" body = jsonencode({"format"="WebDeploy"}) response_export_values = ["*"] }`

Am I doing something wrong, or is AzAPI unable to handle responses that are not json?

Thanks!

ms-henglu commented 1 year ago

Hi @scottfischer-8451 ,

Thank you for taking time to open this issue!

Yes, azapi doesn't support handling responses that are not json yet. But the HCL also don't have a function to handle xml format data.