What is this terraform error trying to tell me about image configuration blocks in the AWS Lambda resource declaration using ECR images?

huangapple go评论91阅读模式
英文:

What is this terraform error trying to tell me about image configuration blocks in the AWS Lambda resource declaration using ECR images?

问题

使用terraform时,我遇到了以下错误:

错误:创建Lambda函数(1)时出错:InvalidParameterValueException:对于使用部署包创建的函数,不支持ImageConfig参数。
│ {
│ RespMetadata: {
│ StatusCode: 400,
│ RequestID: "b8cda8ac-981f-417d-8f98-b8065cd5e167"
│ },
│ Message_: "对于使用部署包创建的函数,不支持ImageConfig参数。",
│ 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" {

我不明白问题出在哪里。它似乎在说当使用ECR指定函数时,不支持图像配置块,但是在使用该方法时,这些参数似乎非常有用??

这是计划输出:

  • resource "aws_lambda_function" "service_lambda" {
    • architectures = (apply后已知)

    • arn = (apply后已知)

    • description = "oon-holiday"

    • function_name = "development-use1-inventory-oon-holiday"

    • handler = "index.main"

    • id = (apply后已知)

    • image_uri = "794528122463.dkr.ecr.us-east-1.amazonaws.com/inventory-service:latest"

    • invoke_arn = (apply后已知)

    • last_modified = (apply后已知)

    • memory_size = 1024

    • package_type = "Zip"

    • publish = false

    • qualified_arn = (apply后已知)

    • qualified_invoke_arn = (apply后已知)

    • reserved_concurrent_executions = 0

    • role = "arn:aws:iam::794528122463:role/development-use1-inventory-lambda-oon-holiday"

    • runtime = "python3.9"

    • signing_job_arn = (apply后已知)

    • signing_profile_version_arn = (apply后已知)

    • source_code_hash = (apply后已知)

    • source_code_size = (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 = (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 = (apply后已知)
        }
        }

(忽略标签,我还在处理那部分)

英文:

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)

答案1

得分: 1

当使用Docker镜像时,aws_lambda_function资源只需要一个必需的参数image_uri有值,即不需要其他通常与package_type"Zip"时相关的参数。换句话说,当package_type"Image"时,唯一的其他必需参数是image_uri

英文:

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.

huangapple
  • 本文由 发表于 2023年8月9日 03:44:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76862775.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定