From 14c7a8127f203786ae37a3aeebe064ae24402de0 Mon Sep 17 00:00:00 2001 From: nywilken Date: Fri, 2 Aug 2019 16:41:26 -0400 Subject: [PATCH] resource/aws_cognito_user_pool: Fix perpetual diffs on sms_verification_message When using `verification_message_template.sms_message` for setting the sms message verification template the resource upon subsequent applys will trigger an update because of a diff in the conflicting `sms_verification_message` argument. This changes adds the computed property onto `sms_message_verification` to ensure it get's updated with the contents being set by `verification_message_template.sms_message` Acceptance test before change ``` --- FAIL: TestAccAWSCognitoUserPool_withVerificationMessageTemplate (10.90s) [274/322] testing.go:568: Step 0 error: After applying this step, the plan was not empty: DIFF: UPDATE: aws_cognito_user_pool.pool sms_verification_message: "{####} Baz" => "" ``` Acceptance test after change ``` --- PASS: TestAccAWSCognitoUserPool_withVerificationMessageTemp ``` --- aws/resource_aws_cognito_user_pool.go | 1 + aws/resource_aws_cognito_user_pool_test.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/aws/resource_aws_cognito_user_pool.go b/aws/resource_aws_cognito_user_pool.go index 6b8dfbcd12a..b1eb81c2cd7 100644 --- a/aws/resource_aws_cognito_user_pool.go +++ b/aws/resource_aws_cognito_user_pool.go @@ -410,6 +410,7 @@ func resourceAwsCognitoUserPool() *schema.Resource { "sms_verification_message": { Type: schema.TypeString, Optional: true, + Computed: true, ValidateFunc: validateCognitoUserPoolSmsVerificationMessage, ConflictsWith: []string{"verification_message_template.0.sms_message"}, }, diff --git a/aws/resource_aws_cognito_user_pool_test.go b/aws/resource_aws_cognito_user_pool_test.go index e3861f3d621..16ca3652441 100644 --- a/aws/resource_aws_cognito_user_pool_test.go +++ b/aws/resource_aws_cognito_user_pool_test.go @@ -1200,7 +1200,6 @@ resource "aws_cognito_user_pool" "pool" { email_verification_message = "Foo {####} Bar" email_verification_subject = "FooBar {####}" - sms_verification_message = "{####} Baz" # Setting Verification template attributes like EmailMessage, EmailSubject or SmsMessage # will implicitly set EmailVerificationMessage, EmailVerificationSubject and SmsVerificationMessage @@ -1209,6 +1208,7 @@ resource "aws_cognito_user_pool" "pool" { default_email_option = "CONFIRM_WITH_LINK" email_message_by_link = "{##foobar##}" email_subject_by_link = "foobar" + sms_message = "{####} Baz" } } `, name)