Azure Storage Queue

This page shows how to write Terraform for Storage Queue and write them securely.

azurerm_storage_queue (Terraform)

The Queue in Storage can be configured in Terraform with the resource name azurerm_storage_queue. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

storage.tf#L20
resource "azurerm_storage_queue" "queue1" {
  name                 = var.queue1_name
  storage_account_name = azurerm_storage_account.storage.name
}

resource "azurerm_storage_queue" "queue2" {
storage.tf#L40
resource "azurerm_storage_queue" "summary_requests" {
  name                 = "summary-requests"
  storage_account_name = azurerm_storage_account.st.name
}
resource "azurerm_storage_queue" "summary_requests_poison" {
  name                 = "summary-requests-poison"
queue.tf#L1
resource "azurerm_storage_queue" "queue" {
  name                 = var.settings.name
  storage_account_name = var.storage_account_name
  metadata             = try(var.settings.metadata, null)
storage.tf#L19
resource "azurerm_storage_queue" "storage_queue" {
  name                  = "test-queue"
  storage_account_name  = azurerm_storage_account.storage-account.name
itan-azure-rm-storage-queues.tf#L1
resource "azurerm_storage_queue" "itan-queue-channel-to-download" {
  name = "channel-to-download"
  storage_account_name = azurerm_storage_account.itan_storage_account.name
}

resource "azurerm_storage_queue" "itan-queue-channel-update" {
main.tf#L1
resource "azurerm_storage_queue" "str_que" {
  count                = length(var.names)
  name                 = var.names[count.index]
  storage_account_name = var.storage_account_name
  metadata             = var.metadata
}
main.tf#L26
resource "azurerm_storage_queue" "queue" {
  name                 = "demob"
  storage_account_name = azurerm_storage_account.storagehux.name
}

resource "azurerm_storage_table" "table" {
main.tf#L8
resource "azurerm_storage_queue" "default" {
  name                 = "defaultstoragequeue"
  storage_account_name = azurerm_storage_account.default.name
}
resource "azurerm_eventgrid_event_subscription" "sub" {
  name       = "event-yourname-sample"
main.tf#L7
resource "azurerm_storage_queue" "this" {
  metadata             = var.metadata
  name                 = var.name
  storage_account_name = var.storage_account_name

  dynamic "timeouts" {
main.tf#L28
resource "azurerm_storage_queue" "example" {
  name                 = "disqueue"
  storage_account_name = azurerm_storage_account.example.name
}

resource "azurerm_storage_share" "example" {

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Manages a Queue within an Azure Storage Account.

Tips: Best Practices for The Other Azure Storage Resources

In addition to the azurerm_storage_account, Azure Storage has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

azurerm_storage_account

Ensure to use HTTPS connections

It is better to use HTTPS instead of HTTP, which could be vulnerable to person-in-the-middle attacks.

risk-label

azurerm_storage_account_network_rules

Ensure to allow Trusted Microsoft Services to bypass

It is better to allow Trusted Microsoft Services to bypass. They are not able to access storage account unless rules are set to allow them explicitly.

Review your Azure Storage settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

Azure Resource Manager Example

Azure Resource Manager code does not have the related resource.

Frequently asked questions

What is Azure Storage Queue?

Azure Storage Queue is a resource for Storage of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Storage Queue?

For Terraform, the tmissao/Azure_Kubernetes_Studies, finn-wa-log-cabin/lc-devops-terraform and aztfmod/terraform-azurerm-caf source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.