Terraform resource: aws iam instance profile

From wikieduonline
(Redirected from Aws iam instance profile)
Jump to navigation Jump to search

Official example[edit]

resource "aws_iam_instance_profile" "test_profile" {
 name = "test_profile"
 role = aws_iam_role.role.name
}

data "aws_iam_policy_document" "assume_role" {
 statement {
   effect = "Allow"

   principals {
     type        = "Service"
     identifiers = ["ec2.amazonaws.com"]
   }

   actions = ["sts:AssumeRole"]
 }
}

resource "aws_iam_role" "role" {
 name               = "test_role"
 path               = "/"
 assume_role_policy = data.aws_iam_policy_document.assume_role.json
}

Related[edit]

See also[edit]

Advertising: