Skip to content

Commit c7c4423

Browse files
committed
r/aws_msk_serverless_cluster: Ignore 'ForbiddenException' from 'findBootstrapBrokersByARN'.
1 parent 84f5eb6 commit c7c4423

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

internal/service/kafka/serverless_cluster.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1616
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
1717
"github.com/hashicorp/terraform-provider-aws/internal/conns"
18+
"github.com/hashicorp/terraform-provider-aws/internal/errs"
1819
"github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag"
1920
"github.com/hashicorp/terraform-provider-aws/internal/flex"
2021
tftags "github.com/hashicorp/terraform-provider-aws/internal/tags"
@@ -189,10 +190,15 @@ func resourceServerlessClusterRead(ctx context.Context, d *schema.ResourceData,
189190
}
190191

191192
output, err := findBootstrapBrokersByARN(ctx, conn, d.Id())
192-
if err != nil {
193+
194+
switch {
195+
case errs.IsA[*types.ForbiddenException](err):
196+
d.Set("bootstrap_brokers_sasl_iam", nil)
197+
case err != nil:
193198
return sdkdiag.AppendErrorf(diags, "reading MSK Cluster (%s) bootstrap brokers: %s", clusterARN, err)
199+
default:
200+
d.Set("bootstrap_brokers_sasl_iam", sortEndpointsString(aws.ToString(output.BootstrapBrokerStringSaslIam)))
194201
}
195-
d.Set("bootstrap_brokers_sasl_iam", sortEndpointsString(aws.ToString(output.BootstrapBrokerStringSaslIam)))
196202

197203
setTagsOut(ctx, cluster.Tags)
198204

0 commit comments

Comments
 (0)