Skip to content

Commit

Permalink
Fix Terraform module, download release
Browse files Browse the repository at this point in the history
  • Loading branch information
tetsuya28 committed Dec 31, 2023
1 parent a39ec03 commit 5df04df
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions module/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,24 @@ data "github_release" "this" {

resource "null_resource" "this" {
triggers = {
build_version = var.build_version
timestamp = timestamp()
}
provisioner "local-exec" {
command = "wget -O ${local.lambda_zip_file} ${data.github_release.this.assets[2].browser_download_url}"
command = <<EOF
test -e ${local.lambda_zip_file} ||
wget -O ${local.lambda_zip_file} ${data.github_release.this.assets[2].browser_download_url}
EOF
}
}

resource "aws_lambda_function" "this" {
function_name = var.name
runtime = "go1.x"
handler = "aws-cost-report"
filename = local.lambda_zip_file
source_code_hash = fileexists(local.lambda_zip_file) ? filebase64sha256(local.lambda_zip_file) : ""
memory_size = 128
timeout = 10
role = aws_iam_role.this.arn
function_name = var.name
runtime = "go1.x"
handler = "aws-cost-report"
filename = local.lambda_zip_file
memory_size = 128
timeout = 10
role = aws_iam_role.this.arn
environment {
variables = {
"SLACK_TOKEN" = var.slack_token
Expand Down

0 comments on commit 5df04df

Please sign in to comment.