From c32797d6b02cc8bfb23f5e67dbe4491944dc9c50 Mon Sep 17 00:00:00 2001 From: Kirill Shirinkin Date: Wed, 25 Jun 2025 18:20:54 +0200 Subject: [PATCH] Support AWS Provider v6 --- main.tf | 10 ++++++++++ variables.tf | 6 ++++++ versions.tf | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index c30fb7f..3db7c62 100644 --- a/main.tf +++ b/main.tf @@ -1,4 +1,6 @@ resource "aws_lambda_function" "this" { + region = var.region + function_name = var.function_name description = var.description @@ -80,6 +82,8 @@ resource "aws_iam_role_policy" "cloudwatch-log-group" { } resource "aws_cloudwatch_log_group" "this" { + region = var.region + name = "/aws/lambda/${var.function_name}" retention_in_days = var.cloudwatch_log_group_retention_in_days @@ -110,6 +114,8 @@ locals { resource "aws_security_group" "this" { for_each = local.vpc_configs + region = var.region + name = "lambda-${var.function_name}" description = "Lambda: ${var.function_name}" vpc_id = each.value.vpc.id @@ -126,6 +132,8 @@ resource "aws_security_group" "this" { resource "aws_security_group_rule" "egress" { for_each = aws_security_group.this + region = var.region + security_group_id = each.value.id type = "egress" @@ -192,6 +200,8 @@ data "aws_partition" "current" { data "aws_region" "current" { for_each = local.vpc_configs + + region = var.region } data "aws_caller_identity" "current" { diff --git a/variables.tf b/variables.tf index 2846bb6..c5a5c52 100644 --- a/variables.tf +++ b/variables.tf @@ -183,3 +183,9 @@ VPC configuration of the Lambda function: If `vpc_config` is `null` the Lambda function will not be placed into a VPC. EOS } + +variable "region" { + description = "Region where the resource(s) will be managed. Defaults to the region set in the provider configuration" + type = string + default = null +} diff --git a/versions.tf b/versions.tf index 962f8da..84e94a9 100644 --- a/versions.tf +++ b/versions.tf @@ -8,7 +8,7 @@ terraform { } aws = { source = "hashicorp/aws" - version = ">= 3" + version = ">= 6.0" } } }