Terraform-provider-azurerm: Storage Account queue_properties/logging

Created on 20 Sep 2019  路  11Comments  路  Source: terraform-providers/terraform-provider-azurerm

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 (and AzureRM Provider) Version

Terraform v0.12.9
azurerm v1.34.0

Affected Resource(s)

  • azurerm_storage_account

Terraform Configuration Files

provider "azurerm" {
    version = ">=1.34.0"
}
resource "azurerm_resource_group" "rg" {
    name     = "chfrodin_test_rg"
    location = "westeurope"
}

resource "azurerm_storage_account" "sa" {
  name                      = "chfrodintestsa"
  location                  = "westeurope"
  resource_group_name       = azurerm_resource_group.rg.name
  account_replication_type  = "LRS"
  account_kind              = "Storage"
  account_tier              = "Standard"

   queue_properties  {
        logging {
        delete                = true
        read                  = true
        version               = "1"
        write                 = true
        retention_policy_days = "10"
        }
    }
   }

Debug Output

Panic Output

logging_version set with string:
https://gist.github.com/chfrodin/19e65addafae7af5ef558545b60dd8ba
logging_version set with number:
https://gist.github.com/chfrodin/34afcafe41bdc93dd05467e9cad8c251

Expected Behavior

Storage account with Logging enabled. Per https://www.terraform.io/docs/providers/azurerm/r/storage_account.html#delete

When logging_version is set to string, and when set to number the error differs. See gist links under panic section.

Actual Behavior

Error shown when creating azure storage account

Steps to Reproduce

terraform apply

  1. terraform apply

Important Factoids

References

  • #0000
bug servicstorage

Most helpful comment

I was able to get around this problem by adding the hour_metric and minute_metric blocks to the queue_properties section, like this...

  queue_properties  {

    logging {
      delete                = true
      read                  = true
      write                 = true
      version               = "1.0"
      retention_policy_days = 10
    }

    hour_metrics {
      enabled               = true
      include_apis          = true
      version               = "1.0"
      retention_policy_days = 10
    }

    minute_metrics {
      enabled               = true
      include_apis          = true
      version               = "1.0"
      retention_policy_days = 10
    }
  }

All 11 comments

I'm having a similar issue:

Error updating Azure Storage Account `queue_properties` "tfabrikamdevio": queues.Client#SetServiceProperties: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: error response cannot be parsed: "\ufeff<?xml version=\"1.0\" encoding=\"utf-8\"?><Error><Code>InvalidXmlDocument</Code><Message>XML specified is not syntactically valid.\nRequestId:c8c3d0bb-9003-00c3-4470-8f2188000000\nTime:2019-10-30T22:20:11.9829906Z</Message><LineNumber>2</LineNumber><LinePosition>230</LinePosition><Reason>Unexpected value for Version.</Reason></Error>" error: invalid character '茂' looking for beginning of value

I can't find any docs on how to set up these blocks, so not sure if its an issue with how they are specified, or something with the resource/provider :/

In the documentation for non-terraform management I've noticed, that version "1.0" is used. But it doesn't help either.

I have the same issue. Errormessage: queues.Client#SetServiceProperties: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidXmlDocument" Message="XML specified is not syntactically valid

  queue_properties {
    logging {
      delete  = true
      read    = true
      version = "1.0"
      write   = true
      retention_policy_days = var.log_retention_days
    }
  }

Provider 1.39.0
Terraform 0.12.13

Same here, any update on this?

Error: Error updating Azure Storage Account queue_properties "devdls01": queues.Client#SetServiceProperties: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidXmlDocument" Message="XML specified is not syntactically valid.\nRequestId:0030-37e3-c6f20d000000\nTime:2020-01-09T11:54:05.4506381Z"

Same here, any update on this?

Error: Error updating Azure Storage Account queue_properties "devdls01": queues.Client#SetServiceProperties: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidXmlDocument" Message="XML specified is not syntactically valid.\nRequestId:0030-37e3-c6f20d000000\nTime:2020-01-09T11:54:05.4506381Z"

I'm having this same issue too

I was able to get around this problem by adding the hour_metric and minute_metric blocks to the queue_properties section, like this...

  queue_properties  {

    logging {
      delete                = true
      read                  = true
      write                 = true
      version               = "1.0"
      retention_policy_days = 10
    }

    hour_metrics {
      enabled               = true
      include_apis          = true
      version               = "1.0"
      retention_policy_days = 10
    }

    minute_metrics {
      enabled               = true
      include_apis          = true
      version               = "1.0"
      retention_policy_days = 10
    }
  }

I was able to get around this problem by adding the hour_metric and minute_metric blocks to the queue_properties section, like this...

  queue_properties  {

    logging {
      delete                = true
      read                  = true
      write                 = true
      version               = "1.0"
      retention_policy_days = 10
    }

    hour_metrics {
      enabled               = true
      include_apis          = true
      version               = "1.0"
      retention_policy_days = 10
    }

    minute_metrics {
      enabled               = true
      include_apis          = true
      version               = "1.0"
      retention_policy_days = 10
    }
  }

I believe this is for data lake storage account right? I'm still getting invalid XML error.

I'm not sure this has anything to do with Data Lake storage... I think it has to do with how often storage pushes monitoring metrics to Azure Monitor, but honestly not 100% sure. But, to your question, I used these settings to setup a plain-old general storage v2 account - nothing to do with Data Lake.

Hi Team , even with the workaround for queue logging . When will we be able to do the same for blob and table storage . I am currently using a very ugly "null_resource" local-exec that calls az storage logging update. Its not a good work around .

@almero2020 Blob logging is currently tracked in issue #5909. Might be a good idea to open one for table logging.

This continue to be a problem ... and it's a severe one as the Azure API is not really helping. The provider in 2.5 is still loosely mapping the parameters to the XML request and nor only the documentation is poorly shown as options but you have to guess the options for days in order to make it work.

Was this page helpful?
0 / 5 - 0 ratings