Skip to content

Commit

Permalink
Merge pull request #118 from asfadmin/devel
Browse files Browse the repository at this point in the history
HotFix Terraform zip-file name uniqueness.
  • Loading branch information
eigenbeam authored Feb 6, 2020
2 parents 4264181 + 167e8d1 commit fc70a59
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
locals {
vpc_security_group_ids_set = length(var.vpc_security_group_ids) > 0
lambda_source_filename = "${path.module}/lambda.zip"
dependency_layer_filename ="${path.module}/dependencylayer.zip"
}

resource "aws_security_group" "egress_lambda" {
Expand All @@ -18,19 +20,23 @@ resource "aws_s3_bucket" "lambda_source" {

resource "aws_s3_bucket_object" "lambda_source" {
bucket = aws_s3_bucket.lambda_source.bucket
key = "lambda.zip"
source = "${path.module}/lambda.zip"
etag = filemd5("${path.module}/lambda.zip")
key = "${filemd5(local.lambda_source_filename)}.zip"
source = local.lambda_source_filename
etag = filemd5(local.lambda_source_filename)
}

resource "aws_s3_bucket_object" "lambda_code_dependency_archive" {
bucket = aws_s3_bucket.lambda_source.bucket
key = "dependencylayer.zip"
source = "${path.module}/dependencylayer.zip"
etag = filemd5("${path.module}/dependencylayer.zip")
key = "${filemd5(local.dependency_layer_filename)}.zip"
source = local.dependency_layer_filename
etag = filemd5(local.dependency_layer_filename)
}

resource "aws_cloudformation_stack" "thin_egress_app" {
depends_on = [
aws_s3_bucket_object.lambda_source,
aws_s3_bucket_object.lambda_code_dependency_archive
]
name = var.stack_name
template_url = var.template_url
capabilities = ["CAPABILITY_NAMED_IAM"]
Expand Down

0 comments on commit fc70a59

Please sign in to comment.