File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11resource "aws_lambda_function" "this" {
2+ region = var. region
3+
24 function_name = var. function_name
35 description = var. description
46
@@ -80,6 +82,8 @@ resource "aws_iam_role_policy" "cloudwatch-log-group" {
8082}
8183
8284resource "aws_cloudwatch_log_group" "this" {
85+ region = var. region
86+
8387 name = " /aws/lambda/${ var . function_name } "
8488
8589 retention_in_days = var. cloudwatch_log_group_retention_in_days
@@ -110,6 +114,8 @@ locals {
110114resource "aws_security_group" "this" {
111115 for_each = local. vpc_configs
112116
117+ region = var. region
118+
113119 name = " lambda-${ var . function_name } "
114120 description = " Lambda: ${ var . function_name } "
115121 vpc_id = each. value . vpc . id
@@ -126,6 +132,8 @@ resource "aws_security_group" "this" {
126132resource "aws_security_group_rule" "egress" {
127133 for_each = aws_security_group. this
128134
135+ region = var. region
136+
129137 security_group_id = each. value . id
130138
131139 type = " egress"
@@ -192,6 +200,8 @@ data "aws_partition" "current" {
192200
193201data "aws_region" "current" {
194202 for_each = local. vpc_configs
203+
204+ region = var. region
195205}
196206
197207data "aws_caller_identity" "current" {
Original file line number Diff line number Diff line change @@ -183,3 +183,9 @@ VPC configuration of the Lambda function:
183183If `vpc_config` is `null` the Lambda function will not be placed into a VPC.
184184EOS
185185}
186+
187+ variable "region" {
188+ description = " Region where the resource(s) will be managed. Defaults to the region set in the provider configuration"
189+ type = string
190+ default = null
191+ }
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ terraform {
88 }
99 aws = {
1010 source = " hashicorp/aws"
11- version = " >= 3 "
11+ version = " >= 6.0 "
1212 }
1313 }
1414}
You can’t perform that action at this time.
0 commit comments