Skip to content

Commit

Permalink
Validate Service Bus Topic and Queue max_size_in_megabytes
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-sensenich committed Sep 26, 2020
1 parent af53259 commit 2f87399
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
20 changes: 20 additions & 0 deletions azurerm/helpers/validate/servicebus.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package validate

import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
)

func ServiceBusMaxSizeInMegabytes() schema.SchemaValidateFunc {
return validation.IntInSlice([]int{
1024,
2048,
3072,
4096,
5120,
10240,
20480,
40960,
81920,
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ func resourceArmServiceBusQueue() *schema.Resource {
},

"max_size_in_megabytes": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Type: schema.TypeInt,
Optional: true,
Computed: true,
ValidateFunc: validate.ServiceBusMaxSizeInMegabytes(),
},

"requires_duplicate_detection": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,10 @@ func resourceArmServiceBusTopic() *schema.Resource {
},

"max_size_in_megabytes": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
Type: schema.TypeInt,
Optional: true,
Computed: true,
ValidateFunc: validate.ServiceBusMaxSizeInMegabytes(),
},

"requires_duplicate_detection": {
Expand Down

0 comments on commit 2f87399

Please sign in to comment.