From 36fee9a2f59369ef64808048bc7542322317b7a3 Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Thu, 25 Jun 2015 11:58:40 +0100 Subject: [PATCH] provider/aws: Add validation for aws_launch_configuration --- .../providers/aws/resource_aws_launch_configuration.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/builtin/providers/aws/resource_aws_launch_configuration.go b/builtin/providers/aws/resource_aws_launch_configuration.go index 075697cf4..a5bc26702 100644 --- a/builtin/providers/aws/resource_aws_launch_configuration.go +++ b/builtin/providers/aws/resource_aws_launch_configuration.go @@ -30,6 +30,15 @@ func resourceAwsLaunchConfiguration() *schema.Resource { Optional: true, Computed: true, ForceNew: true, + ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { + // https://github.com/boto/botocore/blob/9f322b1/botocore/data/autoscaling/2011-01-01/service-2.json#L1932-L1939 + value := v.(string) + if len(value) > 255 { + errors = append(errors, fmt.Errorf( + "%q cannot be longer than 255 characters", k)) + } + return + }, }, "image_id": &schema.Schema{