I have Terraform data block that fetches AMI details
data "aws_ami""current_ami" {owners = ["${var.aws_account_id}"]filter { name = "image-id" values = ["${data.terraform_remote_state.current_ami.outputs.ami_id}"] }}
Then I am printing the my code details Branch information of git
resource "null_resource""build_info" {triggers = { always_run = "${timestamp()}"}provisioner "local-exec" { command = "echo 'Current Build: ${data.aws_ami.current_ami.tags.Branch}'" }}
The above code runs command everytime when terraform apply is used but not with terraform plan it just prints the id of null_resource.
I want the command from local-exec provisioner to execute everytime I run terraform plan to validate the AMI is built using proper branch. Could you please help