rules:
- id: lambda-redundant-field-with-image
  severity: WARNING
  languages: [hcl]
  message: 'When using the AWS Lambda "Image" package_type, `runtime` and `handler` are not necessary for Lambda to understand how to run the code. These are built into the container image. Including `runtime` or `handler` with an "Image" `package_type` will result in an error on `terraform apply`. Remove these redundant fields.'
  metadata:
    category: correctness
    references:
    - https://stackoverflow.com/questions/72771366/why-do-i-get-error-handler-and-runtime-must-be-set-when-packagetype-is-zip-whe
    technology:
    - aws
    - terraform
    - aws-lambda
  patterns:
  - pattern-inside: |
      resource "aws_lambda_function" $NAME { 
        ...
        package_type = "Image"
      }
  - pattern-either:
      - pattern: handler = ...
      - pattern: runtime = ...
    
