Skip to content

Commit 43f2c28

Browse files
Document Lack of Container Image Support (#6)
* remove image_uri variable and update documentation to reflect lack of container image support * remove image_config variables and outputs * fix container image check * update readme
1 parent 5298928 commit 43f2c28

File tree

4 files changed

+9
-54
lines changed

4 files changed

+9
-54
lines changed

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ module "example_lambda_function" {
6464

6565
### Lambda Function
6666

67-
All of the arguments available in the [aws_lambda_function](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) resource are available in this Terraform module.
67+
Arguments available in the [aws_lambda_function](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lambda_function) resource are available in this Terraform module. Lambda functions created from container images are not supported by this module.
6868

6969
Arguments defined as blocks in the `aws_lambda_function` resource are redefined as variables with their nested arguments.
7070

@@ -170,10 +170,6 @@ No modules.
170170
| <a name="input_filename"></a> [filename](#input\_filename) | Path to the function's deployment package within the local filesystem. | `string` | `null` | no |
171171
| <a name="input_function_name"></a> [function\_name](#input\_function\_name) | Unique name for your Lambda Function. | `string` | `null` | no |
172172
| <a name="input_handler"></a> [handler](#input\_handler) | Function entrypoint in your code. | `string` | `null` | no |
173-
| <a name="input_image_config_command"></a> [image\_config\_command](#input\_image\_config\_command) | Parameters that you want to pass in with entry\_point. | `list(string)` | `null` | no |
174-
| <a name="input_image_config_entry_point"></a> [image\_config\_entry\_point](#input\_image\_config\_entry\_point) | Entry point to your application, which is typically the location of the runtime executable. | `list(string)` | `null` | no |
175-
| <a name="input_image_config_working_directory"></a> [image\_config\_working\_directory](#input\_image\_config\_working\_directory) | Working directory. | `string` | `null` | no |
176-
| <a name="input_image_uri"></a> [image\_uri](#input\_image\_uri) | ECR image URI containing the function's deployment package. | `string` | `null` | no |
177173
| <a name="input_kms_key_arn"></a> [kms\_key\_arn](#input\_kms\_key\_arn) | Amazon Resource Name (ARN) of the AWS Key Management Service (KMS) key that is used to encrypt environment variables. | `string` | `null` | no |
178174
| <a name="input_layers"></a> [layers](#input\_layers) | List of Lambda Layer Version ARNs (maximum of 5) to attach to your Lambda Function. | `list(string)` | `[]` | no |
179175
| <a name="input_logging_config_application_log_level"></a> [logging\_config\_application\_log\_level](#input\_logging\_config\_application\_log\_level) | For JSON structured logs, choose the detail level of the logs your application sends to CloudWatch when using supported logging libraries. | `string` | `null` | no |
@@ -214,8 +210,6 @@ No modules.
214210
| <a name="output_filename"></a> [filename](#output\_filename) | Path to the function's deployment package within the local filesystem. |
215211
| <a name="output_function_name"></a> [function\_name](#output\_function\_name) | Unique name for your Lambda Function |
216212
| <a name="output_handler"></a> [handler](#output\_handler) | Function entrypoint in your code. |
217-
| <a name="output_image_config"></a> [image\_config](#output\_image\_config) | Container image configuration values that override the values in the container image Dockerfile. |
218-
| <a name="output_image_uri"></a> [image\_uri](#output\_image\_uri) | ECR image URI containing the function's deployment package. |
219213
| <a name="output_invoke_arn"></a> [invoke\_arn](#output\_invoke\_arn) | ARN to be used for invoking Lambda Function from API Gateway. |
220214
| <a name="output_kms_key_arn"></a> [kms\_key\_arn](#output\_kms\_key\_arn) | Amazon Resource Name (ARN) of the AWS Key Management Service (KMS) key that is used to encrypt environment variables. |
221215
| <a name="output_last_modified"></a> [last\_modified](#output\_last\_modified) | Date this resource was last modified. |

main.tf

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,14 @@ check "runtime_support" {
8787
"python3.12",
8888
],
8989
var.runtime)
90-
error_message = "${var.runtime} Lambda runtime is not supported by the Datadog Terraform module for AWS Lambda"
90+
error_message = "${var.runtime} Lambda runtime is not supported by the lambda-datadog Terraform module"
91+
}
92+
}
93+
94+
check "container_image_support" {
95+
assert {
96+
condition = var.package_type != "Image"
97+
error_message = "Container images are not supported by the lambda-datadog Terraform module"
9198
}
9299
}
93100

@@ -134,18 +141,6 @@ resource "aws_lambda_function" "this" {
134141
filename = var.filename
135142
function_name = var.function_name
136143
handler = local.handler
137-
138-
dynamic "image_config" {
139-
for_each = var.image_config_command != null || var.image_config_entry_point != null || var.image_config_working_directory != null ? [true] : []
140-
141-
content {
142-
command = var.image_config_command
143-
entry_point = var.image_config_entry_point
144-
working_directory = var.image_config_working_directory
145-
}
146-
}
147-
148-
image_uri = var.image_uri
149144
kms_key_arn = var.kms_key_arn
150145

151146
# Datadog layers are defined in single element lists

outputs.tf

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,6 @@ output "handler" {
5353
value = aws_lambda_function.this.handler
5454
}
5555

56-
output "image_config" {
57-
description = "Container image configuration values that override the values in the container image Dockerfile."
58-
value = aws_lambda_function.this.image_config
59-
}
60-
61-
output "image_uri" {
62-
description = "ECR image URI containing the function's deployment package."
63-
value = aws_lambda_function.this.image_uri
64-
}
65-
6656
output "invoke_arn" {
6757
description = "ARN to be used for invoking Lambda Function from API Gateway."
6858
value = aws_lambda_function.this.invoke_arn

variables.tf

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -91,30 +91,6 @@ variable "handler" {
9191
default = null
9292
}
9393

94-
variable "image_config_command" {
95-
description = "Parameters that you want to pass in with entry_point."
96-
type = list(string)
97-
default = null
98-
}
99-
100-
variable "image_config_entry_point" {
101-
description = "Entry point to your application, which is typically the location of the runtime executable."
102-
type = list(string)
103-
default = null
104-
}
105-
106-
variable "image_config_working_directory" {
107-
description = "Working directory."
108-
type = string
109-
default = null
110-
}
111-
112-
variable "image_uri" {
113-
description = "ECR image URI containing the function's deployment package."
114-
type = string
115-
default = null
116-
}
117-
11894
variable "kms_key_arn" {
11995
description = "Amazon Resource Name (ARN) of the AWS Key Management Service (KMS) key that is used to encrypt environment variables."
12096
type = string

0 commit comments

Comments
 (0)