Hiya,
I would like an existing instance profile (from another Terraform config) to be used in a sandbox environment I am configuring. The code for bringing the instance up looks like this:
{
resource "aws_instance" "web" {
ami = "ami-xxxxxx"
instance_type = "t2.micro"
vpc_security_group_ids = [
]
ebs_optimized = false
user_data = "${file("user_data.tmpl")}"
associate_public_ip_address = true
iam_instance_profile = "arn:aws:iam::44400000000:instance-profile/blah"
}
When I run a "terraform plan", I get:
Error applying plan:
1 error(s) occurred:
* aws_instance.web: Error launching source instance: InvalidParameterValue: Value (arn:aws:iam::44400000000:instance-profile/blah) for parameter iamInstanceProfile.name is invalid. Invalid IAM Instance Profile name
status code: 400, request id:
(Note that some of the code above has been obfuscated for obvious reasons)
I don't have the aws_iam_instance_profile resource defined in this scope to be able to reference the attribute (e.g. "${
aws_iam_instance_profile.blah.name}"), but it already exists elsewhere in my infrastructure.
Is it possible to do this in Terraform?
Thanks
Jerry