hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.51k stars 4.6k forks source link

"azurerm_servicebus_topic" does not use "batched_operations_enabled" as it should in v3.112.0 #26668

Open alexpilon666 opened 1 month ago

alexpilon666 commented 1 month ago

Is there an existing issue for this?

Community Note

Terraform Version

1.9.2

AzureRM Provider Version

3.112.0

Affected Resource(s)/Data Source(s)

azurerm_servicebus_topic

Terraform Configuration Files

resource "azurerm_servicebus_topic" "this" {
  for_each = local.topics

  name         = each.value.name
  namespace_id = azurerm_servicebus_namespace.this.id

  auto_delete_on_idle                     = each.value.auto_delete_on_idle
  default_message_ttl                     = each.value.default_message_ttl
  duplicate_detection_history_time_window = each.value.duplicate_detection_history_time_window
  batched_operations_enabled              = each.value.batched_operations_enabled
  express_enabled                         = each.value.express_enabled
  partitioning_enabled                    = each.value.partitioning_enabled
  max_message_size_in_kilobytes           = each.value.max_message_size_in_kilobytes
  max_size_in_megabytes                   = each.value.max_size_in_megabytes
  requires_duplicate_detection            = each.value.requires_duplicate_detection
  status                                  = each.value.status
  support_ordering                        = each.value.support_ordering
}

Debug Output/Panic Output

# module.rcuseraccounts_sbus.module.this["rcuseraccounts-prod"].azurerm_servicebus_topic.this["staging-scoring-stats-topic"] will be updated in-place
  ~ resource "azurerm_servicebus_topic" "this" {
      - enable_batched_operations               = true -> null
        id                                      = "/subscriptions/<redacted>"
        name                                    = "staging-scoring-stats-topic"
        # (14 unchanged attributes hidden)

      - timeouts {}
    }

Expected Behaviour

Nothing should be changed since enable_batched_operations is now deprecated as of v3.112.0 and replaced with batched_operations_enabled.

Actual Behaviour

The provider ignores the new batched_operations_enabled argument, and since enable_batched_operations has been removed from the code it will nullify the value (which means setting it to false in Azure).

Steps to Reproduce

  1. Replace enable_batched_operations with batched_operations_enabled in azurerm_servicebus_topic resource
  2. terraform plan

Important Factoids

No response

References

https://github.com/hashicorp/terraform-provider-azurerm/pull/26479#issuecomment-2227336619

Benj13 commented 1 month ago

Hi, I am facing a similar issue with the partitioning_enabled attribute on the azurerm_servicebus_queue resource.

When changing enable_partitioning to partitioning_enabled in the code, it is ignored and enable_partitioning revert to its default value which cause the plan to suggest the recreation of the queue.

Here is the code:

resource "azurerm_servicebus_queue" "main" {
  name                                 = "queue-name"
  namespace_id                         = local.service_bus.id
  dead_lettering_on_message_expiration = false
  partitioning_enabled                 = true
}

And the plan output:

# azurerm_servicebus_queue.main must be replaced
-/+ resource "azurerm_servicebus_queue" "main" {
      ~ auto_delete_on_idle                     = "P10675199DT2H48M5.4775807S" -> (known after apply)
      ~ batched_operations_enabled              = true -> (known after apply)
      ~ default_message_ttl                     = "P10675199DT2H48M5.4775807S" -> (known after apply)
      ~ duplicate_detection_history_time_window = "PT10M" -> (known after apply)
      ~ enable_partitioning                     = true -> false # forces replacement
      ~ express_enabled                         = false -> (known after apply)
      ~ id                                      = "/subscriptions/..." -> (known after apply)
      ~ lock_duration                           = "PT1M" -> (known after apply)
      ~ max_message_size_in_kilobytes           = 256 -> (known after apply)
      ~ max_size_in_megabytes                   = 5120 -> (known after apply)
        name                                    = "queue-name"
        # (11 unchanged attributes hidden)
    }

It works on azurerm_servicebus_topic resource though.

Since the issue is on a different resource than the one referenced in this issue, let me know if I should open a new issue for azurerm_servicebus_queue

aprice-sss commented 1 month ago

I am seeing a similar issue in azurerm 3.113.0 / TF 1.9.3 with azurerm_servicebus_queue.enable_partitioning vs azurerm_servicebus_queue.partitioning_enabled. enable_partitioning is marked as deprecated and issues a warning, but if I change it to partitioning_enabled it doesn't take, and I instead get an error that non-partitioned entities are not allowed in partitioned namespace. If I pass both, I get Error: Conflicting configuration arguments.

Benj13 commented 1 week ago

Upgrading to azurerm 4.0.x solved the issue