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

azure_mssql_database - support additional SKUs for Hyperscale tier #23974

Merged
merged 5 commits into from
Nov 21, 2023
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
8 changes: 5 additions & 3 deletions internal/services/mssql/validate/database_sku_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,16 @@ const (
Gen5 = "(GP|HS|BC)_Gen5_(2|4|6|8|10|12|14|16|18|20|24|32|40|80)"
ServerlessGen5 = "(GP|HS)_S_Gen5_(1|2|4|6|8|10|12|14|16|18|20|24|32|40|80)"
Fsv2 = "(GP_Fsv2_(8|10|12|14|16|18|20|24|32|36|72))"
Dc = "((GP|BC|HS)_DC_(2|4|6|8))"
Dc = "((GP|BC|HS)_DC_(2|4|6|8|10|12|14|16|18|20|32|40))"
EightIM = "(HS_8IM_(24|48|80))"
Serverless8IM = "(HS_S_8IM_(24|80))"
Premium8IM = "(HS_PRMS_(2|4|6|8|10|12|14|16|18|20|24|32|40|64|80|128))"
Premium8IH = "(HS_MOPRMS_(2|4|6|8|10|12|14|16|18|20|24|32|40|64|80))"
)

func DatabaseSkuName() pluginsdk.SchemaValidateFunc {
pattern := "(?i)(^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$)"
return validation.StringMatch(regexp.MustCompile(fmt.Sprintf(pattern, Free, Basic, Elastic, Standard, Premium, DataWarehouse, Stretch, BusinessCritical, Gen4, Gen5, ServerlessGen5, Fsv2, Dc, EightIM, Serverless8IM)),
pattern := "(?i)(^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$|^%s$)"
return validation.StringMatch(regexp.MustCompile(fmt.Sprintf(pattern, Free, Basic, Elastic, Standard, Premium, DataWarehouse, Stretch, BusinessCritical, Gen4, Gen5, ServerlessGen5, Fsv2, Dc, EightIM, Serverless8IM, Premium8IM, Premium8IH)),

`This is not a valid sku name. For example, a valid sku name is 'GP_S_Gen5_1','HS_Gen4_1','BC_Gen5_2', 'ElasticPool', 'Basic', 'S0', 'P1'.`,
)
Expand Down
20 changes: 20 additions & 0 deletions internal/services/mssql/validate/database_sku_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,26 @@ func TestDatabaseSkuName(t *testing.T) {
input: "HS_S_8IM_48",
valid: false,
},
{
name: "Valid Premium 8IM",
input: "HS_PRMS_8",
valid: true,
},
{
name: "Invalid Premium 8IM",
input: "HS_PRMS_28",
valid: false,
},
{
name: "Valid Premium 8IH",
input: "HS_MOPRMS_8",
valid: true,
},
{
name: "Invalid Premium 8IH",
input: "HS_MOPRMS_128",
valid: false,
},
}
validationFunction := DatabaseSkuName()
for _, tt := range tests {
Expand Down
Loading