diff --git a/masters.tf b/masters.tf index a6fc97e..04ee813 100644 --- a/masters.tf +++ b/masters.tf @@ -24,31 +24,40 @@ resource "aws_iam_instance_profile" "master" { path = var.iam_path } +data "aws_iam_policy_document" "master" { + statement { + actions = [ + "ec2:*" + ] + resources = ["*"] + } + + statement { + actions = [ + "elasticloadbalancing:DescribeLoadBalancers" + ] + resources = ["*"] + } + + # https://github.com/kubernetes/kops/blob/master/pkg/model/iam/tests/iam_builder_master_strict.json#L158 + statement { + actions = [ + "kms:CreateGrant", + "kms:Decrypt", + "kms:DescribeKey", + "kms:Encrypt", + "kms:GenerateDataKey*", + "kms:ReEncrypt*" + ] + resources = var.master_kms_ebs_key_arns + } +} + resource "aws_iam_role_policy" "master" { name = "${local.iam_prefix}${var.cluster_name}-master" role = aws_iam_role.master.id - policy = <