provider/aws: Add validation for aws_security_group (name+description)

This commit is contained in:
Radek Simko 2015-06-25 11:01:36 +01:00
parent d82d803690
commit 4525119a57
1 changed files with 16 additions and 0 deletions

View File

@ -28,6 +28,14 @@ func resourceAwsSecurityGroup() *schema.Resource {
Optional: true, Optional: true,
Computed: true, Computed: true,
ForceNew: 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{ "description": &schema.Schema{
@ -35,6 +43,14 @@ func resourceAwsSecurityGroup() *schema.Resource {
Optional: true, Optional: true,
ForceNew: true, ForceNew: true,
Default: "Managed by Terraform", 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{ "vpc_id": &schema.Schema{