Skip to content

Commit

Permalink
dev: refactor complete example
Browse files Browse the repository at this point in the history
  • Loading branch information
sgtoj committed Jul 31, 2023
1 parent ee51c8e commit 08c2d53
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 2 additions & 4 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# Terraform Module Example

## Complete Example
# Example: Complete

This is an example of using the Terraform Docker Artifact Package module to
package a TypeScript app into a Docker image, extract the compiled JavaScript
file, and use it as the source code for an AWS Lambda function.

### Prerequisites
## Prerequisites

- Terraform installed on your local machine
- Docker installed on your local machine
Expand Down
11 changes: 9 additions & 2 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
locals {
tags = { tf-module = "cruxstack/yopass/aws", tf-module-example = "complete" }
}

module "artifact_packager" {
source = "../../"

Expand All @@ -8,14 +12,15 @@ module "artifact_packager" {
}

resource "aws_lambda_function" "this" {
function_name = "tf-example-echo-app"

function_name = "tfexample-complete-echo-app"
runtime = "nodejs18.x"
handler = "index.handler"
filename = module.artifact_packager.artifact_package_path
source_code_hash = filebase64sha256(module.artifact_packager.artifact_package_path)
role = aws_iam_role.this.arn

tags = local.tags

depends_on = [
module.artifact_packager,
]
Expand All @@ -40,4 +45,6 @@ resource "aws_iam_role" "this" {
managed_policy_arns = [
"arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]

tags = local.tags
}

0 comments on commit 08c2d53

Please sign in to comment.