Open vars.tf, set the environment variables specified at the top of the file, and fill in any other variables that
don't have a default.
Run terraform get.
Run terraform plan.
If the plan looks good, run terraform apply.
Known issues
Due to a bug in Terraform, if you configure a Lambda function
with a security group and access to a VPC, terraform destroy will fail. The only available workaround at the moment
is to go into the AWS Console, click on "Network Interfaces", and to manually detach and delete the Network Interface
associated with the Lambda function. After that, terraform destroy will succeed.
Questions? Ask away.
We're here to talk about our services, answer any questions, give advice, or just to chat.
{"treedata":{"name":"root","toggled":true,"children":[{"name":".circleci","children":[{"name":"config.yml","path":".circleci/config.yml","sha":"30d47858d484f7822531b2539184663a5533230c"}]},{"name":".gitignore","path":".gitignore","sha":"aa837f97f0d43541ff287f4159f56665a06053a9"},{"name":".pre-commit-config.yaml","path":".pre-commit-config.yaml","sha":"8f0a49e6e74c419dd55216b6397d21c6cc2e1029"},{"name":"CODEOWNERS","path":"CODEOWNERS","sha":"555c0c6e23a7502acbef94fb0b77bfa759ba11e8"},{"name":"LICENSE.txt","path":"LICENSE.txt","sha":"f4e3d9bd4717a044ed31ad847a300eee74371a78"},{"name":"README.md","path":"README.md","sha":"07394364624f37f623214a30173ce117abb2ef40"},{"name":"examples","children":[{"name":"lambda-build","children":[{"name":"README.md","path":"examples/lambda-build/README.md","sha":"922fd81fe36879d68d3b4d850ae131100590379c"},{"name":"main.tf","path":"examples/lambda-build/main.tf","sha":"ce8c6f69630afe21d21c2de876255b2f72e8e6e4"},{"name":"outputs.tf","path":"examples/lambda-build/outputs.tf","sha":"28fc5ab8cc109b761b4697e68067f4eefc6ee0dd"},{"name":"python","children":[{"name":"Dockerfile","path":"examples/lambda-build/python/Dockerfile","sha":"733d628db3e066d8d23076d035fdd3a26ca80bf8"},{"name":"build.sh","path":"examples/lambda-build/python/build.sh","sha":"bf53f2bdde463e8bd2f1a4f93009ecb1c6c0c206"},{"name":"requirements.txt","path":"examples/lambda-build/python/requirements.txt","sha":"451185f2d13849f778627a85aab7238efdb8e228"},{"name":"src","children":[{"name":"__init.py__","path":"examples/lambda-build/python/src/__init.py__","sha":"1b58820b01935d58928ad905427bd838c5e80123"},{"name":"index.py","path":"examples/lambda-build/python/src/index.py","sha":"d0233c21dc7572caead57e7e60c8d75a13312ea0"},{"name":"test_harness.py","path":"examples/lambda-build/python/src/test_harness.py","sha":"73edf34edf789e6f57b0d8288cedb22ec9d37bc3"}]}]},{"name":"vars.tf","path":"examples/lambda-build/vars.tf","sha":"a3db97ba1c39d962d7c36064206535c618ce4083"}]},{"name":"lambda-dead-letter-queue","children":[{"name":"README.md","path":"examples/lambda-dead-letter-queue/README.md","sha":"25dfce9f066a85b998fc7a0e52aff4ab716a0ecc"},{"name":"main.tf","path":"examples/lambda-dead-letter-queue/main.tf","sha":"7644213d2b585c078940f49fca7745c265c52598"},{"name":"outputs.tf","path":"examples/lambda-dead-letter-queue/outputs.tf","sha":"c9f9f5be8eec0260e59b908a0c64d481522e7435"},{"name":"python","children":[{"name":"index.py","path":"examples/lambda-dead-letter-queue/python/index.py","sha":"fdb82c37d271ffb7c508ea1fb9a465cc6d0cc330"}]},{"name":"vars.tf","path":"examples/lambda-dead-letter-queue/vars.tf","sha":"942b373fd87b2e4f0cdae56b12ae6e678bd88133"}]},{"name":"lambda-edge","children":[{"name":"README.md","path":"examples/lambda-edge/README.md","sha":"3d5f9863348407a5a11d00240a5dc92e84a8e3df"},{"name":"main.tf","path":"examples/lambda-edge/main.tf","sha":"03f780d67600d281de42bb1caad3235e49b92a2b"},{"name":"nodejs","children":[{"name":"index.js","path":"examples/lambda-edge/nodejs/index.js","sha":"927b0d194260ca2517369f584a0b49513433f8e9"}]},{"name":"outputs.tf","path":"examples/lambda-edge/outputs.tf","sha":"f26239ec90f6ceca5165be5d5b9f9fb26635120e"},{"name":"vars.tf","path":"examples/lambda-edge/vars.tf","sha":"696c7c319ca3c2d4b6ca10e79ca6ce8efbf57b51"}]},{"name":"lambda-keep-warm","children":[{"name":"README.md","path":"examples/lambda-keep-warm/README.md","sha":"d9828b74307b72a59f9c62c5578adc9a3dd7ae59"},{"name":"main.tf","path":"examples/lambda-keep-warm/main.tf","sha":"60907fc0f18cef8457a3311cfe3b68787c91ee59"},{"name":"outputs.tf","path":"examples/lambda-keep-warm/outputs.tf","sha":"62a79ed810f3cde44b54d91505647e358752ff4a"},{"name":"src","children":[{"name":"index.js","path":"examples/lambda-keep-warm/src/index.js","sha":"a06e3ce1dddfe2692eeb5b2606873affc975bb76"}]},{"name":"vars.tf","path":"examples/lambda-keep-warm/vars.tf","sha":"1409b361ac77a8a5c64868de4dc06c716f2dcf66"}]},{"name":"lambda-s3-deployment-package","children":[{"name":"README.md","path":"examples/lambda-s3-deployment-package/README.md","sha":"a4adf84621831cdc686ad125a567957a8f8967c7"},{"name":"main.tf","path":"examples/lambda-s3-deployment-package/main.tf","sha":"9195f20daadff3743450ff6e92c53c43e6d99c36"},{"name":"outputs.tf","path":"examples/lambda-s3-deployment-package/outputs.tf","sha":"28fc5ab8cc109b761b4697e68067f4eefc6ee0dd"},{"name":"python","children":[{"name":"index.py","path":"examples/lambda-s3-deployment-package/python/index.py","sha":"eaa4418c2160ad4c4d3af22db1486792e6fee11f"},{"name":"test_harness.py","path":"examples/lambda-s3-deployment-package/python/test_harness.py","sha":"6c8f8c4c4a9ac1aedd12a5e0babae588565d22b4"}]},{"name":"vars.tf","path":"examples/lambda-s3-deployment-package/vars.tf","sha":"c21f2df459e0775158faa1dd9e86cb0666d688c4"}]},{"name":"lambda-s3","children":[{"name":"README.md","path":"examples/lambda-s3/README.md","sha":"037fbac52c44915b0fc66c47b0337441a64495ce"},{"name":"images","children":[{"name":"gruntwork-logo.png","path":"examples/lambda-s3/images/gruntwork-logo.png","sha":"a351cbef55bb12a9aa2652469416a388e9e276de"}]},{"name":"main.tf","path":"examples/lambda-s3/main.tf","sha":"bb653ce2e94148473331f915233eaff02056cc23"},{"name":"outputs.tf","path":"examples/lambda-s3/outputs.tf","sha":"729892970d1ffc9122cef114133614945b9c7853"},{"name":"python","children":[{"name":"index.py","path":"examples/lambda-s3/python/index.py","sha":"9382fa2e2c3956f1c5ae1467de0f3942cad5bf34"},{"name":"test_harness.py","path":"examples/lambda-s3/python/test_harness.py","sha":"723f97fdacc7155bac0a3d9e12715a7bd6ba6c41"}]},{"name":"vars.tf","path":"examples/lambda-s3/vars.tf","sha":"abc518949b9d570263e8614834b0005aa58b40b9"}]},{"name":"lambda-vpc","children":[{"name":"README.md","path":"examples/lambda-vpc/README.md","sha":"af08d793ac3a6c5d5251cbe88ab2358c56616a84","toggled":true},{"name":"javascript","children":[{"name":"index.js","path":"examples/lambda-vpc/javascript/index.js","sha":"1c4d37c47144c12acaa1306952c6e8512b201744"}]},{"name":"main.tf","path":"examples/lambda-vpc/main.tf","sha":"11746b938e8626569bd0c505b813804abf8ed492"},{"name":"outputs.tf","path":"examples/lambda-vpc/outputs.tf","sha":"eb9cbc764168459df0fa63742281ef87b5919f2e"},{"name":"vars.tf","path":"examples/lambda-vpc/vars.tf","sha":"a704360ae723cf0ef89bdb731cf2c44a4ad8f5ad"}],"toggled":true},{"name":"scheduled-lambda-job","children":[{"name":"README.md","path":"examples/scheduled-lambda-job/README.md","sha":"d757b26ae306a94fc854fbbaaebedc1ae26d82b6"},{"name":"javascript","children":[{"name":"index.js","path":"examples/scheduled-lambda-job/javascript/index.js","sha":"92e0906a7d45397aedbda160a61f50321f7c23e4"}]},{"name":"main.tf","path":"examples/scheduled-lambda-job/main.tf","sha":"5ffe8620a55be52f534865727fb990073d5fb4e7"},{"name":"outputs.tf","path":"examples/scheduled-lambda-job/outputs.tf","sha":"eb9cbc764168459df0fa63742281ef87b5919f2e"},{"name":"vars.tf","path":"examples/scheduled-lambda-job/vars.tf","sha":"d3a08b377cc2cb908fb23af423b1700b19e3a684"}]}],"toggled":true},{"name":"modules","children":[{"name":"keep-warm","children":[{"name":"README.md","path":"modules/keep-warm/README.md","sha":"a8a9f0ee146ec91086c0eea811c50b64cd452673"},{"name":"main.tf","path":"modules/keep-warm/main.tf","sha":"f685115855e0dfa9f9a62d6e29340dbf8da31c9a"},{"name":"outputs.tf","path":"modules/keep-warm/outputs.tf","sha":"5fc4667c38e2694986e16b9808e9957ec0ad5d5b"},{"name":"src","children":[{"name":"index.js","path":"modules/keep-warm/src/index.js","sha":"16c923525b669ef04cfb039349ad6dd906720caa"}]},{"name":"vars.tf","path":"modules/keep-warm/vars.tf","sha":"af0fe8836a6bfd5f929a9534290c6e8f5943037a"}]},{"name":"lambda-edge","children":[{"name":"README.md","path":"modules/lambda-edge/README.md","sha":"9997004b74aeac9c4e47ea4df1f268e35367d38f"},{"name":"main.tf","path":"modules/lambda-edge/main.tf","sha":"3dca2db454b3db8189fd754c7f3fe5591a6ed427"},{"name":"outputs.tf","path":"modules/lambda-edge/outputs.tf","sha":"275b9eda581185081ec7b34ba330d9204c4789dd"},{"name":"vars.tf","path":"modules/lambda-edge/vars.tf","sha":"a6c6cf9472d4ee36cc0b42158c39d1cc27f49824"}]},{"name":"lambda","children":[{"name":"README.md","path":"modules/lambda/README.md","sha":"8ea73cfb7ef91fb4ce57f2350fd0e74fd3e7cc6e"},{"name":"main.tf","path":"modules/lambda/main.tf","sha":"278807ab64e4d14158f6f6b5818db8400b3ba0d7"},{"name":"outputs.tf","path":"modules/lambda/outputs.tf","sha":"d23e274092901495abd46b2ca5502518acfa32ec"},{"name":"vars.tf","path":"modules/lambda/vars.tf","sha":"f80e3163f26343119e2919e40fe48f883005c637"}]},{"name":"scheduled-lambda-job","children":[{"name":"README.md","path":"modules/scheduled-lambda-job/README.md","sha":"ea9c111f016d8e6546d8608dd7fc25433a1fc7d0"},{"name":"main.tf","path":"modules/scheduled-lambda-job/main.tf","sha":"70ecf3633e0d4ec67588e2b149f58630f82825f8"},{"name":"outputs.tf","path":"modules/scheduled-lambda-job/outputs.tf","sha":"63274208aa97eceb03826f154973e010b1e8c539"},{"name":"vars.tf","path":"modules/scheduled-lambda-job/vars.tf","sha":"867285ceb2d1ce3c0352b7110ac7711b8fb0d7f6"}]}]},{"name":"owners.txt","path":"owners.txt","sha":"bc3c9b6136485d9fa12b39f55b2ebbdeaa03583f"},{"name":"test","children":[{"name":"README.md","path":"test/README.md","sha":"ef26d3851db2fff0b36dfa61379724c0db9ff281"},{"name":"go.mod","path":"test/go.mod","sha":"128e50c0665805f04327d33845c2c3a6895776df"},{"name":"go.sum","path":"test/go.sum","sha":"c8af21770d53f49155d0e890daa9dc840b59e936"},{"name":"gruntwork-logo.base64.txt","path":"test/gruntwork-logo.base64.txt","sha":"e94e107e3a8ea8c875a4489071137a38d279dc10"},{"name":"helpers_test.go","path":"test/helpers_test.go","sha":"702e87cff6d0017b7fa082df39ee9a355aaf8635"},{"name":"lambda_build_test.go","path":"test/lambda_build_test.go","sha":"284ed155e95097334426ba6fb4f1fc669bb775c2"},{"name":"lambda_dead_letter_queue_test.go","path":"test/lambda_dead_letter_queue_test.go","sha":"fe2d73dc899a097f965126bcb1dcc2d4b72010f4"},{"name":"lambda_edge_test.go","path":"test/lambda_edge_test.go","sha":"25b0659f4defc830cb26ea26dca2fbcb508c2399"},{"name":"lambda_keep_warm_test.go","path":"test/lambda_keep_warm_test.go","sha":"6cb968e65b7cc1171ad8f8cc76c49523d19480e5"},{"name":"lambda_s3_deployment_package_test.go","path":"test/lambda_s3_deployment_package_test.go","sha":"35e061cb25ae8745c7d4a0039dda98c6dd9bee04"},{"name":"lambda_s3_reserved_test.go","path":"test/lambda_s3_reserved_test.go","sha":"62f81d1f78b6d10eb32e5bc2c6d5fedaf1803cf2"},{"name":"lambda_s3_test.go","path":"test/lambda_s3_test.go","sha":"9d22b32b32e23f134648b6926f2e9866ae36da7a"},{"name":"lambda_vpc_test.go","path":"test/lambda_vpc_test.go","sha":"d35960594af1b4dca0963777fd7951d317a1b6e7"},{"name":"scheduled_lambda_job_test.go","path":"test/scheduled_lambda_job_test.go","sha":"7a436697712dc8222c2850be10e1fe2e2e727df9"}]}]},"detailsContent":"<h1 class=\"preview__body--title\" id=\"lambda-vpc-example\">Lambda VPC example</h1><div class=\"preview__body--border\"></div><p>This folder shows an example of how to use the <code>lambda</code> module to create a Lambda function that can access a VPC.</p>\n<h2 class=\"preview__body--subtitle\" id=\"how-do-you-deploy-this-example\">How do you deploy this example?</h2>\n<p>To apply the Terraform templates:</p>\n<ol>\n<li>Install <a href=\"https://www.terraform.io/\" class=\"preview__body--description--blue\" target=\"_blank\">Terraform</a>.</li>\n<li>Open <code>vars.tf</code>, set the environment variables specified at the top of the file, and fill in any other variables that\ndon't have a default.</li>\n<li>Run <code>terraform get</code>.</li>\n<li>Run <code>terraform plan</code>.</li>\n<li>If the plan looks good, run <code>terraform apply</code>.</li>\n</ol>\n<h2 class=\"preview__body--subtitle\" id=\"known-issues\">Known issues</h2>\n<p>Due to a <a href=\"https://github.com/hashicorp/terraform/issues/10272\" class=\"preview__body--description--blue\" target=\"_blank\">bug in Terraform</a>, if you configure a Lambda function\nwith a security group and access to a VPC, <code>terraform destroy</code> will fail. The only available workaround at the moment\nis to go into the AWS Console, click on "Network Interfaces", and to manually detach and delete the Network Interface\nassociated with the Lambda function. After that, <code>terraform destroy</code> will succeed.</p>\n","repoName":"package-lambda","repoRef":"v0.9.1","serviceDescriptor":{"serviceName":"AWS Lambda","serviceRepoName":"package-lambda","serviceRepoOrg":"gruntwork-io","cloudProviders":["aws"],"description":"Deploy Lambda functions with Terraform. Supports uploading deployment packages, configuring environment variables, and scheduled functions.","imageUrl":"lambda.png","licenseType":"subscriber","technologies":["Terraform","Bash"],"compliance":[],"tags":[""]},"serviceCategoryName":"Serverless","fileName":"README.md","filePath":"/examples/lambda-vpc","title":"Repo Browser: AWS Lambda","description":"Browse the repos in the Gruntwork Infrastructure as Code Library."}