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

Update TimeSpan documentation in Service Bus Queue/Topic #1921

Merged
merged 3 commits into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions azurerm/resource_arm_servicebus_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,24 @@ func resourceArmServiceBusQueue() *schema.Resource {
"resource_group_name": resourceGroupNameSchema(),

"auto_delete_on_idle": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validateIso8601Duration(),
},

"default_message_ttl": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validateIso8601Duration(),
},

"duplicate_detection_history_time_window": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validateIso8601Duration(),
},

"enable_express": {
Expand Down
50 changes: 50 additions & 0 deletions azurerm/resource_arm_servicebus_queue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,30 @@ func TestAccAzureRMServiceBusQueue_lockDuration(t *testing.T) {
})
}

func TestAccAzureRMServiceBusQueue_isoTimeSpanAttributes(t *testing.T) {
resourceName := "azurerm_servicebus_queue.test"
ri := acctest.RandInt()
config := testAccAzureRMServiceBusQueue_isoTimeSpanAttributes(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMServiceBusQueueDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMServiceBusQueueExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "auto_delete_on_idle", "PT10M"),
resource.TestCheckResourceAttr(resourceName, "default_message_ttl", "PT30M"),
resource.TestCheckResourceAttr(resourceName, "requires_duplicate_detection", "true"),
resource.TestCheckResourceAttr(resourceName, "duplicate_detection_history_time_window", "PT15M"),
),
},
},
})
}

func testCheckAzureRMServiceBusQueueDestroy(s *terraform.State) error {
client := testAccProvider.Meta().(*ArmClient).serviceBusQueuesClient
ctx := testAccProvider.Meta().(*ArmClient).StopContext
Expand Down Expand Up @@ -501,3 +525,29 @@ resource "azurerm_servicebus_queue" "test" {
}
`, rInt, location, rInt, rInt)
}

func testAccAzureRMServiceBusQueue_isoTimeSpanAttributes(rInt int, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}

resource "azurerm_servicebus_namespace" "test" {
name = "acctestservicebusnamespace-%d"
resource_group_name = "${azurerm_resource_group.test.name}"
location = "${azurerm_resource_group.test.location}"
sku = "standard"
}

resource "azurerm_servicebus_queue" "test" {
name = "acctestservicebusqueue-%d"
resource_group_name = "${azurerm_resource_group.test.name}"
namespace_name = "${azurerm_servicebus_namespace.test.name}"
auto_delete_on_idle = "PT10M"
default_message_ttl = "PT30M"
requires_duplicate_detection = true
duplicate_detection_history_time_window = "PT15M"
}
`, rInt, location, rInt, rInt)
}
21 changes: 12 additions & 9 deletions azurerm/resource_arm_servicebus_topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,24 @@ func resourceArmServiceBusTopic() *schema.Resource {
},

"auto_delete_on_idle": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validateIso8601Duration(),
},

"default_message_ttl": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validateIso8601Duration(),
},

"duplicate_detection_history_time_window": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validateIso8601Duration(),
},

"enable_batched_operations": {
Expand Down
50 changes: 50 additions & 0 deletions azurerm/resource_arm_servicebus_topic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,30 @@ func TestAccAzureRMServiceBusTopic_enableDuplicateDetection(t *testing.T) {
})
}

func TestAccAzureRMServiceBusTopic_isoTimeSpanAttributes(t *testing.T) {
resourceName := "azurerm_servicebus_topic.test"
ri := acctest.RandInt()
config := testAccAzureRMServiceBusTopic_isoTimeSpanAttributes(ri, testLocation())

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMServiceBusTopicDestroy,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMServiceBusTopicExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "auto_delete_on_idle", "PT10M"),
resource.TestCheckResourceAttr(resourceName, "default_message_ttl", "PT30M"),
resource.TestCheckResourceAttr(resourceName, "requires_duplicate_detection", "true"),
resource.TestCheckResourceAttr(resourceName, "duplicate_detection_history_time_window", "PT15M"),
),
},
},
})
}

func testCheckAzureRMServiceBusTopicDestroy(s *terraform.State) error {
client := testAccProvider.Meta().(*ArmClient).serviceBusTopicsClient
ctx := testAccProvider.Meta().(*ArmClient).StopContext
Expand Down Expand Up @@ -425,3 +449,29 @@ resource "azurerm_servicebus_topic" "test" {
}
`, rInt, location, rInt, rInt)
}

func testAccAzureRMServiceBusTopic_isoTimeSpanAttributes(rInt int, location string) string {
return fmt.Sprintf(`
resource "azurerm_resource_group" "test" {
name = "acctestRG-%d"
location = "%s"
}

resource "azurerm_servicebus_namespace" "test" {
name = "acctestservicebusnamespace-%d"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "standard"
}

resource "azurerm_servicebus_topic" "test" {
name = "acctestservicebustopic-%d"
namespace_name = "${azurerm_servicebus_namespace.test.name}"
resource_group_name = "${azurerm_resource_group.test.name}"
auto_delete_on_idle = "PT10M"
default_message_ttl = "PT30M"
requires_duplicate_detection = true
duplicate_detection_history_time_window = "PT15M"
}
`, rInt, location, rInt, rInt)
}
19 changes: 6 additions & 13 deletions website/docs/r/servicebus_queue.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,14 @@ The following arguments are supported:
* `resource_group_name` - (Required) The name of the resource group in which to
create the namespace. Changing this forces a new resource to be created.

* `auto_delete_on_idle` - (Optional) The idle interval after which the
Queue is automatically deleted, minimum of 5 minutes. Provided in the [TimeSpan](#timespan-format)
format.
* `auto_delete_on_idle` - (Optional) The ISO 8601 timespan duration of the idle interval after which the
Queue is automatically deleted, minimum of 5 minutes.

* `default_message_ttl` - (Optional) The TTL of messages sent to this queue. This is the default value
used when TTL is not set on message itself. Provided in the [TimeSpan](#timespan-format)
format.
* `default_message_ttl` - (Optional) The ISO 8601 timespan duration of the TTL of messages sent to this
queue. This is the default value used when TTL is not set on message itself.

* `duplicate_detection_history_time_window` - (Optional) The duration during which
duplicates can be detected. Default value is 10 minutes. Provided in the [TimeSpan](#timespan-format) format.
* `duplicate_detection_history_time_window` - (Optional) The ISO 8601 timespan duration during which
duplicates can be detected. Default value is 10 minutes. (`PT10M`)

* `enable_express` - (Optional) Boolean flag which controls whether Express Entities
are enabled. An express queue holds a message in memory temporarily before writing
Expand Down Expand Up @@ -104,11 +102,6 @@ The following arguments are supported:
Changing this forces a new resource to be created. Defaults to `false`.

* `dead_lettering_on_message_expiration` - (Optional) Boolean flag which controls whether the Queue has dead letter support when a message expires. Defaults to `false`.

### TimeSpan Format

Some arguments for this resource are required in the TimeSpan format which is
used to represent a length of time. The supported format is documented [here](https://msdn.microsoft.com/en-us/library/se73z7b9(v=vs.110).aspx#Anchor_2)

## Attributes Reference

Expand Down
19 changes: 6 additions & 13 deletions website/docs/r/servicebus_topic.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,14 @@ The following arguments are supported:

* `status` - (Optional) The Status of the Service Bus Topic. Acceptable values are `Active` or `Disabled`. Defaults to `Active`.

* `auto_delete_on_idle` - (Optional) The idle interval after which the
Topic is automatically deleted, minimum of 5 minutes. Provided in the [TimeSpan](#timespan-format)
format.
* `auto_delete_on_idle` - (Optional) The ISO 8601 timespan duration of the idle interval after which the
Topic is automatically deleted, minimum of 5 minutes.

* `default_message_ttl` - (Optional) The TTL of messages sent to this topic if no
TTL value is set on the message itself. Provided in the [TimeSpan](#timespan-format)
format.
* `default_message_ttl` - (Optional) The ISO 8601 timespan duration of TTL of messages sent to this topic if no
TTL value is set on the message itself.

* `duplicate_detection_history_time_window` - (Optional) The duration during which
duplicates can be detected. Provided in the [TimeSpan](#timespan-format) format. Defaults to 10 minutes (`00:10:00`)
* `duplicate_detection_history_time_window` - (Optional) The ISO 8601 timespan duration during which
duplicates can be detected. Defaults to 10 minutes. (`PT10M`)

* `enable_batched_operations` - (Optional) Boolean flag which controls if server-side
batched operations are enabled. Defaults to false.
Expand All @@ -98,11 +96,6 @@ The following arguments are supported:
* `support_ordering` - (Optional) Boolean flag which controls whether the Topic
supports ordering. Defaults to false.

### TimeSpan Format

Some arguments for this resource are required in the TimeSpan format which is
used to represent a lengh of time. The supported format is documented [here](https://msdn.microsoft.com/en-us/library/se73z7b9(v=vs.110).aspx#Anchor_2)

## Attributes Reference

The following attributes are exported:
Expand Down