# Contains resources and outputs related to testing the aws_ec2_* resources. #======================================================# # EC2 Instances #======================================================# # Test fixture info: # instance | OS | has_role? | instance_type # ----------------------------------------------- # alpha | debian | N | t2.micro # beta | centos | Y | t2.small resource "aws_instance" "alpha" { ami = "${data.aws_ami.debian.id}" instance_type = "t2.micro" tags { Name = "${terraform.env}.alpha" X-Project = "inspec" } } resource "aws_instance" "beta" { ami = "${data.aws_ami.centos.id}" instance_type = "t2.small" iam_instance_profile = "${aws_iam_instance_profile.profile_for_ec2_with_role.name}" tags { Name = "${terraform.env}.beta" X-Project = "inspec" } } #----------------------- Recall -----------------------# # Using Alpha for recall output "ec2_instance_recall_hit_name" { value = "${aws_instance.alpha.tags.Name}" } output "ec2_instance_recall_hit_id" { value = "${aws_instance.alpha.id}" } output "ec2_instance_recall_miss" { value = "i-06b4bc106e0d03dfd" } #----------------- has_role property ------------------# # No role output "ec2_instance_no_role_id" { value = "${aws_instance.alpha.id}" } # Has a role resource "aws_iam_role" "role_for_ec2_with_role" { name = "${terraform.env}.role_for_ec2_with_role" assume_role_policy = <