terraform-provider-azurerm: Error when defining connection_string in azurerm_windows_web_app resource

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave “+1” or “me too” comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.0.11

AzureRM Provider Version

3.10.0

Affected Resource(s)/Data Source(s)

azurerm_windows_web_app

Terraform Configuration Files

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_service_plan" "example" {
  name                = "example"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  sku_name            = "P1v2"
}

resource "azurerm_windows_web_app" "example" {
  name                = "example"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_service_plan.example.location
  service_plan_id     = azurerm_service_plan.example.id

  site_config {}

  connection_string {
    name = "ConnectionString"
    type = "SQLServer"
    value = "value"
  }

}

Debug Output/Panic Output

│ Error: updating Connection Strings for Windows Web App: (Site Name "lteupubsvcsdev-app-webapp" / Resource Group "lteudev-rg-asp-crt"): web.AppsClient#UpdateConnectionStrings: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="The parameter properties has an invalid value." Details=[{"Message":"The parameter properties has an invalid value."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"51008","Message":"The parameter properties has an invalid value.","MessageTemplate":"The parameter {0} has an invalid value.","Parameters":["properties"]}}]
│ 
│   with azurerm_windows_web_app.ltpublic_app,
│   on webapp.tf line 46, in resource "azurerm_windows_web_app" "ltpublic_app":
│   46: resource "azurerm_windows_web_app" "ltpublic_app" {
│ 
│ updating Connection Strings for Windows Web App: (Site Name "lteupubsvcsdev-app-webapp" / Resource Group "lteudev-rg-asp-crt"): web.AppsClient#UpdateConnectionStrings: Failure responding to request: StatusCode=400 --
│ Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="The parameter properties has an invalid value." Details=[{"Message":"The parameter properties has an invalid
│ value."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"51008","Message":"The parameter properties has an invalid value.","MessageTemplate":"The parameter {0} has an invalid
│ value.","Parameters":["properties"]}}]

Expected Behaviour

“example” web app should have a connection string called “ConnectionString”

Actual Behaviour

Blows up during TF apply. “example” web app resource is not modified and does not have any defined connection string

Steps to Reproduce

  1. Take example TF code
  2. terraform apply

Important Factoids

No response

References

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 5
  • Comments: 18 (3 by maintainers)

Most upvoted comments

I can also reproduce this error. When I want to create a new connection-string via terraform, I get the error: Error: updating Connection Strings for Windows Web App: (Site Name "xyz" / Resource Group "xyz"): web.AppsClient#UpdateConnectionStrings: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="The parameter properties has an invalid value." Details=[{"Message":"The parameter properties has an invalid value."},{"Code":"BadRequest"},{"ErrorEntity":{"Code":"BadRequest","ExtendedCode":"51008","Message":"The parameter properties has an invalid value.","MessageTemplate":"The parameter {0} has an invalid value.","Parameters":["properties"]}}] When creating the identical values via the portal, everything works perfectly. A subsequent terraform plan then also shows “No changes”.

Apparently terraform does not transmit the data correctly to the API. Can you please check this again?