Quantcast
Channel: Active questions tagged amazon-ec2 - Stack Overflow
Viewing all articles
Browse latest Browse all 29417

How to execute command from local-exec provisioner with terraform plan

$
0
0

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


Viewing all articles
Browse latest Browse all 29417

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>