Resource not executed in module

I have a module for finding the correct AMI to use and it functions like this:
resource “null_resource” “gitbranch” {
provisioner “local-exec” {
command = “git branch --show-current >> gitbranch.txt”
}
}

resource "null_resource" "wait_10_seconds" {
  provisioner "local-exec" {
    command = "Start-Sleep 10"
    interpreter = ["PowerShell", "-Command"]
  }
  depends_on = [null_resource.gitbranch]
}

data "local_file" "gitbranch-file" {
  filename  = "gitbranch.txt"
  depends_on  = [null_resource.wait_10_seconds]
}

# aws ec2 describe-images --owners 1234567890--filters "Name=platform,Values=windows"  | grep Windows_Server-2016-English-Full-Base | grep Name
data "aws_ami" "win_2016_ami" {
  provider    = aws.ami_fetch
  owners      = [1234567890]
  most_recent = true
  name_regex  = "^Windows_Server-2016-English-Full-Base"
  tags = {
    GitBranch  = "Stable"
    GitBranch = data.local_file.gitbranch-file.content
  }
}

This module is referenced when creating ec2 instances, but does not execute the resource section that calls to git to find the branch and then allows it to be read. This results in a file not found.

If I run terraform apply directly on this module however it is created and returns the results I expect.