Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: AccessDeniedException for lambda/GetFunctionCodeSigningConfig in eu-central-2 #27986

Closed
pochopien opened this issue Nov 23, 2022 · 4 comments · Fixed by #28008
Closed
Labels
bug Addresses a defect in current functionality. service/iam Issues and PRs that pertain to the iam service. service/lambda Issues and PRs that pertain to the lambda service.
Milestone

Comments

@pochopien
Copy link

pochopien commented Nov 23, 2022

Terraform Core Version

1.3.5

AWS Provider Version

4.40.0

Affected Resource(s)

aws_lambda

Expected Behavior

It should be created and terraform should return success

Actual Behavior

Lambda is being created and error is being returned. It's not possible to apply changes or destroy the lambda

Relevant Error/Panic Output Snippet

[DEBUG] [aws-sdk-go] DEBUG: Response lambda/GetFunctionCodeSigningConfig Details:
---[ RESPONSE ]--------------------------------------
HTTP/2.0 403 Forbidden
X-Amzn-Errortype: AccessDeniedException
[DEBUG] [aws-sdk-go] DEBUG: Validate Response lambda/GetFunctionCodeSigningConfig failed, attempt 0/25, error AccessDeniedException:
status code: 403, request id: xxxx
[DEBUG] Unlocking "aws_lambda_function"
[DEBUG] Unlocked "aws_lambda_function"

Response contains error diagnostic: diagnostic_detail= tf_proto_version=5.3 diagnostic_summary="error getting Lambda Function (test_lambda) code signing config AccessDeniedException:
    status code: 403, request id: xxx" tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=9c3edc87-a488-26bc-cee0-f8b0289a6c22 tf_resource_type=aws_lambda_function @caller=github.com/hashicorp/terraform-plugin-go@v0.14.1/tfprotov5/internal/diag/diagnostics.go:55 @module=sdk.proto diagnostic_severity=ERROR tf_rpc=ApplyResourceChange timestamp=2022-11-23T18:23:31.673+0100
2022-11-23T18:23:31.682+0100 [ERROR] vertex "aws_lambda_function.hello_world" error: error getting Lambda Function (test_lambda) code signing config AccessDeniedException:
    status code: 403, request id: xxx

Terraform Configuration Files

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "4.40.0"
    }
  }
}

provider "aws" {
  region = "eu-central-2"
}

provider "archive" {}
data "archive_file" "lambda_zip" {
  type        = "zip"
  source_dir  = "./lambdas/test_lambda/"
  output_path = "lambda_function.zip"
}

data "aws_iam_policy_document" "policy" {
  statement {
    sid    = ""
    effect = "Allow"
    principals {
      identifiers = ["lambda.amazonaws.com"]
      type        = "Service"
    }
    actions = ["sts:AssumeRole"]
  }
}

resource "aws_iam_role" "iam_for_lambda" {
  name               = "iam_for_lambda"
  assume_role_policy = data.aws_iam_policy_document.policy.json
}

resource "aws_lambda_function" "hello_world" {
  filename         = data.archive_file.lambda_zip.output_path
  function_name    = "test_lambda"
  role             = aws_iam_role.iam_for_lambda.arn
  handler          = "index.lambda_handler"
  source_code_hash = data.archive_file.lambda_zip.output_base64sha256
  runtime          = "nodejs16.x"
}

Steps to Reproduce

  1. Try to created lambda with zipped code in eu-central-2 (Zürich). It works correctly in other regions.

Debug Output

No response

Panic Output

No response

Important Factoids

The user has full admin permissions, I tried adding:

"lambda:UpdateCodeSigningConfig",
"lambda:GetFunctionEventInvokeConfig",
"lambda:GetCodeSigningConfig",
"lambda:CreateCodeSigningConfig",
"lambda:GetFunctionCodeSigningConfig"

explicitly, it makes no difference.

References

I expect that it is the same issue as was described here: #16755 but for a new region.

Would you like to implement a fix?

No response

@pochopien pochopien added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Nov 23, 2022
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added service/iam Issues and PRs that pertain to the iam service. service/lambda Issues and PRs that pertain to the lambda service. labels Nov 23, 2022
@pochopien
Copy link
Author

AWS Signer availability:
https://docs.aws.amazon.com/general/latest/gr/signer.html

eu-central-2 is not on the list

@breathingdust breathingdust removed the needs-triage Waiting for first response or review from a maintainer. label Nov 24, 2022
@github-actions github-actions bot added this to the v4.42.0 milestone Nov 28, 2022
@github-actions
Copy link

This functionality has been released in v4.42.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/iam Issues and PRs that pertain to the iam service. service/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants