1 data "aws_iam_policy_document" "instance_trust" {
16 resource "aws_iam_role" "management" {
17 name = "${var.management_service_name}-role"
18 assume_role_policy = "${data.aws_iam_policy_document.instance_trust.json}"
21 data "aws_iam_policy_document" "management" {
27 "elasticloadbalancing:*",
29 "iam:GetServerCertificate"
40 resources = [ "${aws_sqs_queue.management-events-queue.arn}" ]
47 resources = [ "${aws_sns_topic.management-events.arn}" ]
51 resource "aws_iam_policy" "management" {
52 name = "${var.management_service_name}"
53 description = "${var.management_service_name}"
55 policy = "${data.aws_iam_policy_document.management.json}"
58 resource "aws_iam_role_policy_attachment" "management" {
59 role = "${aws_iam_role.management.id}"
60 policy_arn = "${aws_iam_policy.management.arn}"
63 resource "aws_iam_instance_profile" "management" {
64 name = "${var.management_service_name}-instance-profile"
65 role = "${aws_iam_role.management.name}"