From 3db7c4c2afeed0d335949649e9aefad14e5ea3c7 Mon Sep 17 00:00:00 2001 From: Szilveszter Farkas Date: Wed, 31 Jan 2018 16:13:52 +0100 Subject: [PATCH] resource/aws_ses_template: Send only specified attributes for update Addresses an issue where all text-only emails suddenly turned into emails after an update. Currently the `UpdateTemplate` call will set the `HtmlPart` to an empty string if it's not specified for the resource, which results in an email with an empty body in most mail clients. --- aws/resource_aws_ses_template.go | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_ses_template.go b/aws/resource_aws_ses_template.go index e8b2ffd52f9d..8ff56d22df49 100644 --- a/aws/resource_aws_ses_template.go +++ b/aws/resource_aws_ses_template.go @@ -110,10 +110,19 @@ func resourceAwsSesTemplateUpdate(d *schema.ResourceData, meta interface{}) erro templateName := d.Id() template := ses.Template{ - HtmlPart: aws.String(d.Get("html").(string)), TemplateName: aws.String(templateName), - SubjectPart: aws.String(d.Get("subject").(string)), - TextPart: aws.String(d.Get("text").(string)), + } + + if v, ok := d.GetOk("html"); ok { + template.HtmlPart = aws.String(v.(string)) + } + + if v, ok := d.GetOk("subject"); ok { + template.SubjectPart = aws.String(v.(string)) + } + + if v, ok := d.GetOk("text"); ok { + template.TextPart = aws.String(v.(string)) } input := ses.UpdateTemplateInput{