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

azurerm_security_center_subscription_pricing extention error: Unexpected character encountered while parsing value: { #27704

Closed
1 task done
niiku opened this issue Oct 20, 2024 · 2 comments · Fixed by #27721

Comments

@niiku
Copy link

niiku commented Oct 20, 2024

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 comments along the lines of "+1", "me too" or "any updates", 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 and review the contribution guide to help.

Terraform Version

v1.8.5

AzureRM Provider Version

4.6.0

Affected Resource(s)/Data Source(s)

azurerm_security_center_subscription_pricing

Terraform Configuration Files

resource "azurerm_security_center_subscription_pricing" "landing_zone" {
  resource_type = "StorageAccounts"
  subplan       = "DefenderForStorageV2"
  tier          = "Standard"

  extension {

    additional_extension_properties = {
      "CapGBPerMonthPerStorageAccount" = "5000"
    }
    name = "OnUploadMalwareScanning"

  }
  extension {
    name = "SensitiveDataDiscovery"
  }
}

Debug Output/Panic Output

azurerm_security_center_subscription_pricing.landing_zone: Creating...
╷
│ Error: setting Pricing (Subscription: ""
│ Pricing Name: "StorageAccounts"): unexpected status 400 (400 Bad Request) with response: {"properties.extensions[0].additionalExtensionProperties.OnUploadMalwareScanning":["Unexpected character encountered while parsing value: {. Path 'properties.extensions[0].additionalExtensionProperties.OnUploadMalwareScanning', line 1, position 90.","After parsing a value an unexpected character was encountered: :. Path 'properties.extensions[0].additionalExtensionProperties.OnUploadMalwareScanning', line 1, position 122.","After parsing a value an unexpected character was encountered: :. Path 'properties.extensions[0].additionalExtensionProperties.OnUploadMalwareScanning', line 1, position 122.","After parsing a value an unexpected character was encountered: :. Path 'properties.extensions[0].additionalExtensionProperties.OnUploadMalwareScanning', line 1, position 122.","After parsing a value an unexpected character was encountered: :. Path 'properties.extensions[0].additionalExtensionProperties.OnUploadMalwareScanning', line 1, position 122.","After parsing a value an unexpected character was encountered: :. Path 'properties.extensions[0].additionalExtensionProperties.OnUploadMalwareScanning', line 1, position 122."]}
│
│   with azurerm_security_center_subscription_pricing.landing_zone,
│   on defender-for-cloud.tf line 26, in resource "azurerm_security_center_subscription_pricing" "landing_zone":
│   26: resource "azurerm_security_center_subscription_pricing" "landing_zone" {

Expected Behaviour

azurerm_security_center_subscription_pricing.landing_zone is created

Actual Behaviour

Request body is not correctly composed and the error is thrown.

A similar issue appears when no extensions are configured but Azure does apply default extensions. Then a similar error is thrown when in the second terraform apply tries to remove those extensions

Steps to Reproduce

Just apply

Important Factoids

No response

References

This issue is introduced with 4.6.0 - most likely during the changes applied in this commit:
8da4254
internal/services/securitycenter/security_center_subscription_pricing_resource.go

See line 264 and 293:
https://github.com/hashicorp/terraform-provider-azurerm/blame/8da4254d313a733d1c15f27d9b91929ea2381cff/internal/services/securitycenter/security_center_subscription_pricing_resource.go#L293

Maybe @stephybun could you have a look at this issue as you were applying these changes?

I cannot tell if the error is because of your changes or because of the SDK update.

@neil-yechenwei
Copy link
Contributor

neil-yechenwei commented Oct 21, 2024

Thanks for raising this issue. Seems the type of "additionalExtensionProperties" in GO SDK is different with the type in service API. So service API failed to parse it. @stephybun , please double check. Thanks.

Copy link

github-actions bot commented Dec 1, 2024

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 Dec 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants