Using terraform, I am getting the following error:
Error: error creating Lambda Function (1): InvalidParameterValueException: The
ImageConfig parameter is not supported for functions created with deployment packages.
│ {
│ RespMetadata: {
│ StatusCode: 400,
│ RequestID: "b8cda8ac-981f-417d-8f98-b8065cd5e167"
│ },
│ Message_: "The ImageConfig parameter is not supported for functions created with deployment packages.",
│ Type: "User"
│ }
│
│ with module.lambda["oon-holiday"].aws_lambda_function.service_lambda[0],
│ on ../../modules/lambda/main.tf line 115, in resource "aws_lambda_function" "service_lambda":
│ 115: resource "aws_lambda_function" "service_lambda" {
│
╵
I don't understand the problem. It seems to be saying the image configuration block isn't supported when using ECR to specify my function, but it would seem those parameters are incredibly useful when using that method???
Here is what the plan output:
+ resource "aws_lambda_function" "service_lambda" {
+ architectures = (known after apply)
+ arn = (known after apply)
+ description = "oon-holiday"
+ function_name = "development-use1-inventory-oon-holiday"
+ handler = "index.main"
+ id = (known after apply)
+ image_uri = "794528122463.dkr.ecr.us-east-1.amazonaws.com/inventory-service:latest"
+ invoke_arn = (known after apply)
+ last_modified = (known after apply)
+ memory_size = 1024
+ package_type = "Zip"
+ publish = false
+ qualified_arn = (known after apply)
+ qualified_invoke_arn = (known after apply)
+ reserved_concurrent_executions = 0
+ role = "arn:aws:iam::794528122463:role/development-use1-inventory-lambda-oon-holiday"
+ runtime = "python3.9"
+ signing_job_arn = (known after apply)
+ signing_profile_version_arn = (known after apply)
+ source_code_hash = (known after apply)
+ source_code_size = (known after apply)
+ tags = {
+ "Environment" = "development"
+ "Lifetime" = "permanent"
+ "Purpose" = "use1"
+ "Squad" = "Platform"
+ "ZipBucket" = "cp-lambda-code"
+ "ZipKey" = "default/init.zip"
}
+ tags_all = {
+ "Environment" = "development"
+ "Lifetime" = "permanent"
+ "Purpose" = "use1"
+ "Squad" = "Platform"
+ "ZipBucket" = "cp-lambda-code"
+ "ZipKey" = "default/init.zip"
+ "t_billing_center" = "Production-Technology"
+ "t_contact" = "squad-platform@"
+ "t_platform" = "classpass"
+ "t_project" = "Platform"
+ "t_purpose" = "use1"
+ "t_system_owner" = "platform"
+ "t_team" = "cp-platform"
}
+ timeout = 30
+ version = (known after apply)
+ environment {
+ variables = {
+ "terraform" = "true"
}
}
+ image_config {
+ command = [
+ "start-lambda",
+ "com.classpass.inventory.lambda.OutOfNetworkHolidayHandlerKt",
]
+ entry_point = []
}
+ vpc_config {
+ security_group_ids = [
+ "sg-cfd308b4",
]
+ subnet_ids = [
+ "subnet-0d0e756323d870e41",
+ "subnet-0fa79744",
]
+ vpc_id = (known after apply)
}
}
(ignore the tags, I'm still working on that part)
When the aws_lambda_function
resource is used with a Docker image, the only required argument that needs to have a value is image_uri
, i.e., there is no need for other arguments usually related to the case when package_type
is "Zip"
. In other words, when package_type
is "Image"
, the only other required argument is image_uri
.