Skip to content

Commit

Permalink
Update EMR policies to v2 and add required tags
Browse files Browse the repository at this point in the history
  • Loading branch information
abought committed Mar 13, 2024
1 parent 8eb8b1d commit d9af20c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data "aws_region" "current" {}

module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "5.0.0"
version = "5.5.3"

name = "imputation-example-vpc"
cidr = "10.120.0.0/16"
Expand Down
3 changes: 2 additions & 1 deletion modules/imputation-iam/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ resource "aws_iam_role" "emr" {

resource "aws_iam_role_policy_attachment" "emr" {
role = aws_iam_role.emr.name
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceRole"
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEMRServicePolicy_v2"
}

resource "aws_iam_role" "ec2" {
Expand All @@ -62,6 +62,7 @@ resource "aws_iam_role" "ec2" {

resource "aws_iam_role_policy_attachment" "ec2" {
role = aws_iam_role.ec2.name
# NOTE: Deprecated, but with no replacement policy; we'd need to develop our own
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonElasticMapReduceforEC2Role"
}

Expand Down
4 changes: 3 additions & 1 deletion modules/imputation-server/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ variable "ec2_iam_role_tags" {

variable "emr_cluster_tags" {
description = "Tags to be applied to the EMR cluster"
default = {}
default = {
"for-use-with-amazon-emr-managed-policies": true
}
type = map(string)
}

Expand Down

0 comments on commit d9af20c

Please sign in to comment.