Skip to content

Instantly share code, notes, and snippets.

@artburkart
Last active March 12, 2017 22:44
Show Gist options
  • Save artburkart/16f88b5856861d164dae4b1aeefc0724 to your computer and use it in GitHub Desktop.
Save artburkart/16f88b5856861d164dae4b1aeefc0724 to your computer and use it in GitHub Desktop.
Test case for aws_instances data source
provider "aws" {
region = "us-east-1"
}
data "aws_instances" "boxes" {
instance_ids = ["i-########", "i-########"]
}
data "template_file" "boxes" {
template = "$${instance_subnet}"
vars {
instance_subnet = "${data.aws_instances.boxes.instances.0.subnet_id}"
}
}
resource "null_resource" "boxes" {
triggers {
template = "${data.template_file.boxes.rendered}"
}
provisioner "local-exec" {
command = "echo \"${data.template_file.boxes.rendered}\" > instances.txt"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment