-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
130 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Unit Tests | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
paths-ignore: | ||
- 'README.md' | ||
- 'LICENSE' | ||
- '.gitignore' | ||
- '**.md' | ||
pull_request: | ||
paths-ignore: | ||
- 'README.md' | ||
- 'LICENSE' | ||
- '.gitignore' | ||
- '**.md' | ||
jobs: | ||
go-tests: | ||
name: Unit Tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.14 | ||
|
||
- uses: hashicorp/setup-terraform@v1 | ||
with: | ||
terraform_version: 0.14.7 | ||
|
||
- name: Download Go Modules | ||
working-directory: tests | ||
run: go mod download | ||
|
||
- name: Set ssh keys for github remote download | ||
working-directory: tests | ||
run: | | ||
mkdir ~/.ssh | ||
echo "${{ secrets.SSH_GITHUB }}" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
- name: Run Go Tests | ||
working-directory: tests | ||
run: | | ||
go test -v | ||
env: | ||
# TF ENVIRONMENT | ||
TF_AWS_BUCKET: "${{ secrets.TF_NONPROD_AWS_BUCKET }}" | ||
TF_AWS_PROFILE: "${{ secrets.TF_AWS_PROFILE }}" | ||
TF_AWS_BUCKET_REGION: "${{ secrets.TF_AWS_BUCKET_REGION }}" | ||
# AWS CREDENTIALS | ||
AWS_ACCESS_KEY_ID: "${{ secrets.DEV_AWS_ACCESS_KEY_ID }}" | ||
AWS_SECRET_ACCESS_KEY: "${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,4 +80,4 @@ _testmain.go | |
/test/times.out | ||
|
||
# ignore test file(s) | ||
**test** | ||
test.tf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module "lambda" { | ||
source = "../../" | ||
|
||
account_id = "123456789012" | ||
role = "arn:aws:iam::123456789012:role/LambdaExecutionRole" | ||
runtime = "python3.8" | ||
handler = "lambda_function.lambda_handler" | ||
source_file = "lambda_function.py" | ||
output_file_path = "/tmp/test.zip" | ||
environment = { | ||
variables = { | ||
HELLO = "WORLD" | ||
} | ||
} | ||
# ----------------------------------------- | ||
# Do not change the teamid, prjid once set. | ||
teamid = var.teamid | ||
prjid = var.prjid | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
# Additional documentation: https://www.terraform.io/docs/configuration/variables.html | ||
variable "teamid" { | ||
description = "(Required) name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply'" | ||
} | ||
|
||
variable "prjid" { | ||
description = "(Required) name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply'" | ||
} | ||
|
||
variable "aws_region" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import json | ||
|
||
|
||
def lambda_handler(event, context): | ||
print("Received event: " + json.dumps(event, indent=2)) | ||
return "hi!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
output "lambda_arn" { | ||
description = "ARN of the Lambda function" | ||
value = module.lambda.lambda_arn | ||
} | ||
|
||
output "lambda_role" { | ||
description = "IAM role used by Lambda function" | ||
value = module.lambda.lambda_role | ||
} | ||
|
||
output "input_file_name" { | ||
description = "Source code location" | ||
value = module.lambda.input_file_name | ||
} | ||
|
||
output "output_file_path" { | ||
description = "Output filepath location" | ||
value = module.lambda.output_file_path | ||
} | ||
|
||
output "output_file_size" { | ||
description = "Output filepath size" | ||
value = module.lambda.output_file_size | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# file generated by wrapper script to configure backend | ||
# do not edit or delete! | ||
|
||
terraform { | ||
backend "s3" { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "teamid" { | ||
description = "(Required) name of the team/group e.g. devops, dataengineering. Should not be changed after running 'tf apply'" | ||
} | ||
|
||
variable "prjid" { | ||
description = "(Required) name of the project/stack e.g: mystack, nifieks, demoaci. Should not be changed after running 'tf apply'" | ||
} | ||
|
||
variable "aws_region" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters