Skip to content

Commit

Permalink
resource/aws_cognito_user_pool: Fix perpetual diffs on sms_verificati…
Browse files Browse the repository at this point in the history
…on_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
```
  • Loading branch information
nywilken committed Aug 13, 2019
1 parent ef11036 commit 14c7a81
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions aws/resource_aws_cognito_user_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_cognito_user_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 14c7a81

Please sign in to comment.