Skip to content

Commit

Permalink
Validation on max
Browse files Browse the repository at this point in the history
  • Loading branch information
Aris van Ommeren committed Oct 21, 2021
1 parent e87cb24 commit f91e1ec
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions internal/services/servicebus/servicebus_queue_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,10 @@ func resourceServiceBusQueue() *pluginsdk.Resource {
},

"max_message_size_in_kilobytes": {
Type: pluginsdk.TypeInt,
Optional: true,
Computed: true,
Type: pluginsdk.TypeInt,
Optional: true,
Computed: true,
ValidateFunc: azValidate.ServiceBusMaxMessageSizeInKilobytes(),
},

"max_size_in_megabytes": {
Expand Down
7 changes: 4 additions & 3 deletions internal/services/servicebus/servicebus_topic_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ func resourceServiceBusTopic() *pluginsdk.Resource {
},

"max_message_size_in_kilobytes": {
Type: pluginsdk.TypeInt,
Optional: true,
Computed: true,
Type: pluginsdk.TypeInt,
Optional: true,
Computed: true,
ValidateFunc: azValidate.ServiceBusMaxMessageSizeInKilobytes(),
},

"max_size_in_megabytes": {
Expand Down
4 changes: 4 additions & 0 deletions internal/services/servicebus/validate/servicebus.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ func ServiceBusMaxSizeInMegabytes() pluginsdk.SchemaValidateFunc {
81920,
})
}

func ServiceBusMaxMessageSizeInKilobytes() pluginsdk.SchemaValidateFunc {
return validation.IntBetween(1024, 102400)
}

0 comments on commit f91e1ec

Please sign in to comment.