Skip to content

Commit

Permalink
r/aws_networkfirewall_rule_group: Correct NotFoundError.
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Jun 21, 2024
1 parent 4053ac7 commit e4cb764
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/service/networkfirewall/rule_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,10 @@ func resourceRuleGroupRead(ctx context.Context, d *schema.ResourceData, meta int

output, err := findRuleGroupByARN(ctx, conn, d.Id())

if err == nil && output.RuleGroup == nil {
err = tfresource.NewEmptyResultError(d.Id())
}

if !d.IsNewResource() && tfresource.NotFound(err) {
log.Printf("[WARN] NetworkFirewall Rule Group (%s) not found, removing from state", d.Id())
d.SetId("")
Expand Down Expand Up @@ -633,7 +637,7 @@ func findRuleGroupByARN(ctx context.Context, conn *networkfirewall.Client, arn s
return nil, err
}

if output == nil || output.RuleGroup == nil || output.RuleGroupResponse == nil {
if output == nil || output.RuleGroupResponse == nil {
return nil, tfresource.NewEmptyResultError(input)
}

Expand Down

0 comments on commit e4cb764

Please sign in to comment.