Skip to content

Commit

Permalink
fix version validation
Browse files Browse the repository at this point in the history
  • Loading branch information
teowa committed Sep 25, 2023
1 parent 085cc1d commit 5926fba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 126 deletions.
132 changes: 8 additions & 124 deletions internal/services/resource/resource_deployment_script_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,133 +222,17 @@ func getDeploymentScriptArguments(kind DeploymentScriptKind) map[string]*plugins

if kind == AzurePowerShellKind {
result["version"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
"2.7",
"2.8",
"3.0",
"3.1",
"3.2",
"3.3",
"3.4",
"3.5",
"3.6",
"3.7",
"3.8",
"4.1",
"4.2",
"4.3",
"4.4",
"4.5",
"4.6",
"4.7",
"4.8",
"5.0",
"5.1",
"5.2",
"5.3",
"5.4",
"5.5",
"5.6",
"5.7",
"5.8",
"5.9",
"6.0",
"6.1",
"6.2",
"6.3",
"6.4",
"6.5",
"6.6",
"7.0",
"7.1",
"7.2",
"7.3",
"7.4",
"7.5",
"8.0",
"8.1",
"8.2",
"8.3",
"9.0",
}, false),
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringIsNotEmpty,
}
} else {
result["version"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
"2.0.77",
"2.0.78",
"2.0.79",
"2.0.80",
"2.0.81",
"2.1.0",
"2.10.0",
"2.10.1",
"2.11.0",
"2.11.1",
"2.12.0",
"2.12.1",
"2.13.0",
"2.14.0",
"2.14.1",
"2.14.2",
"2.15.0",
"2.15.1",
"2.16.0",
"2.17.0",
"2.17.1",
"2.18.0",
"2.19.0",
"2.19.1",
"2.2.0",
"2.20.0",
"2.21.0",
"2.22.0",
"2.22.1",
"2.23.0",
"2.24.0",
"2.24.1",
"2.24.2",
"2.25.0",
"2.26.0",
"2.26.1",
"2.27.0",
"2.27.1",
"2.27.2",
"2.28.0",
"2.29.0",
"2.29.1",
"2.29.2",
"2.3.0",
"2.3.1",
"2.30.0",
"2.31.0",
"2.32.0",
"2.33.0",
"2.33.1",
"2.34.0",
"2.34.1",
"2.35.0",
"2.36.0",
"2.37.0",
"2.38.0",
"2.39.0",
"2.4.0",
"2.40.0",
"2.41.0",
"2.5.0",
"2.5.1",
"2.6.0",
"2.7.0",
"2.8.0",
"2.9.0",
"2.9.1",
}, false),
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringIsNotEmpty,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ The following arguments are supported:

* `location` - (Required) Specifies the Azure Region where the Resource Deployment Script should exist. Changing this forces a new Resource Deployment Script to be created.

* `version` - (Required) Azure CLI module version to be used. The supported versions are `2.0.77`, `2.0.78`, `2.0.79`, `2.0.80`, `2.0.81`, `2.1.0`, `2.10.0`, `2.10.1`, `2.11.0`, `2.11.1`, `2.12.0`, `2.12.1`, `2.13.0`, `2.14.0`, `2.14.1`, `2.14.2`, `2.15.0`, `2.15.1`, `2.16.0`, `2.17.0`, `2.17.1`, `2.18.0`, `2.19.0`, `2.19.1`, `2.2.0`, `2.20.0`, `2.21.0`, `2.22.0`, `2.22.1`, `2.23.0`, `2.24.0`, `2.24.1`, `2.24.2`, `2.25.0`, `2.26.0`, `2.26.1`, `2.27.0`, `2.27.1`, `2.27.2`, `2.28.0`, `2.29.0`, `2.29.1`, `2.29.2`, `2.3.0`, `2.3.1`, `2.30.0`, `2.31.0`, `2.32.0`, `2.33.0`, `2.33.1`, `2.34.0`, `2.34.1`, `2.35.0`, `2.36.0`, `2.37.0`, `2.38.0`, `2.39.0`, `2.4.0`, `2.40.0`, `2.41.0`, `2.5.0`, `2.5.1`, `2.6.0`, `2.7.0`, `2.8.0`, `2.9.0`, `2.9.1`. Changing this forces a new Resource Deployment Script to be created.
* `version` - (Required) Azure CLI module version to be used. The supported versions includes but not limited to `2.0.77`, `2.0.78`, `2.0.79`, `2.0.80`, `2.0.81`, `2.1.0`, `2.10.0`, `2.10.1`, `2.11.0`, `2.11.1`, `2.12.0`, `2.12.1`, `2.13.0`, `2.14.0`, `2.14.1`, `2.14.2`, `2.15.0`, `2.15.1`, `2.16.0`, `2.17.0`, `2.17.1`, `2.18.0`, `2.19.0`, `2.19.1`, `2.2.0`, `2.20.0`, `2.21.0`, `2.22.0`, `2.22.1`, `2.23.0`, `2.24.0`, `2.24.1`, `2.24.2`, `2.25.0`, `2.26.0`, `2.26.1`, `2.27.0`, `2.27.1`, `2.27.2`, `2.28.0`, `2.29.0`, `2.29.1`, `2.29.2`, `2.3.0`, `2.3.1`, `2.30.0`, `2.31.0`, `2.32.0`, `2.33.0`, `2.33.1`, `2.34.0`, `2.34.1`, `2.35.0`, `2.36.0`, `2.37.0`, `2.38.0`, `2.39.0`, `2.4.0`, `2.40.0`, `2.41.0`, `2.5.0`, `2.5.1`, `2.6.0`, `2.7.0`, `2.8.0`, `2.9.0`, `2.9.1`. Please refer to https://aka.ms/DeploymentScriptsTroubleshoot for more details. Changing this forces a new Resource Deployment Script to be created.

* `retention_interval` - (Required) Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. The time duration should be between `1` hour and `26` hours (inclusive) and should be specified in ISO 8601 format. Changing this forces a new Resource Deployment Script to be created.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The following arguments are supported:

* `location` - (Required) Specifies the Azure Region where the Resource Deployment Script should exist. Changing this forces a new Resource Deployment Script to be created.

* `version` - (Required) Azure PowerShell module version to be used. The supported versions are `2.7`, `2.8`, `3.0`, `3.1`, `3.2`, `3.3`, `3.4`, `3.5`, `3.6`, `3.7`, `3.8`, `4.1`, `4.2`, `4.3`, `4.4`, `4.5`, `4.6`, `4.7`, `4.8`, `5.0`, `5.1`, `5.2`, `5.3`, `5.4`, `5.5`, `5.6`, `5.7`, `5.8`, `5.9`, `6.0`, `6.1`, `6.2`, `6.3`, `6.4`, `6.5`, `6.6`, `7.0`, `7.1`, `7.2`, `7.3`, `7.4`, `7.5`, `8.0`, `8.1`, `8.2`, `8.3`, `9.0`. Changing this forces a new Resource Deployment Script to be created.
* `version` - (Required) Azure PowerShell module version to be used. The supported versions include but not limited to `2.7`, `2.8`, `3.0`, `3.1`, `3.2`, `3.3`, `3.4`, `3.5`, `3.6`, `3.7`, `3.8`, `4.1`, `4.2`, `4.3`, `4.4`, `4.5`, `4.6`, `4.7`, `4.8`, `5.0`, `5.1`, `5.2`, `5.3`, `5.4`, `5.5`, `5.6`, `5.7`, `5.8`, `5.9`, `6.0`, `6.1`, `6.2`, `6.3`, `6.4`, `6.5`, `6.6`, `7.0`, `7.1`, `7.2`, `7.3`, `7.4`, `7.5`, `8.0`, `8.1`, `8.2`, `8.3`, `9.0`. Please refer to https://aka.ms/DeploymentScriptsTroubleshoot for more details. Changing this forces a new Resource Deployment Script to be created.

* `retention_interval` - (Required) Interval for which the service retains the script resource after it reaches a terminal state. Resource will be deleted when this duration expires. The time duration should be between `1` hour and `26` hours (inclusive) and should be specified in ISO 8601 format. Changing this forces a new Resource Deployment Script to be created.

Expand Down

0 comments on commit 5926fba

Please sign in to comment.