diff --git a/README.md b/README.md
index e7ed11a..3fd34a1 100644
--- a/README.md
+++ b/README.md
@@ -179,6 +179,7 @@ Available targets:
| [publish](#input\_publish) | Whether to publish creation/change as new Lambda Function Version. | `bool` | `false` | no |
| [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
| [reserved\_concurrent\_executions](#input\_reserved\_concurrent\_executions) | The amount of reserved concurrent executions for this lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations. | `number` | `-1` | no |
+| [role\_name](#input\_role\_name) | The rolename used for the Lambda Function. If not provided, a default role name will be used. | `string` | `null` | no |
| [runtime](#input\_runtime) | The runtime environment for the Lambda function you are uploading. | `string` | `null` | no |
| [s3\_bucket](#input\_s3\_bucket) | The S3 bucket location containing the function's deployment package. Conflicts with filename and image\_uri.
This bucket must reside in the same AWS region where you are creating the Lambda function. | `string` | `null` | no |
| [s3\_key](#input\_s3\_key) | The S3 key of an object containing the function's deployment package. Conflicts with filename and image\_uri. | `string` | `null` | no |
diff --git a/docs/terraform.md b/docs/terraform.md
index 8d423b4..cc02ee3 100644
--- a/docs/terraform.md
+++ b/docs/terraform.md
@@ -80,6 +80,7 @@
| [publish](#input\_publish) | Whether to publish creation/change as new Lambda Function Version. | `bool` | `false` | no |
| [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.
Characters matching the regex will be removed from the ID elements.
If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
| [reserved\_concurrent\_executions](#input\_reserved\_concurrent\_executions) | The amount of reserved concurrent executions for this lambda function. A value of 0 disables lambda from being triggered and -1 removes any concurrency limitations. | `number` | `-1` | no |
+| [role\_name](#input\_role\_name) | The rolename used for the Lambda Function. If not provided, a default role name will be used. | `string` | `null` | no |
| [runtime](#input\_runtime) | The runtime environment for the Lambda function you are uploading. | `string` | `null` | no |
| [s3\_bucket](#input\_s3\_bucket) | The S3 bucket location containing the function's deployment package. Conflicts with filename and image\_uri.
This bucket must reside in the same AWS region where you are creating the Lambda function. | `string` | `null` | no |
| [s3\_key](#input\_s3\_key) | The S3 key of an object containing the function's deployment package. Conflicts with filename and image\_uri. | `string` | `null` | no |
diff --git a/iam-role.tf b/iam-role.tf
index d851f52..32d2355 100644
--- a/iam-role.tf
+++ b/iam-role.tf
@@ -5,7 +5,7 @@ locals {
resource "aws_iam_role" "this" {
count = local.enabled ? 1 : 0
- name = "${var.function_name}-${local.region_name}"
+ name = var.role_name == null ? "${var.function_name}-${local.region_name}" : var.role_name
assume_role_policy = join("", data.aws_iam_policy_document.assume_role_policy[*].json)
permissions_boundary = var.permissions_boundary
diff --git a/variables.tf b/variables.tf
index 6051326..e178a4d 100644
--- a/variables.tf
+++ b/variables.tf
@@ -141,6 +141,12 @@ variable "reserved_concurrent_executions" {
default = -1
}
+variable "role_name" {
+ type = string
+ description = "The rolename used for the Lambda Function. If not provided, a default role name will be used."
+ default = null
+}
+
variable "runtime" {
type = string
description = "The runtime environment for the Lambda function you are uploading."