Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Aris van Ommeren committed May 5, 2020
1 parent bd17edd commit d048804
Show file tree
Hide file tree
Showing 10 changed files with 503 additions and 346 deletions.
3 changes: 2 additions & 1 deletion azurerm/internal/services/web/data_source_function_app.go
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
webValidate "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/web/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
Expand All @@ -25,7 +26,7 @@ func dataSourceArmFunctionApp() *schema.Resource {
"name": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validateAppServiceName,
ValidateFunc: webValidate.AppServiceName,
},

"resource_group_name": azure.SchemaResourceGroupNameForDataSource(),
Expand Down
@@ -1,4 +1,4 @@
package web
package parse

import (
"fmt"
Expand All @@ -12,7 +12,7 @@ type FunctionAppSlotResourceID struct {
Name string
}

func ParseFunctionAppSlotID(input string) (*FunctionAppSlotResourceID, error) {
func FunctionAppSlotID(input string) (*FunctionAppSlotResourceID, error) {
id, err := azure.ParseAzureResourceID(input)
if err != nil {
return nil, fmt.Errorf("[ERROR] Unable to parse App Service Slot ID %q: %+v", input, err)
Expand Down
14 changes: 2 additions & 12 deletions azurerm/internal/services/web/resource_arm_app_service.go
Expand Up @@ -3,7 +3,6 @@ package web
import (
"fmt"
"log"
"regexp"
"time"

"github.com/Azure/azure-sdk-for-go/services/web/mgmt/2019-08-01/web"
Expand All @@ -14,6 +13,7 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/web/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags"
azSchema "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tf/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"
Expand Down Expand Up @@ -44,7 +44,7 @@ func resourceArmAppService() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateAppServiceName,
ValidateFunc: validate.AppServiceName,
},

"identity": azure.SchemaAppServiceIdentity(),
Expand Down Expand Up @@ -760,16 +760,6 @@ func flattenAppServiceAppSettings(input map[string]*string) map[string]string {
return output
}

func validateAppServiceName(v interface{}, k string) (warnings []string, errors []error) {
value := v.(string)

if matched := regexp.MustCompile(`^[0-9a-zA-Z-]{1,60}$`).Match([]byte(value)); !matched {
errors = append(errors, fmt.Errorf("%q may only contain alphanumeric characters and dashes and up to 60 characters in length", k))
}

return warnings, errors
}

func flattenAppServiceSiteCredential(input *web.UserProperties) []interface{} {
results := make([]interface{}, 0)
result := make(map[string]interface{})
Expand Down
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features"
webValidate "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/web/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags"
azSchema "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tf/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"
Expand Down Expand Up @@ -42,7 +43,7 @@ func resourceArmAppServiceSlot() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateAppServiceName,
ValidateFunc: webValidate.AppServiceName,
},

"resource_group_name": azure.SchemaResourceGroupName(),
Expand Down
3 changes: 2 additions & 1 deletion azurerm/internal/services/web/resource_arm_function_app.go
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/clients"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/features"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/storage"
webValidate "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/web/validate"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags"
azSchema "github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tf/schema"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/timeouts"
Expand Down Expand Up @@ -48,7 +49,7 @@ func resourceArmFunctionApp() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
ValidateFunc: validateAppServiceName,
ValidateFunc: webValidate.AppServiceName,
},

"resource_group_name": azure.SchemaResourceGroupName(),
Expand Down

0 comments on commit d048804

Please sign in to comment.