Merge pull request #2518 from TimeIncOSS/f-aws-sg-validation

provider/aws: Add validation for aws_security_group (name+description)
This commit is contained in:
Radek Simko 2015-06-26 15:25:15 +01:00
commit ea7395ffe7
1 changed files with 16 additions and 0 deletions

View File

@ -28,6 +28,14 @@ func resourceAwsSecurityGroup() *schema.Resource {
Optional: true,
Computed: true,
ForceNew: true,
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
if len(value) > 255 {
errors = append(errors, fmt.Errorf(
"%q cannot be longer than 255 characters", k))
}
return
},
},
"description": &schema.Schema{
@ -35,6 +43,14 @@ func resourceAwsSecurityGroup() *schema.Resource {
Optional: true,
ForceNew: true,
Default: "Managed by Terraform",
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {
value := v.(string)
if len(value) > 255 {
errors = append(errors, fmt.Errorf(
"%q cannot be longer than 255 characters", k))
}
return
},
},
"vpc_id": &schema.Schema{