In terraform plan output json the action always coming as create

Hi I have terraform plan where I am creating loadbalancers in aws, in this job I am running terraform plan then outputting the plan in json using terraform show -json terraform.plan. As per Internals: JSON Output Format | Terraform by HashiCorp the output result should contain before = tgs in previous state and after = tgs in new state. When I am adding a new TG ideally it should be a update action but its always coming as create action.
Here’s sample code that we have:

# variable.tf
variable "target_groups" {
  type = "list"
  default = ["lb1", "lb2", "lb3"]
}
--------
#main.tf
data "aws_lb_target_group" "target_groups" {
  for_each = var.target_groups
  name = "${each.value}"
}
.
.
.
resource "null_resource" "do_something"{
 ............
}

Just mentioning about a null resource that we are using to check if its because of this?
Current Output

"output_changes": {
        "msvcs-alb-target-groups": {
            "actions": [
                "create"
            ],
            "before": null,
            "after": ["lb1", "lb2", "lb3"],
            "after_unknown": false
        }
    }

Expected Output when I rerun the same plan

"output_changes": {
        "msvcs-alb-target-groups": {
            "actions": [
                "no-op"
            ],
            "before": ["lb1", "lb2", "lb3"],
            "after": ["lb1", "lb2", "lb3"],
            "after_unknown": false
        }
    }

Expected Output when I add a new lb and run plan:

"output_changes": {
        "msvcs-alb-target-groups": {
            "actions": [
                "update"
            ],
            "before": ["lb1", "lb2", "lb3"],
            "after": ["lb1", "lb2", "lb3", "lb4"],
            "after_unknown": false
        }
    }

Hi @mudits1990,

Terraform Core does not currently track output value changes at the same level of detail as resource instance changes, since there are fewer externally-visible side-effects with updating an output value and so Terraform Core reuses a lot of the same code at all phases of an output value’s lifecycle. Unfortunately that does mean that sometimes the actions can be a little inaccurate today.

I would suggest opening a bug report about this in the main Terraform GitHub repository, and then the Terraform Core team can investigate further and try to understand what exactly causes the action to be inaccurate in this case, and consider ways to improve it.

Thanks!