Skip to content

Commit

Permalink
Merge pull request #4 from infracost/fix/correct-lambda-data
Browse files Browse the repository at this point in the history
fix: fix the role with image arn
  • Loading branch information
Owen authored Jan 22, 2025
2 parents fffb67b + 0db5d43 commit 7a68c50
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
14 changes: 0 additions & 14 deletions iam.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
locals {
parsed_state_files = [
for url in var.state_files : {
bucket = regex("s3://([^/]+)/.*", url)[0]
prefix = regex("s3://[^/]+/(.*)", url)[0]
}
]

grouped_by_bucket = {
for obj in local.parsed_state_files : obj.bucket => compact([
for obj2 in local.parsed_state_files : obj2.bucket == obj.bucket ? obj2.prefix : null
])...
}

}

data "aws_iam_policy_document" "lambda_assume_role" {
statement {
Expand Down
6 changes: 2 additions & 4 deletions lambda.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
locals {
image_arn = "237144093413.dkr.ecr.us-east-2.amazonaws.com/infracost/state-parser"
}


resource "aws_lambda_function" "state_file_parser" {
function_name = "infracost-state-file-parser"
Expand All @@ -13,7 +11,7 @@ resource "aws_lambda_function" "state_file_parser" {
timeout = 60
memory_size = 128

image_uri = "${local.image_arn}:${var.parser_version}"
image_uri = "${local.image_uri}:${var.parser_version}"

environment {
variables = {
Expand Down
17 changes: 17 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
locals {
parsed_state_files = [
for url in var.state_files : {
bucket = regex("s3://([^/]+)/.*", url)[0]
prefix = regex("s3://[^/]+/(.*)", url)[0]
}
]

grouped_by_bucket = {
for obj in local.parsed_state_files : obj.bucket => compact([
for obj2 in local.parsed_state_files : obj2.bucket == obj.bucket ? obj2.prefix : null
])...
}

image_uri = "237144093413.dkr.ecr.us-east-2.amazonaws.com/infracost/state-parser"
image_arn = "arn:aws:ecr:us-east-2:237144093413:repository/infracost/cloudscraper"
}

0 comments on commit 7a68c50

Please sign in to comment.