Skip to content

Commit

Permalink
Merge pull request #113 from asfadmin/devel
Browse files Browse the repository at this point in the history
terraform fixes
  • Loading branch information
benbart authored Jan 31, 2020
2 parents 1dcafd1 + 5ea72a8 commit 4264181
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions build/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ pipeline {

// Zip up terraform
sh "echo '>> Building Terraform Zip....'"
sh "cd ${WORKSPACE}/terraform && cp ../${CODE_ARCHIVE_FILENAME} ./lambda.zip && zip ../${TF_ZIP_FILENAME} *.tf lambda.zip"

sh "cp ${WORKSPACE}/${CODE_ARCHIVE_FILENAME} ${WORKSPACE}/terraform/lambda.zip"
sh "cp ${WORKSPACE}/${DEPENDENCYLAYERFILENAME} ${WORKSPACE}/terraform/dependencylayer.zip"
sh "cd ${WORKSPACE}/terraform && zip ../${TF_ZIP_FILENAME} *.tf lambda.zip dependencylayer.zip"
}
}
// Push packages to AWS and deploy new version
Expand Down
10 changes: 8 additions & 2 deletions terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ resource "aws_s3_bucket_object" "lambda_source" {
etag = filemd5("${path.module}/lambda.zip")
}

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")
}

resource "aws_cloudformation_stack" "thin_egress_app" {
name = var.stack_name
template_url = var.template_url
Expand All @@ -41,8 +48,7 @@ resource "aws_cloudformation_stack" "thin_egress_app" {
HtmlTemplateDir = var.html_template_dir
JwtAlgo = var.jwt_algo
JwtKeySecretName = var.jwt_secret_name
LambdaCodeDependencyArchive = var.lambda_code_dependency_archive_key

LambdaCodeDependencyArchive = aws_s3_bucket_object.lambda_code_dependency_archive.key
LambdaCodeS3Bucket = aws_s3_bucket_object.lambda_source.bucket
LambdaCodeS3Key = aws_s3_bucket_object.lambda_source.key
LambdaTimeout = var.lambda_timeout
Expand Down

0 comments on commit 4264181

Please sign in to comment.