Skip to content

Confirm List of Queues will be available #193

@danielrehmann

Description

@danielrehmann

Hey there,

we are currently evaluating if we want to use terraform-compliance in our application. One of our use cases is to ensure all necessary Servicebus Queues will be available after performing the terraform apply.
Our queue resources are generated by following TF code:

resource "azurerm_servicebus_queue" "sb" {
  for_each            = toset(var.servicebus_queue_list)
  name                = each.value
  resource_group_name = ".."
  namespace_name      = "..."
  enable_partitioning = true
  dead_lettering_on_message_expiration = true
  default_message_ttl = "P14D"
}

Where we pass a list of queues and expect them to be created.

We would like to write a scenario for each essential queue e.g. app-error

  Scenario: App Error queue exists
    Given I have azurerm_servicebus_queue defined
    Then it must contain name
    Then its value must contain app-error

This fails because we have multiple queues that have different names:

 Scenario: App Error queue exists
        Given I have azurerm_servicebus_queue defined
        Then it must contain name
        Then its value must contain app-error
          AssertionError: name property in azurerm_servicebus_queue did not contain app-error, it is set to ['another-queue']

We tried to add the name to the WHEN clause but it resulted in skipping test:

Scenario: ServiceBus configuration
        Given I have azurerm_servicebus_queue defined
	SKIPPING: Can not find app-error defined in target terraform plan.
        When its name is "app-error" regex
        ...

Could you guide us how we can test if the different queues exist after the apply?

Kind Regards,
Daniel

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions