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"
"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/autoscaling"
@ -231,3 +232,21 @@ func resource_aws_autoscaling_group_retrieve(id string, autoscalingconn *autosca
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,10 +13,11 @@ func init() {
resourceMap = &resource.Map{
Mapping: map[string]resource.Resource{
"aws_autoscaling_group": resource.Resource{
Create: resource_aws_autoscaling_group_create,
Destroy: resource_aws_autoscaling_group_destroy,
Diff: resource_aws_autoscaling_group_diff,
Refresh: resource_aws_autoscaling_group_refresh,
ConfigValidator: resource_aws_autoscaling_group_validation(),
Create: resource_aws_autoscaling_group_create,
Destroy: resource_aws_autoscaling_group_destroy,
Diff: resource_aws_autoscaling_group_diff,
Refresh: resource_aws_autoscaling_group_refresh,
},
"aws_elb": resource.Resource{