Skip to content

Commit

Permalink
Merge pull request #23662 from Ido-DY/add-kafka-configuration-customdiff
Browse files Browse the repository at this point in the history
fix(kafka): add customize diff func to handle revision change
  • Loading branch information
ewbankkit authored Mar 14, 2022
2 parents d25531d + 7ff0589 commit 9301390
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/23662.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_msk_configuration: Correctly set `latest_revision` as Computed when `server_properties` changes
```
8 changes: 8 additions & 0 deletions internal/service/kafka/configuration.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package kafka

import (
"context"
"fmt"
"log"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/kafka"
"github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2/tfawserr"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
"github.com/hashicorp/terraform-provider-aws/internal/flex"
Expand All @@ -23,6 +25,12 @@ func ResourceConfiguration() *schema.Resource {
State: schema.ImportStatePassthrough,
},

CustomizeDiff: customdiff.Sequence(
customdiff.ComputedIf("latest_revision", func(_ context.Context, diff *schema.ResourceDiff, meta interface{}) bool {
return diff.HasChange("server_properties")
}),
),

Schema: map[string]*schema.Schema{
"arn": {
Type: schema.TypeString,
Expand Down

0 comments on commit 9301390

Please sign in to comment.