Skip to content

Commit

Permalink
Enforce read & write permissions values
Browse files Browse the repository at this point in the history
Co-Authored-By: pdecat <[email protected]>
  • Loading branch information
tombuildsstuff and pdecat committed Dec 21, 2018
1 parent 4b1c309 commit 9e73208
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
14 changes: 0 additions & 14 deletions azurerm/helpers/validate/strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,3 @@ func NoEmptyStrings(i interface{}, k string) ([]string, []error) {

return nil, nil
}

// LowercaseString validates that the string is all lower case characters
func LowercaseString(i interface{}, k string) ([]string, []error) {
v, ok := i.(string)
if !ok {
return nil, []error{fmt.Errorf("expected type of %q to be string", k)}
}

if v != strings.ToLower(v) {
return nil, []error{fmt.Errorf("%q must not be lower case", k)}
}

return nil, nil
}
6 changes: 3 additions & 3 deletions azurerm/resource_arm_application_insights_api_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (

"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/azure"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/tf"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/helpers/validate"

"github.com/Azure/azure-sdk-for-go/services/appinsights/mgmt/2015-05-01/insights"
"github.com/hashicorp/terraform/helper/schema"
"github.com/hashicorp/terraform/helper/validation"
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils"
)

Expand Down Expand Up @@ -48,7 +48,7 @@ func resourceArmApplicationInsightsAPIKey() *schema.Resource {
Set: schema.HashString,
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validate.LowercaseString,
ValidateFunc: validation.StringInSlice([]string{"agentconfig", "aggregate", "api", "draft", "extendqueries", "search"}, false),
},
},

Expand All @@ -59,7 +59,7 @@ func resourceArmApplicationInsightsAPIKey() *schema.Resource {
Set: schema.HashString,
Elem: &schema.Schema{
Type: schema.TypeString,
ValidateFunc: validate.LowercaseString,
ValidateFunc: validation.StringInSlice([]string{"annotations"}, false),
},
},
},
Expand Down

0 comments on commit 9e73208

Please sign in to comment.