Search code examples
amazon-web-servicesaws-lambdaterraformcode-signingterraform-provider-aws

How to fix `error getting Lambda Function code signing config AccessDeniedException` Terraform


I defined a Lambda resource in Terraform, but I encountered error below:

error getting Lambda Function (xxxx) code signing config AccessDeniedException

After some googling, I found that I can temporary fix this by specifying AWS provider version <= 3.16.0,this fixed the error temporary but the version is too low, it doesn't support 'using ECR image for lambda', the Terraform version I'm currently using is v0.13.4.

This page claims that AWS provider version 3.18.0 works, but I still get this error is I don't specify AWS provider to 3.16.0. Can someone help with this please? Many thanks.


Solution

  • As per this issue resource/aws_lambda_function - possible regression w/3.17.0 similar error.

    You need to amend the policy like

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": "lambda:GetCodeSigningConfig",
                             
                "Resource": "*"
            }
        ]
    }
    

    Is there a specific reason you are using Terraform version 0.13.4 with that old provider?

    You can share your terraform config as well with error with the DEBUG flag on terraform apply