providers/aws: autoscaling group config validation

This commit is contained in:
Jack Pearkes 2014-07-15 12:31:49 -04:00
parent a87f2a7987
commit 86e935bfd5
2 changed files with 24 additions and 4 deletions

View File

@ -6,6 +6,7 @@ import (
"strconv" "strconv"
"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/autoscaling" "github.com/mitchellh/goamz/autoscaling"
@ -231,3 +232,21 @@ func resource_aws_autoscaling_group_retrieve(id string, autoscalingconn *autosca
return &g, nil return &g, nil
} }
func resource_aws_autoscaling_group_validation() *config.Validator {
return &config.Validator{
Required: []string{
"name",
"max_size",
"min_size",
"availability_zones.*",
"launch_configuration",
},
Optional: []string{
"health_check_grace_period",
"health_check_type",
"desired_capicity",
"force_delete",
},
}
}

View File

@ -13,6 +13,7 @@ func init() {
resourceMap = &resource.Map{ resourceMap = &resource.Map{
Mapping: map[string]resource.Resource{ Mapping: map[string]resource.Resource{
"aws_autoscaling_group": resource.Resource{ "aws_autoscaling_group": resource.Resource{
ConfigValidator: resource_aws_autoscaling_group_validation(),
Create: resource_aws_autoscaling_group_create, Create: resource_aws_autoscaling_group_create,
Destroy: resource_aws_autoscaling_group_destroy, Destroy: resource_aws_autoscaling_group_destroy,
Diff: resource_aws_autoscaling_group_diff, Diff: resource_aws_autoscaling_group_diff,