Skip to content

Commit 18feafb

Browse files
committed
Add lambda role name option
1 parent d97dbac commit 18feafb

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ Available targets:
177177
| <a name="input_publish"></a> [publish](#input\_publish) | Whether to publish creation/change as new Lambda Function Version. | `bool` | `false` | no |
178178
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
179179
| <a name="input_reserved_concurrent_executions"></a> [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 |
180+
| <a name="input_role_name"></a> [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 |
180181
| <a name="input_runtime"></a> [runtime](#input\_runtime) | The runtime environment for the Lambda function you are uploading. | `string` | `null` | no |
181182
| <a name="input_s3_bucket"></a> [s3\_bucket](#input\_s3\_bucket) | The S3 bucket location containing the function's deployment package. Conflicts with filename and image\_uri.<br> This bucket must reside in the same AWS region where you are creating the Lambda function. | `string` | `null` | no |
182183
| <a name="input_s3_key"></a> [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 |

docs/terraform.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
| <a name="input_publish"></a> [publish](#input\_publish) | Whether to publish creation/change as new Lambda Function Version. | `bool` | `false` | no |
8181
| <a name="input_regex_replace_chars"></a> [regex\_replace\_chars](#input\_regex\_replace\_chars) | Terraform regular expression (regex) string.<br>Characters matching the regex will be removed from the ID elements.<br>If not set, `"/[^a-zA-Z0-9-]/"` is used to remove all characters other than hyphens, letters and digits. | `string` | `null` | no |
8282
| <a name="input_reserved_concurrent_executions"></a> [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 |
83+
| <a name="input_role_name"></a> [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 |
8384
| <a name="input_runtime"></a> [runtime](#input\_runtime) | The runtime environment for the Lambda function you are uploading. | `string` | `null` | no |
8485
| <a name="input_s3_bucket"></a> [s3\_bucket](#input\_s3\_bucket) | The S3 bucket location containing the function's deployment package. Conflicts with filename and image\_uri.<br> This bucket must reside in the same AWS region where you are creating the Lambda function. | `string` | `null` | no |
8586
| <a name="input_s3_key"></a> [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 |

iam-role.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ locals {
55
resource "aws_iam_role" "this" {
66
count = local.enabled ? 1 : 0
77

8-
name = "${var.function_name}-${local.region_name}"
8+
name = var.role_name == null ? "${var.function_name}-${local.region_name}" : var.role_name
99
assume_role_policy = join("", data.aws_iam_policy_document.assume_role_policy[*].json)
1010
permissions_boundary = var.permissions_boundary
1111

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ variable "reserved_concurrent_executions" {
141141
default = -1
142142
}
143143

144+
variable "role_name" {
145+
type = string
146+
description = "The rolename used for the Lambda Function. If not provided, a default role name will be used."
147+
default = null
148+
}
149+
144150
variable "runtime" {
145151
type = string
146152
description = "The runtime environment for the Lambda function you are uploading."

0 commit comments

Comments
 (0)