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

tf plan/apply with aws_lambda_function in me-central-1 throws errors #26486

Closed
muellerc opened this issue Aug 25, 2022 · 6 comments · Fixed by #26572
Closed

tf plan/apply with aws_lambda_function in me-central-1 throws errors #26486

muellerc opened this issue Aug 25, 2022 · 6 comments · Fixed by #26572
Labels
bug Addresses a defect in current functionality. service/lambda Issues and PRs that pertain to the lambda service.
Milestone

Comments

@muellerc
Copy link

Community Note

Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
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
If you are interested in working on this issue or have submitted a pull request, please leave a comment

As announced here, AWS is launching a new region in UAE in 2022 and more are in the works.
While testing the region in UAE (region code me-central-1), I'm getting the same error as reported in issue 22692, as Code Signer is not available yet.

Terraform CLI and Terraform AWS Provider Version

Terraform v1.2.8
on darwin_amd64

  • provider registry.terraform.io/hashicorp/aws v4.27.0
  • provider registry.terraform.io/hashicorp/archive v2.2.0

Affected Resource(s)

aws_lambda_function

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

data "archive_file" "function_zip" {
  type        = "zip"
  source_file = "function/demo_function.py"
  output_path = "function/demoFunction.zip"
}

resource "aws_lambda_function" "demo_function" {
  filename      = "function/demoFunction.zip"
  function_name = "demo-function"
  runtime       = "python3.8"
  handler       = "lambda_function.lambda_handler"
  role          = aws_iam_role.lambda_role.arn
  source_code_hash = data.archive_file.function_zip.output_base64sha256
  timeout       = 5
}

resource "aws_iam_role" "lambda_role" {
  name = "lambda_role"
  assume_role_policy = <<EOF
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "lambda.amazonaws.com"
      },
      "Effect": "Allow",
      "Sid": ""
    }
  ]
}
EOF
}

Expected Behavior

No errors should be printed
Actual Behavior

terraform throws error, however lambda gets created

|
│ Error: error getting Lambda Function (demo-function) code signing config AccessDeniedException: 
│       status code: 403, request id: 7ce55dac-feea-47a3-895e-06436d81f5e8
│ 
│ 
|

Steps to Reproduce

Create lambda resource in me-central-1
terraform apply
@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/iam Issues and PRs that pertain to the iam service. service/lambda Issues and PRs that pertain to the lambda service. labels Aug 25, 2022
muellerc added a commit to muellerc/terraform-provider-aws that referenced this issue Aug 25, 2022
@muellerc
Copy link
Author

Could you please take a look at this fix and consider it for inclusion into the next release.

@MoeltnerM
Copy link

+1

@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 26, 2022
@ewbankkit ewbankkit removed the service/iam Issues and PRs that pertain to the iam service. label Aug 26, 2022
@muellerc
Copy link
Author

The region me-central-1 went public today.
Every user of Terraform who wants to deploy a Lambda function in this region will hit this issue.

@ewbankkit
Copy link
Contributor

After merging #26590 I can reproduce this:

% AWS_DEFAULT_REGION=me-central-1 make testacc TESTARGS='-run=TestAccLambdaFunction_basic' PKG=lambda ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/lambda/... -v -count 1 -parallel 2  -run=TestAccLambdaFunction_basic -timeout 180m
=== RUN   TestAccLambdaFunction_basic
=== PAUSE TestAccLambdaFunction_basic
=== CONT  TestAccLambdaFunction_basic
    function_test.go:46: Step 1/2 error: Error running apply: exit status 1
        
        Error: error getting Lambda Function (tf_acc_lambda_func_basic_8m8zxsrq) code signing config AccessDeniedException: 
        	status code: 403, request id: c8993f50-3b64-45fd-9b07-179097ba639c
        
          with aws_lambda_function.test,
          on terraform_plugin_test.tf line 134, in resource "aws_lambda_function" "test":
         134: resource "aws_lambda_function" "test" {
        
--- FAIL: TestAccLambdaFunction_basic (33.87s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/lambda	40.681s
FAIL
make: *** [testacc] Error 1

@github-actions github-actions bot added this to the v4.29.0 milestone Sep 1, 2022
@github-actions
Copy link

github-actions bot commented Sep 2, 2022

This functionality has been released in v4.29.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

github-actions bot commented Oct 3, 2022

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 Oct 3, 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/lambda Issues and PRs that pertain to the lambda service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants