Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on API Management Diagnostic resource with empty optional blocks #11314

Closed
ghost opened this issue Apr 13, 2021 · 2 comments · Fixed by #11402
Closed

Crash on API Management Diagnostic resource with empty optional blocks #11314

ghost opened this issue Apr 13, 2021 · 2 comments · Fixed by #11402

Comments

@ghost
Copy link

ghost commented Apr 13, 2021

This issue was originally opened by @Berbe as hashicorp/terraform#28349. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.14.10
+ provider registry.terraform.io/hashicorp/azurerm v2.55.0
+ provider registry.terraform.io/hashicorp/template v2.2.0

Terraform Configuration Files

data "azurerm_resource_group" "RG" {
  name     = "RG"
}

data "azurerm_api_management" "APIM" {
  name                = "APIM"
  resource_group_name = data.azurerm_resource_group.RG.name
}

resource "azurerm_application_insights" "APPI" {
  name                = "APPI"
  location            = data.azurerm_resource_group.RG.location
  resource_group_name = data.azurerm_resource_group.RG.name
  application_type    = "web"
}

resource "azurerm_api_management_logger" "APIM_APPI" {
  name                = "APIM-APPI"
  resource_group_name = data.azurerm_resource_group.RG.name
  api_management_name = data.azurerm_api_management.APIM.name

  application_insights {
    instrumentation_key = azurerm_application_insights.APPI.instrumentation_key
  }
}

resource "azurerm_api_management_diagnostic" "APIM_APPI" {
  identifier = "applicationinsights"
  resource_group_name = data.azurerm_resource_group.RG.name
  api_management_name = data.azurerm_api_management.APIM.name
  api_management_logger_id = azurerm_api_management_logger.APIM_APPI.id
}

Debug Output

Ciphered with https://www.hashicorp.com/security#secure-communications
https://paste.rosset.net/?3298b64a64102a0b#5TVfY2NmaFLR1raDdDm6RHXjUzmgFMko6Vp3UodGyKmh

Crash Output

Ciphered with https://www.hashicorp.com/security#secure-communications
https://paste.rosset.net/?212e1e7bd452cebc#EQfbfs5KRWoDywQaUmdXYsNZJDLjQRfZZhqMvMeHSFXy

Expected Behavior

No crash

Actual Behavior

Crash

Steps to Reproduce

  1. Add:
  frontend_request {
  }

  frontend_response {
  }

  backend_request {
  }

  backend_response {
  }

to a created azurerm_api_management_diagnostic resource.
2. terraform apply

Additional Context

Documentation both states:

  • blocks are optional
  • directives inside those blocks are optional
    I suspect the crash comes from the fact those empty blocks are not properly handled.

If they are not supposed to be empty (no enforced defaults for contained directives), please document them as such.

Reproducible as far back as the first release of the azurerm provider introducing those optional blocks, ie v2.46.1 (v2.46.0).

References

@ghost
Copy link
Author

ghost commented Apr 30, 2021

This has been released in version 2.57.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.57.0"
}
# ... other configuration ...

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants