Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
teowa committed Sep 25, 2023
1 parent 031d629 commit 3d137e5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (r ResourceDeploymentScriptAzureCliResource) IDValidationFunc() pluginsdk.S
}

func (r ResourceDeploymentScriptAzureCliResource) Arguments() map[string]*pluginsdk.Schema {
return getDeploymentScriptArguments(AzureCliKind)
return getDeploymentScriptArguments()
}

func (r ResourceDeploymentScriptAzureCliResource) Attributes() map[string]*pluginsdk.Schema {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (r ResourceDeploymentScriptAzurePowerShellResource) IDValidationFunc() plug
}

func (r ResourceDeploymentScriptAzurePowerShellResource) Arguments() map[string]*pluginsdk.Schema {
return getDeploymentScriptArguments(AzurePowerShellKind)
return getDeploymentScriptArguments()
}

func (r ResourceDeploymentScriptAzurePowerShellResource) Attributes() map[string]*pluginsdk.Schema {
Expand Down
30 changes: 8 additions & 22 deletions internal/services/resource/resource_deployment_script_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ import (

type DeploymentScriptKind string

const (
AzurePowerShellKind DeploymentScriptKind = "AzurePowerShell"
AzureCliKind DeploymentScriptKind = "AzureCli"
)

type ResourceDeploymentScriptModel struct {
Name string `tfschema:"name"`
ResourceGroupName string `tfschema:"resource_group_name"`
Expand Down Expand Up @@ -65,7 +60,7 @@ type ResourceDeploymentScriptPatchModel struct {
Tags map[string]string `tfschema:"tags"`
}

func getDeploymentScriptArguments(kind DeploymentScriptKind) map[string]*pluginsdk.Schema {
func getDeploymentScriptArguments() map[string]*pluginsdk.Schema {
result := map[string]*pluginsdk.Schema{
"name": {
Type: pluginsdk.TypeString,
Expand All @@ -88,6 +83,13 @@ func getDeploymentScriptArguments(kind DeploymentScriptKind) map[string]*plugins
ValidateFunc: validate.ISO8601DurationBetween("PT1H", "P1DT2H"),
},

"version": {
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringIsNotEmpty,
},

"command_line": {
Type: pluginsdk.TypeString,
Optional: true,
Expand Down Expand Up @@ -220,22 +222,6 @@ func getDeploymentScriptArguments(kind DeploymentScriptKind) map[string]*plugins
"tags": commonschema.Tags(),
}

if kind == AzurePowerShellKind {
result["version"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringIsNotEmpty,
}
} else {
result["version"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validation.StringIsNotEmpty,
}
}

return result
}

Expand Down

0 comments on commit 3d137e5

Please sign in to comment.