Skip to content

Commit

Permalink
fix: ajusta terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
nathansouzaa3 committed Oct 8, 2024
1 parent e6e6160 commit eb21bec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion deployment/infrastructure/terraform-lambda/iam.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
data "aws_iam_role" "existing_role" {
name = "prediction_eml_role"
}

resource "aws_iam_role" "prediction_eml_role" {
count = length(data.aws_iam_role.existing_role.*.name) == 0 ? 1 : 0
name = "prediction_eml_role"

assume_role_policy = jsonencode({
Expand All @@ -17,7 +22,8 @@ resource "aws_iam_role" "prediction_eml_role" {
}

resource "aws_iam_policy_attachment" "prediction_eml_policy_attachment" {
count = length(data.aws_iam_role.existing_role.*.name) == 0 ? 1 : 0
name = "prediction_eml_policy_attachment"
roles = [aws_iam_role.prediction_eml_role.name]
roles = [aws_iam_role.prediction_eml_role[0].name]
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
}

0 comments on commit eb21bec

Please sign in to comment.