From 33d2afc26da82e815489c573a520ba54303f644e Mon Sep 17 00:00:00 2001 From: Simon Thulbourn Date: Mon, 7 Dec 2015 13:41:52 +0000 Subject: [PATCH] Add headers to output The original implmentation was missing headers to denote mime version & content transfer encoding, this caused issues with EC2. Signed-off-by: Simon Thulbourn --- builtin/providers/template/resource_cloudinit_config.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builtin/providers/template/resource_cloudinit_config.go b/builtin/providers/template/resource_cloudinit_config.go index 88af9bef2..86798b8c7 100644 --- a/builtin/providers/template/resource_cloudinit_config.go +++ b/builtin/providers/template/resource_cloudinit_config.go @@ -170,6 +170,7 @@ func renderPartsToWriter(parts cloudInitParts, writer io.Writer) error { } writer.Write([]byte(fmt.Sprintf("Content-Type: multipart/mixed; boundary=\"%s\"\n", mimeWriter.Boundary()))) + writer.Write([]byte("MIME-Version: 1.0\r\n")) for _, part := range parts { header := textproto.MIMEHeader{} @@ -179,6 +180,9 @@ func renderPartsToWriter(parts cloudInitParts, writer io.Writer) error { header.Set("Content-Type", part.ContentType) } + header.Set("MIME-Version", "1.0") + header.Set("Content-Transfer-Encoding", "7bit") + if part.Filename != "" { header.Set("Content-Disposition", fmt.Sprintf(`attachment; filename="%s"`, part.Filename)) }