From 139500e076931fab65b6066ee225be9d3149bed9 Mon Sep 17 00:00:00 2001 From: Chiradeep Vittal Date: Wed, 17 Jun 2015 15:41:25 -0700 Subject: [PATCH] increase allowed size of userdata for cloudstack provider --- .../cloudstack/resource_cloudstack_instance.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/builtin/providers/cloudstack/resource_cloudstack_instance.go b/builtin/providers/cloudstack/resource_cloudstack_instance.go index 732135fcb5..64384025dc 100644 --- a/builtin/providers/cloudstack/resource_cloudstack_instance.go +++ b/builtin/providers/cloudstack/resource_cloudstack_instance.go @@ -166,12 +166,14 @@ func resourceCloudStackInstanceCreate(d *schema.ResourceData, meta interface{}) // If the user data contains any info, it needs to be base64 encoded and // added to the parameter struct if userData, ok := d.GetOk("user_data"); ok { - ud := base64.StdEncoding.EncodeToString([]byte(userData.(string))) - if len(ud) > 2048 { + //deployVirtualMachine uses POST, so max userdata is 32K + //https://github.com/xanzy/go-cloudstack/commit/c767de689df1faedfec69233763a7c5334bee1f6 + if len(ud) > 32768 { return fmt.Errorf( - "The supplied user_data contains %d bytes after encoding, "+ - "this exeeds the limit of 2048 bytes", len(ud)) + "The supplied user_data contains %d bytes before encoding, "+ + "this exeeds the limit of 32768 bytes", len(ud)) } + ud := base64.StdEncoding.EncodeToString([]byte(userData.(string))) p.SetUserdata(ud) }