providers/aws: security group validations

This commit is contained in:
Jack Pearkes 2014-07-15 12:40:20 -04:00
parent 278dd49a4d
commit ff0741a12e
2 changed files with 17 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import (
"log"
"github.com/hashicorp/terraform/flatmap"
"github.com/hashicorp/terraform/helper/config"
"github.com/hashicorp/terraform/helper/diff"
"github.com/hashicorp/terraform/terraform"
"github.com/mitchellh/goamz/ec2"
@ -177,3 +178,14 @@ func resource_aws_security_group_retrieve(id string, ec2conn *ec2.EC2) (*ec2.Sec
return &sg, nil
}
func resource_aws_security_group_validation() *config.Validator {
return &config.Validator{
Required: []string{
"name",
},
Optional: []string{
"description",
},
}
}

View File

@ -93,10 +93,11 @@ func init() {
},
"aws_security_group": resource.Resource{
Create: resource_aws_security_group_create,
Destroy: resource_aws_security_group_destroy,
Diff: resource_aws_security_group_diff,
Refresh: resource_aws_security_group_refresh,
ConfigValidator: resource_aws_security_group_validation(),
Create: resource_aws_security_group_create,
Destroy: resource_aws_security_group_destroy,
Diff: resource_aws_security_group_diff,
Refresh: resource_aws_security_group_refresh,
},
"aws_subnet": resource.Resource{