Skip to content

Commit ac5f5aa

Browse files
authored
feat: Add support for specifiying Lambda architectures to allow ARM based functions (#12)
1 parent f4f72b5 commit ac5f5aa

File tree

13 files changed

+86
-35
lines changed

13 files changed

+86
-35
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ Examples codified under the [`examples`](./examples) are intended to give users
129129
| <a name="input_dd_app_key"></a> [dd\_app\_key](#input\_dd\_app\_key) | The Datadog application key associated with the user account that created it, which can be found from the APIs page | `string` | `""` | no |
130130
| <a name="input_dd_site"></a> [dd\_site](#input\_dd\_site) | Define your Datadog Site to send data to. For the Datadog EU site, set to datadoghq.eu | `string` | `"datadoghq.com"` | no |
131131
| <a name="input_kms_alias"></a> [kms\_alias](#input\_kms\_alias) | Alias of KMS key used to encrypt the Datadog API keys - must start with `alias/` | `string` | n/a | yes |
132+
| <a name="input_log_forwarder_architectures"></a> [log\_forwarder\_architectures](#input\_log\_forwarder\_architectures) | Instruction set architecture for your Lambda function. Valid values are `["x86_64"]` and `["arm64"]`. Default is `["x86_64"]` | `list(string)` | <pre>[<br> "x86_64"<br>]</pre> | no |
132133
| <a name="input_log_forwarder_bucket_prefix"></a> [log\_forwarder\_bucket\_prefix](#input\_log\_forwarder\_bucket\_prefix) | S3 object key prefix to prepend to zip archive name | `string` | `""` | no |
133134
| <a name="input_log_forwarder_environment_variables"></a> [log\_forwarder\_environment\_variables](#input\_log\_forwarder\_environment\_variables) | A map of environment variables for the log forwarder lambda function | `map(string)` | `{}` | no |
134135
| <a name="input_log_forwarder_kms_key_arn"></a> [log\_forwarder\_kms\_key\_arn](#input\_log\_forwarder\_kms\_key\_arn) | KMS key that is used to encrypt environment variables. If this configuration is not provided when environment variables are in use, AWS Lambda uses a default service key | `string` | `null` | no |
@@ -148,7 +149,7 @@ Examples codified under the [`examples`](./examples) are intended to give users
148149
| <a name="input_log_forwarder_role_path"></a> [log\_forwarder\_role\_path](#input\_log\_forwarder\_role\_path) | Log forwarder role path | `string` | `null` | no |
149150
| <a name="input_log_forwarder_role_permissions_boundary"></a> [log\_forwarder\_role\_permissions\_boundary](#input\_log\_forwarder\_role\_permissions\_boundary) | The ARN of the policy that is used to set the permissions boundary for the log forwarder role | `string` | `null` | no |
150151
| <a name="input_log_forwarder_role_tags"></a> [log\_forwarder\_role\_tags](#input\_log\_forwarder\_role\_tags) | A map of tags to apply to the log forwarder role | `map(string)` | `{}` | no |
151-
| <a name="input_log_forwarder_runtime"></a> [log\_forwarder\_runtime](#input\_log\_forwarder\_runtime) | Lambda function runtime | `string` | `"python3.7"` | no |
152+
| <a name="input_log_forwarder_runtime"></a> [log\_forwarder\_runtime](#input\_log\_forwarder\_runtime) | Lambda function runtime | `string` | `"python3.9"` | no |
152153
| <a name="input_log_forwarder_s3_log_bucket_arns"></a> [log\_forwarder\_s3\_log\_bucket\_arns](#input\_log\_forwarder\_s3\_log\_bucket\_arns) | S3 log buckets for forwarder to read and forward logs to Datadog | `list(string)` | `[]` | no |
153154
| <a name="input_log_forwarder_s3_zip_kms_key_id"></a> [log\_forwarder\_s3\_zip\_kms\_key\_id](#input\_log\_forwarder\_s3\_zip\_kms\_key\_id) | The AWS KMS Key ARN to use for object encryption | `string` | `null` | no |
154155
| <a name="input_log_forwarder_s3_zip_metadata"></a> [log\_forwarder\_s3\_zip\_metadata](#input\_log\_forwarder\_s3\_zip\_metadata) | A map of keys/values to provision metadata (will be automatically prefixed by `x-amz-meta-` | `map(string)` | `{}` | no |
@@ -174,6 +175,7 @@ Examples codified under the [`examples`](./examples) are intended to give users
174175
| <a name="input_processes_vpce_security_group_ids"></a> [processes\_vpce\_security\_group\_ids](#input\_processes\_vpce\_security\_group\_ids) | IDs of security groups to attach to processes endpoint | `list(string)` | `[]` | no |
175176
| <a name="input_processes_vpce_subnet_ids"></a> [processes\_vpce\_subnet\_ids](#input\_processes\_vpce\_subnet\_ids) | IDs of subnets to associate with processes endpoint | `list(string)` | `[]` | no |
176177
| <a name="input_processes_vpce_tags"></a> [processes\_vpce\_tags](#input\_processes\_vpce\_tags) | A map of tags to apply to the processes endpoint | `map(string)` | `{}` | no |
178+
| <a name="input_rds_em_forwarder_architectures"></a> [rds\_em\_forwarder\_architectures](#input\_rds\_em\_forwarder\_architectures) | Instruction set architecture for your Lambda function. Valid values are `["x86_64"]` and `["arm64"]`. Default is `["x86_64"]` | `list(string)` | <pre>[<br> "x86_64"<br>]</pre> | no |
177179
| <a name="input_rds_em_forwarder_environment_variables"></a> [rds\_em\_forwarder\_environment\_variables](#input\_rds\_em\_forwarder\_environment\_variables) | A map of environment variables for the RDS enhanced monitoring forwarder lambda function | `map(string)` | `{}` | no |
178180
| <a name="input_rds_em_forwarder_kms_key_arn"></a> [rds\_em\_forwarder\_kms\_key\_arn](#input\_rds\_em\_forwarder\_kms\_key\_arn) | KMS key that is used to encrypt environment variables. If this configuration is not provided when environment variables are in use, AWS Lambda uses a default service key | `string` | `null` | no |
179181
| <a name="input_rds_em_forwarder_lambda_tags"></a> [rds\_em\_forwarder\_lambda\_tags](#input\_rds\_em\_forwarder\_lambda\_tags) | A map of tags to apply to the RDS enhanced monitoring forwarder lambda function | `map(string)` | `{}` | no |
@@ -192,7 +194,7 @@ Examples codified under the [`examples`](./examples) are intended to give users
192194
| <a name="input_rds_em_forwarder_role_path"></a> [rds\_em\_forwarder\_role\_path](#input\_rds\_em\_forwarder\_role\_path) | RDS enhanced monitoring forwarder role path | `string` | `null` | no |
193195
| <a name="input_rds_em_forwarder_role_permissions_boundary"></a> [rds\_em\_forwarder\_role\_permissions\_boundary](#input\_rds\_em\_forwarder\_role\_permissions\_boundary) | The ARN of the policy that is used to set the permissions boundary for the RDS enhanced monitoring forwarder role | `string` | `null` | no |
194196
| <a name="input_rds_em_forwarder_role_tags"></a> [rds\_em\_forwarder\_role\_tags](#input\_rds\_em\_forwarder\_role\_tags) | A map of tags to apply to the RDS enhanced monitoring forwarder role | `map(string)` | `{}` | no |
195-
| <a name="input_rds_em_forwarder_runtime"></a> [rds\_em\_forwarder\_runtime](#input\_rds\_em\_forwarder\_runtime) | Lambda function runtime | `string` | `"python3.7"` | no |
197+
| <a name="input_rds_em_forwarder_runtime"></a> [rds\_em\_forwarder\_runtime](#input\_rds\_em\_forwarder\_runtime) | Lambda function runtime | `string` | `"python3.9"` | no |
196198
| <a name="input_rds_em_forwarder_security_group_ids"></a> [rds\_em\_forwarder\_security\_group\_ids](#input\_rds\_em\_forwarder\_security\_group\_ids) | List of security group ids when forwarder lambda function should run in the VPC | `list(string)` | `null` | no |
197199
| <a name="input_rds_em_forwarder_subnet_ids"></a> [rds\_em\_forwarder\_subnet\_ids](#input\_rds\_em\_forwarder\_subnet\_ids) | List of subnet ids when forwarder lambda function should run in the VPC. Usually private or intra subnets | `list(string)` | `null` | no |
198200
| <a name="input_rds_em_forwarder_tags"></a> [rds\_em\_forwarder\_tags](#input\_rds\_em\_forwarder\_tags) | A map of tags to apply to the RDS enhanced monitoring forwarder resources | `map(string)` | `{}` | no |
@@ -205,6 +207,7 @@ Examples codified under the [`examples`](./examples) are intended to give users
205207
| <a name="input_traces_vpce_security_group_ids"></a> [traces\_vpce\_security\_group\_ids](#input\_traces\_vpce\_security\_group\_ids) | IDs of security groups to attach to traces endpoint | `list(string)` | `[]` | no |
206208
| <a name="input_traces_vpce_subnet_ids"></a> [traces\_vpce\_subnet\_ids](#input\_traces\_vpce\_subnet\_ids) | IDs of subnets to associate with traces endpoint | `list(string)` | `[]` | no |
207209
| <a name="input_traces_vpce_tags"></a> [traces\_vpce\_tags](#input\_traces\_vpce\_tags) | A map of tags to apply to the traces endpoint | `map(string)` | `{}` | no |
210+
| <a name="input_vpc_fl_forwarder_architectures"></a> [vpc\_fl\_forwarder\_architectures](#input\_vpc\_fl\_forwarder\_architectures) | Instruction set architecture for your Lambda function. Valid values are `["x86_64"]` and `["arm64"]`. Default is `["x86_64"]` | `list(string)` | <pre>[<br> "x86_64"<br>]</pre> | no |
208211
| <a name="input_vpc_fl_forwarder_environment_variables"></a> [vpc\_fl\_forwarder\_environment\_variables](#input\_vpc\_fl\_forwarder\_environment\_variables) | A map of environment variables for the VPC flow log forwarder lambda function | `map(string)` | `{}` | no |
209212
| <a name="input_vpc_fl_forwarder_kms_key_arn"></a> [vpc\_fl\_forwarder\_kms\_key\_arn](#input\_vpc\_fl\_forwarder\_kms\_key\_arn) | KMS key that is used to encrypt environment variables. If this configuration is not provided when environment variables are in use, AWS Lambda uses a default service key | `string` | `null` | no |
210213
| <a name="input_vpc_fl_forwarder_lambda_tags"></a> [vpc\_fl\_forwarder\_lambda\_tags](#input\_vpc\_fl\_forwarder\_lambda\_tags) | A map of tags to apply to the VPC flow log forwarder lambda function | `map(string)` | `{}` | no |
@@ -224,7 +227,7 @@ Examples codified under the [`examples`](./examples) are intended to give users
224227
| <a name="input_vpc_fl_forwarder_role_path"></a> [vpc\_fl\_forwarder\_role\_path](#input\_vpc\_fl\_forwarder\_role\_path) | VPC flow log forwarder role path | `string` | `null` | no |
225228
| <a name="input_vpc_fl_forwarder_role_permissions_boundary"></a> [vpc\_fl\_forwarder\_role\_permissions\_boundary](#input\_vpc\_fl\_forwarder\_role\_permissions\_boundary) | The ARN of the policy that is used to set the permissions boundary for the VPC flow log forwarder role | `string` | `null` | no |
226229
| <a name="input_vpc_fl_forwarder_role_tags"></a> [vpc\_fl\_forwarder\_role\_tags](#input\_vpc\_fl\_forwarder\_role\_tags) | A map of tags to apply to the VPC flow log forwarder role | `map(string)` | `{}` | no |
227-
| <a name="input_vpc_fl_forwarder_runtime"></a> [vpc\_fl\_forwarder\_runtime](#input\_vpc\_fl\_forwarder\_runtime) | Lambda function runtime | `string` | `"python3.7"` | no |
230+
| <a name="input_vpc_fl_forwarder_runtime"></a> [vpc\_fl\_forwarder\_runtime](#input\_vpc\_fl\_forwarder\_runtime) | Lambda function runtime | `string` | `"python3.9"` | no |
228231
| <a name="input_vpc_fl_forwarder_s3_log_bucket_arns"></a> [vpc\_fl\_forwarder\_s3\_log\_bucket\_arns](#input\_vpc\_fl\_forwarder\_s3\_log\_bucket\_arns) | S3 log buckets for VPC flow log forwarder to read and forward to Datadog | `list(string)` | `[]` | no |
229232
| <a name="input_vpc_fl_forwarder_security_group_ids"></a> [vpc\_fl\_forwarder\_security\_group\_ids](#input\_vpc\_fl\_forwarder\_security\_group\_ids) | List of security group ids when forwarder lambda function should run in the VPC | `list(string)` | `null` | no |
230233
| <a name="input_vpc_fl_forwarder_subnet_ids"></a> [vpc\_fl\_forwarder\_subnet\_ids](#input\_vpc\_fl\_forwarder\_subnet\_ids) | List of subnet ids when forwarder lambda function should run in the VPC. Usually private or intra subnets | `list(string)` | `null` | no |

examples/complete/main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ module "default" {
268268
log_forwarder_memory_size = 512
269269
log_forwarder_timeout = 60
270270
log_forwarder_publish = true
271+
log_forwarder_architectures = ["arm64"]
271272
log_forwarder_reserved_concurrent_executions = 10
272273
log_forwarder_kms_key_arn = aws_kms_alias.datadog.target_key_arn
273274
log_forwarder_subnet_ids = module.vpc.private_subnets
@@ -298,6 +299,7 @@ module "default" {
298299
rds_em_forwarder_memory_size = 512
299300
rds_em_forwarder_timeout = 60
300301
rds_em_forwarder_publish = true
302+
rds_em_forwarder_architectures = ["arm64"]
301303
rds_em_forwarder_reserved_concurrent_executions = 10
302304
rds_em_forwarder_kms_key_arn = aws_kms_alias.datadog.target_key_arn
303305
rds_em_forwarder_subnet_ids = module.vpc.private_subnets
@@ -317,6 +319,7 @@ module "default" {
317319
vpc_fl_forwarder_memory_size = 512
318320
vpc_fl_forwarder_timeout = 60
319321
vpc_fl_forwarder_publish = true
322+
vpc_fl_forwarder_architectures = ["arm64"]
320323
vpc_fl_forwarder_reserved_concurrent_executions = 10
321324
vpc_fl_forwarder_kms_key_arn = aws_kms_alias.datadog.target_key_arn
322325
vpc_fl_forwarder_subnet_ids = module.vpc.private_subnets

main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module "log_forwarder" {
1818
memory_size = var.log_forwarder_memory_size
1919
timeout = var.log_forwarder_timeout
2020
publish = var.log_forwarder_publish
21+
architectures = var.log_forwarder_architectures
2122
reserved_concurrent_executions = var.log_forwarder_reserved_concurrent_executions
2223
kms_key_arn = var.log_forwarder_kms_key_arn
2324
subnet_ids = var.log_forwarder_subnet_ids
@@ -76,6 +77,7 @@ module "rds_enhanced_monitoring_forwarder" {
7677
memory_size = var.rds_em_forwarder_memory_size
7778
timeout = var.rds_em_forwarder_timeout
7879
publish = var.rds_em_forwarder_publish
80+
architectures = var.rds_em_forwarder_architectures
7981
reserved_concurrent_executions = var.rds_em_forwarder_reserved_concurrent_executions
8082
kms_key_arn = var.rds_em_forwarder_kms_key_arn
8183
subnet_ids = var.rds_em_forwarder_subnet_ids
@@ -122,6 +124,7 @@ module "vpc_flow_log_forwarder" {
122124
memory_size = var.vpc_fl_forwarder_memory_size
123125
timeout = var.vpc_fl_forwarder_timeout
124126
publish = var.vpc_fl_forwarder_publish
127+
architectures = var.vpc_fl_forwarder_architectures
125128
reserved_concurrent_executions = var.vpc_fl_forwarder_reserved_concurrent_executions
126129
kms_key_arn = var.vpc_fl_forwarder_kms_key_arn
127130
subnet_ids = var.vpc_fl_forwarder_subnet_ids

modules/log_forwarder/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module "datadog_log_forwarder" {
5656

5757
| Name | Source | Version |
5858
|------|--------|---------|
59-
| <a name="module_this_s3_bucket"></a> [this\_s3\_bucket](#module\_this\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | v2.11.0 |
59+
| <a name="module_this_s3_bucket"></a> [this\_s3\_bucket](#module\_this\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | v2.14.1 |
6060

6161
## Resources
6262

@@ -79,6 +79,7 @@ module "datadog_log_forwarder" {
7979

8080
| Name | Description | Type | Default | Required |
8181
|------|-------------|------|---------|:--------:|
82+
| <a name="input_architectures"></a> [architectures](#input\_architectures) | Instruction set architecture for your Lambda function. Valid values are `["x86_64"]` and `["arm64"]`. Default is `["x86_64"]` | `list(string)` | <pre>[<br> "x86_64"<br>]</pre> | no |
8283
| <a name="input_bucket_attach_deny_insecure_transport_policy"></a> [bucket\_attach\_deny\_insecure\_transport\_policy](#input\_bucket\_attach\_deny\_insecure\_transport\_policy) | Controls if S3 bucket should have deny non-SSL transport policy attacheds | `bool` | `false` | no |
8384
| <a name="input_bucket_encryption_settings"></a> [bucket\_encryption\_settings](#input\_bucket\_encryption\_settings) | S3 bucket server side encryption settings | `map(string)` | <pre>{<br> "sse_algorithm": "AES256"<br>}</pre> | no |
8485
| <a name="input_bucket_name"></a> [bucket\_name](#input\_bucket\_name) | Forwarder S3 bucket name | `string` | `""` | no |
@@ -109,7 +110,7 @@ module "datadog_log_forwarder" {
109110
| <a name="input_role_path"></a> [role\_path](#input\_role\_path) | Forwarder role path | `string` | `null` | no |
110111
| <a name="input_role_permissions_boundary"></a> [role\_permissions\_boundary](#input\_role\_permissions\_boundary) | The ARN of the policy that is used to set the permissions boundary for the forwarder role | `string` | `null` | no |
111112
| <a name="input_role_tags"></a> [role\_tags](#input\_role\_tags) | A map of tags to apply to the forwarder role | `map(string)` | `{}` | no |
112-
| <a name="input_runtime"></a> [runtime](#input\_runtime) | Lambda function runtime | `string` | `"python3.7"` | no |
113+
| <a name="input_runtime"></a> [runtime](#input\_runtime) | Lambda function runtime | `string` | `"python3.9"` | no |
113114
| <a name="input_s3_log_bucket_arns"></a> [s3\_log\_bucket\_arns](#input\_s3\_log\_bucket\_arns) | S3 log buckets for forwarder to read and forward logs to Datadog | `list(string)` | `[]` | no |
114115
| <a name="input_s3_zip_kms_key_id"></a> [s3\_zip\_kms\_key\_id](#input\_s3\_zip\_kms\_key\_id) | The AWS KMS Key ARN to use for object encryption | `string` | `null` | no |
115116
| <a name="input_s3_zip_metadata"></a> [s3\_zip\_metadata](#input\_s3\_zip\_metadata) | A map of keys/values to provision metadata (will be automatically prefixed by `x-amz-meta-` | `map(string)` | `{}` | no |

modules/log_forwarder/main.tf

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ data "aws_region" "current" {}
2424

2525
module "this_s3_bucket" {
2626
source = "terraform-aws-modules/s3-bucket/aws"
27-
version = "v2.11.0"
27+
version = "v2.14.1"
2828

2929
create_bucket = var.create && var.create_bucket
3030
bucket = local.bucket_name
@@ -158,13 +158,14 @@ resource "aws_lambda_function" "this" {
158158
function_name = var.name
159159
handler = "lambda_function.lambda_handler"
160160

161-
role = var.create_role ? aws_iam_role.this[0].arn : var.role_arn
162-
description = local.description
163-
runtime = var.runtime
164-
layers = var.layers
165-
memory_size = var.memory_size
166-
timeout = var.timeout
167-
publish = var.publish
161+
role = var.create_role ? aws_iam_role.this[0].arn : var.role_arn
162+
description = local.description
163+
runtime = var.runtime
164+
layers = var.layers
165+
memory_size = var.memory_size
166+
timeout = var.timeout
167+
publish = var.publish
168+
architectures = var.architectures
168169

169170
reserved_concurrent_executions = var.reserved_concurrent_executions
170171
kms_key_arn = var.kms_key_arn

modules/log_forwarder/variables.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ variable "name" {
194194
variable "runtime" {
195195
description = "Lambda function runtime"
196196
type = string
197-
default = "python3.7"
197+
default = "python3.9"
198198
}
199199

200200
variable "layers" {
@@ -221,6 +221,12 @@ variable "publish" {
221221
default = false
222222
}
223223

224+
variable "architectures" {
225+
description = "Instruction set architecture for your Lambda function. Valid values are `[\"x86_64\"]` and `[\"arm64\"]`. Default is `[\"x86_64\"]`"
226+
type = list(string)
227+
default = ["x86_64"]
228+
}
229+
224230
variable "reserved_concurrent_executions" {
225231
description = "The amount of reserved concurrent executions for the forwarder lambda function"
226232
type = number

0 commit comments

Comments
 (0)