Closed weyderfs closed 1 year ago
Don't know if you still need this - but you can do this using iam_instance_profile
So create your role, then create an aws_iam_instance_profile resource. Like so:
iam policy ect...
resource "aws_iam_role" "ec2_role" {
role = "myRole"
policy_arn = aws_iam_policy.myPolicy.arn
}
resource "aws_iam_instance_profile" "ec2_profile" {
name = "instanceProfileName"
role = aws_iam_role.ec2_role.name
}
Then in the ec2 module add the property for aws_iam_instance_profile
and set it like so:
iam_instance_profile = aws_iam_instance_profile.ec2_profile.name
See: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_instance_profile iam_instance_profile
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days
This issue was automatically closed because of stale in 10 days
I'm going to lock this issue because it has been closed for 30 days β³. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
I've read and look at code but not found a way to set the attachment of a existent
iam > role + policy
using this module. in my perception always will be create a new.Is there a way to use a existent?
If your request is for a new feature, please use the
Feature request
template.