diff --git a/examples/terraform/lambda/main.tf b/examples/terraform/lambda/main.tf index 7b5d35a..860e15f 100644 --- a/examples/terraform/lambda/main.tf +++ b/examples/terraform/lambda/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = "~> 4.8" + version = "~> 5.78.0" } } } diff --git a/examples/terraform/nodejs/.terraform.lock.hcl b/examples/terraform/nodejs/.terraform.lock.hcl index b53c0eb..fcb3056 100644 --- a/examples/terraform/nodejs/.terraform.lock.hcl +++ b/examples/terraform/nodejs/.terraform.lock.hcl @@ -2,21 +2,24 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { - version = "4.8.0" - constraints = "~> 4.8" + version = "5.78.0" + constraints = "~> 5.78.0" hashes = [ - "h1:W2cPGKmqkPbTc91lu42QeC3RFBqB5TnRnS3IxNME2FM=", - "zh:16cbdbc03ad13358d12433e645e2ab5a615e3a3662a74e3c317267c9377713d8", - "zh:1d813c5e6c21fe370652495e29f783db4e65037f913ff0d53d28515c36fbb70a", - "zh:31ad8282e31d0fac62e96fc2321a68ad4b92ab90f560be5f875d1b01a493e491", - "zh:5099a9e699784cabb5686d2cb52ca910f9c697e977c654ecedd196e838387623", - "zh:5758cbb813091db8573f27bba37c48f63ba95f2104f3bc49f13131e3c305b848", - "zh:67ea77fb00bf0a09e712f5259a7acb494ce503a34809b7919996744fd92e3312", - "zh:72c87be5d1f7917d4281c14a3335a9ec3cd57bf63d95a440faa7035248083dcd", - "zh:79005154b9f5eccc1580e0eb803f0dfee68ba856703ef6489719cb014a3c2b18", + "h1:o7jz+dFixEcwjfdubken5ldmDJm1tkvM2adPtNDei3g=", + "zh:0ae7d41b96441d0cf7ce2e1337657bdb2e1e5c9f1c2227b0642e1dcec2f9dfba", + "zh:21f8f1edf477681ea3b095c02cad6b8e85262e45015de58e84e0c7b2bfe9a1f6", + "zh:2bdc335e341bf98445255549ae93d66cfb9bca706e62b949da98fe467c182cad", + "zh:2fe4096e260367a225a9faf4a424d62b87e5498f12cb43bdb6f4e713d11b82c3", + "zh:3c63bb7a7925d65118d17461f4691a22dbb55ea39a7404e4d71f6ccca8765f8b", + "zh:6609a28a1c638a1901d8007b5386868ccfd313b4df2e98b35d9fdef436974e3b", + "zh:7ae3aef43bc4b365824cca4659cf92459d766800656e354bdbf83feabab835e8", "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:d27f9a8b5b30883a3e45f77506391524df0c66a76c3bc71f7236c3fc81d0597d", - "zh:e2985563dc652cf9b10420bc62f0a710308ef5c31e46b94c8ea10b8f27fa1ef3", - "zh:f11bb34ee0dad4bc865db51e7e299a4f030c5e9f6b6080d611797cc99deeb40a", + "zh:c314efe454adc6ca483261c6906e64315aeb9db0c0332818714e9b81e07df0f0", + "zh:cd3e30396b554bbc1d260252db8a0f344065d619038fe60ea870689cd32c6aa9", + "zh:d1ba48fd9d8a1cb1daa927fb9e8bb708b857f2792d796e110460c6fdcd896a47", + "zh:d31c8abe75cb9cdc1c59ad9d356a1c3ae1ba8cd29ac15eb7e01b6cd01221ab04", + "zh:dc27c5c2116b4d9b404753f73bccaa635bce21f3bfb4bb7bc8e63225c36c98fe", + "zh:de491f0d05408378413187475c815d8cb2ac6bfa63d0b42a30ad5ee492e51c07", + "zh:eb44b45a40f80a309dd5b0eb7d7fcb2cbfe588fe2f18b173ef5851346898a662", ] } diff --git a/examples/terraform/nodejs/lambda-policy.json b/examples/terraform/nodejs/lambda-policy.json index cbb3633..9f9320c 100644 --- a/examples/terraform/nodejs/lambda-policy.json +++ b/examples/terraform/nodejs/lambda-policy.json @@ -2,16 +2,29 @@ "Version": "2012-10-17", "Statement": [ { - "Sid": "", - "Action": "logs:*", "Effect": "Allow", + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": [ + "arn:aws:logs:us-east-1::log-group:/aws/lambda/newrelic-terraform-example-nodejs:*" + ] "Resource": "*" }, { "Sid": "", "Action": "s3:*", "Effect": "Allow", - "Resource": "*" + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": [ + "arn:aws:logs:us-east-1::log-group:/aws/lambda/newrelic-terraform-example-nodejs:*" + ] } ] -} +} \ No newline at end of file diff --git a/examples/terraform/nodejs/main.tf b/examples/terraform/nodejs/main.tf index ac103c1..fd696ff 100644 --- a/examples/terraform/nodejs/main.tf +++ b/examples/terraform/nodejs/main.tf @@ -4,8 +4,8 @@ module "nodejs_test_function" { lambda_function_handler = "app.lambdaHandler" wrapper_handler = "newrelic-lambda-wrapper.handler" lambda_function_name = "newrelic-terraform-example-nodejs" - lambda_runtime = "nodejs14.x" + lambda_runtime = "nodejs20.x" lambda_zip_filename = "function.zip" newrelic_account_id = var.newrelic_account_id - newrelic_layer = "arn:aws:lambda:${var.aws_region}:451483290750:layer:NewRelicNodeJS14X:44" -} + newrelic_layer = "arn:aws:lambda:${var.aws_region}:451483290750:layer:NewRelicNodeJS20X:44" +} \ No newline at end of file diff --git a/examples/terraform/python/.terraform.lock.hcl b/examples/terraform/python/.terraform.lock.hcl index b53c0eb..fcb3056 100644 --- a/examples/terraform/python/.terraform.lock.hcl +++ b/examples/terraform/python/.terraform.lock.hcl @@ -2,21 +2,24 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { - version = "4.8.0" - constraints = "~> 4.8" + version = "5.78.0" + constraints = "~> 5.78.0" hashes = [ - "h1:W2cPGKmqkPbTc91lu42QeC3RFBqB5TnRnS3IxNME2FM=", - "zh:16cbdbc03ad13358d12433e645e2ab5a615e3a3662a74e3c317267c9377713d8", - "zh:1d813c5e6c21fe370652495e29f783db4e65037f913ff0d53d28515c36fbb70a", - "zh:31ad8282e31d0fac62e96fc2321a68ad4b92ab90f560be5f875d1b01a493e491", - "zh:5099a9e699784cabb5686d2cb52ca910f9c697e977c654ecedd196e838387623", - "zh:5758cbb813091db8573f27bba37c48f63ba95f2104f3bc49f13131e3c305b848", - "zh:67ea77fb00bf0a09e712f5259a7acb494ce503a34809b7919996744fd92e3312", - "zh:72c87be5d1f7917d4281c14a3335a9ec3cd57bf63d95a440faa7035248083dcd", - "zh:79005154b9f5eccc1580e0eb803f0dfee68ba856703ef6489719cb014a3c2b18", + "h1:o7jz+dFixEcwjfdubken5ldmDJm1tkvM2adPtNDei3g=", + "zh:0ae7d41b96441d0cf7ce2e1337657bdb2e1e5c9f1c2227b0642e1dcec2f9dfba", + "zh:21f8f1edf477681ea3b095c02cad6b8e85262e45015de58e84e0c7b2bfe9a1f6", + "zh:2bdc335e341bf98445255549ae93d66cfb9bca706e62b949da98fe467c182cad", + "zh:2fe4096e260367a225a9faf4a424d62b87e5498f12cb43bdb6f4e713d11b82c3", + "zh:3c63bb7a7925d65118d17461f4691a22dbb55ea39a7404e4d71f6ccca8765f8b", + "zh:6609a28a1c638a1901d8007b5386868ccfd313b4df2e98b35d9fdef436974e3b", + "zh:7ae3aef43bc4b365824cca4659cf92459d766800656e354bdbf83feabab835e8", "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:d27f9a8b5b30883a3e45f77506391524df0c66a76c3bc71f7236c3fc81d0597d", - "zh:e2985563dc652cf9b10420bc62f0a710308ef5c31e46b94c8ea10b8f27fa1ef3", - "zh:f11bb34ee0dad4bc865db51e7e299a4f030c5e9f6b6080d611797cc99deeb40a", + "zh:c314efe454adc6ca483261c6906e64315aeb9db0c0332818714e9b81e07df0f0", + "zh:cd3e30396b554bbc1d260252db8a0f344065d619038fe60ea870689cd32c6aa9", + "zh:d1ba48fd9d8a1cb1daa927fb9e8bb708b857f2792d796e110460c6fdcd896a47", + "zh:d31c8abe75cb9cdc1c59ad9d356a1c3ae1ba8cd29ac15eb7e01b6cd01221ab04", + "zh:dc27c5c2116b4d9b404753f73bccaa635bce21f3bfb4bb7bc8e63225c36c98fe", + "zh:de491f0d05408378413187475c815d8cb2ac6bfa63d0b42a30ad5ee492e51c07", + "zh:eb44b45a40f80a309dd5b0eb7d7fcb2cbfe588fe2f18b173ef5851346898a662", ] } diff --git a/examples/terraform/python/lambda-policy.json b/examples/terraform/python/lambda-policy.json index cbb3633..b5f07aa 100644 --- a/examples/terraform/python/lambda-policy.json +++ b/examples/terraform/python/lambda-policy.json @@ -2,8 +2,6 @@ "Version": "2012-10-17", "Statement": [ { - "Sid": "", - "Action": "logs:*", "Effect": "Allow", "Resource": "*" }, @@ -11,7 +9,14 @@ "Sid": "", "Action": "s3:*", "Effect": "Allow", - "Resource": "*" + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": [ + "arn:aws:logs:us-east-1::log-group:/aws/lambda/newrelic-terraform-example-nodejs:*" + ] } ] -} +} \ No newline at end of file diff --git a/examples/terraform/ruby/.gitignore b/examples/terraform/ruby/.gitignore new file mode 100644 index 0000000..cd284e3 --- /dev/null +++ b/examples/terraform/ruby/.gitignore @@ -0,0 +1,250 @@ + +# Created by https://www.gitignore.io/api/osx,linux,python,windows,pycharm,visualstudiocode + +### Linux ### +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### OSX ### +*.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### PyCharm ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff: +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/dictionaries + +# Sensitive or high-churn files: +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.xml +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml + +# Gradle: +.idea/**/gradle.xml +.idea/**/libraries + +# CMake +cmake-build-debug/ + +# Mongo Explorer plugin: +.idea/**/mongoSettings.xml + +## File-based project format: +*.iws + +## Plugin-specific files: + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Ruby plugin and RubyMine +/.rakeTasks + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +### PyCharm Patch ### +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 + +# *.iml +# modules.xml +# .idea/misc.xml +# *.ipr + +# Sonarlint plugin +.idea/sonarlint + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +.pytest_cache/ +nosetests.xml +coverage.xml +*.cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule.* + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.history + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Build folder + +*/build/* + +# End of https://www.gitignore.io/api/osx,linux,python,windows,pycharm,visualstudiocode +# +# +.terraform +function.zip +terraform.tfstate +terraform.tfstate.backup \ No newline at end of file diff --git a/examples/terraform/ruby/.terraform.lock.hcl b/examples/terraform/ruby/.terraform.lock.hcl new file mode 100644 index 0000000..fcb3056 --- /dev/null +++ b/examples/terraform/ruby/.terraform.lock.hcl @@ -0,0 +1,25 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/aws" { + version = "5.78.0" + constraints = "~> 5.78.0" + hashes = [ + "h1:o7jz+dFixEcwjfdubken5ldmDJm1tkvM2adPtNDei3g=", + "zh:0ae7d41b96441d0cf7ce2e1337657bdb2e1e5c9f1c2227b0642e1dcec2f9dfba", + "zh:21f8f1edf477681ea3b095c02cad6b8e85262e45015de58e84e0c7b2bfe9a1f6", + "zh:2bdc335e341bf98445255549ae93d66cfb9bca706e62b949da98fe467c182cad", + "zh:2fe4096e260367a225a9faf4a424d62b87e5498f12cb43bdb6f4e713d11b82c3", + "zh:3c63bb7a7925d65118d17461f4691a22dbb55ea39a7404e4d71f6ccca8765f8b", + "zh:6609a28a1c638a1901d8007b5386868ccfd313b4df2e98b35d9fdef436974e3b", + "zh:7ae3aef43bc4b365824cca4659cf92459d766800656e354bdbf83feabab835e8", + "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", + "zh:c314efe454adc6ca483261c6906e64315aeb9db0c0332818714e9b81e07df0f0", + "zh:cd3e30396b554bbc1d260252db8a0f344065d619038fe60ea870689cd32c6aa9", + "zh:d1ba48fd9d8a1cb1daa927fb9e8bb708b857f2792d796e110460c6fdcd896a47", + "zh:d31c8abe75cb9cdc1c59ad9d356a1c3ae1ba8cd29ac15eb7e01b6cd01221ab04", + "zh:dc27c5c2116b4d9b404753f73bccaa635bce21f3bfb4bb7bc8e63225c36c98fe", + "zh:de491f0d05408378413187475c815d8cb2ac6bfa63d0b42a30ad5ee492e51c07", + "zh:eb44b45a40f80a309dd5b0eb7d7fcb2cbfe588fe2f18b173ef5851346898a662", + ] +} diff --git a/examples/terraform/ruby/app.rb b/examples/terraform/ruby/app.rb index c0cfffa..d8739e2 100644 --- a/examples/terraform/ruby/app.rb +++ b/examples/terraform/ruby/app.rb @@ -17,8 +17,8 @@ def self.lambda_handler(event:, context:) # As normal, anything you write to stdout ends up in CloudWatch puts 'Hello, world' puts "Event size: #{event.size}" - puts "Context size: #{context.size}" + puts "Context size: #{context.length}" - { statusCode: 200, body: JSON.generate('Hello from Ruby Lambda!') } + { statusCode: 200, body: JSON.generate('Hello from Ruby Lambda!, Here') } end end diff --git a/examples/terraform/ruby/lambda-policy.json b/examples/terraform/ruby/lambda-policy.json index cbb3633..bc6df25 100644 --- a/examples/terraform/ruby/lambda-policy.json +++ b/examples/terraform/ruby/lambda-policy.json @@ -2,16 +2,15 @@ "Version": "2012-10-17", "Statement": [ { - "Sid": "", - "Action": "logs:*", "Effect": "Allow", - "Resource": "*" - }, - { - "Sid": "", - "Action": "s3:*", - "Effect": "Allow", - "Resource": "*" + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Resource": [ + "arn:aws:logs:us-east-1::log-group:/aws/lambda/newrelic-terraform-example-nodejs:*" + ] } ] -} +} \ No newline at end of file diff --git a/examples/terraform/ruby/main.tf b/examples/terraform/ruby/main.tf index 572f9cd..f02bc8b 100644 --- a/examples/terraform/ruby/main.tf +++ b/examples/terraform/ruby/main.tf @@ -1,11 +1,11 @@ module "ruby_test_function" { source = "../lambda" aws_region = var.aws_region - lambda_function_handler = "app.lambda_handler" + lambda_function_handler = "app.App.lambda_handler" wrapper_handler = "newrelic_lambda_wrapper.handler" lambda_function_name = "newrelic-terraform-example-ruby" lambda_runtime = "ruby3.3" lambda_zip_filename = "function.zip" newrelic_account_id = var.newrelic_account_id - newrelic_layer = "arn:aws:lambda:${var.aws_region}:451483290750:layer:NewRelicRuby32:1" + newrelic_layer = "arn:aws:lambda:${var.aws_region}:451483290750:layer:NewRelicRuby33:10" }