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" "log"
"github.com/hashicorp/terraform/flatmap" "github.com/hashicorp/terraform/flatmap"
"github.com/hashicorp/terraform/helper/config"
"github.com/hashicorp/terraform/helper/diff" "github.com/hashicorp/terraform/helper/diff"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
"github.com/mitchellh/goamz/ec2" "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 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{ "aws_security_group": resource.Resource{
Create: resource_aws_security_group_create, ConfigValidator: resource_aws_security_group_validation(),
Destroy: resource_aws_security_group_destroy, Create: resource_aws_security_group_create,
Diff: resource_aws_security_group_diff, Destroy: resource_aws_security_group_destroy,
Refresh: resource_aws_security_group_refresh, Diff: resource_aws_security_group_diff,
Refresh: resource_aws_security_group_refresh,
}, },
"aws_subnet": resource.Resource{ "aws_subnet": resource.Resource{