My requirement is I need to create 3 aws instances using terraform and run a 3 different bash scripts in it. All files are on same server.
I already have terraform code to create an infrastructure and 3 bash script ready to use.
resource "aws_instance" "master" {
instance_type = "t2.xlarge"
ami = "${data.aws_ami.ubuntu.id}"
key_name = "${aws_key_pair.auth.id}"
vpc_security_group_ids = ["${aws_security_group.public.id}"]
subnet_id = "${aws_subnet.public1.id}"
}
this is my terraform code to create an AWS instance
But i am not sure how i can integrate both.
Also can i use Aws instance ip value as a variable value in linux bash script? If yes how can i pass that ip value to one of my linux bash script variable? Thank you
countin the context of terraform resources. This will allow you to create 3 similar instances. The IP can be used by referencing the instance resource during provisioning. All of this info is detailed here terraform.io/intro/getting-started/provision.html