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

bugfix for lambda in ap-northeast-3 #20555

Merged
merged 4 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/20555.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
resource/aws_lambda_function: fix Osaka ap-northeast-3 lambda function creation, failing due to code signer service not available in the region.
```
9 changes: 9 additions & 0 deletions aws/resource_aws_lambda_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,15 @@ func resourceAwsLambdaFunctionRead(d *schema.ResourceData, meta interface{}) err
return nil
}

// Currently, this functionality is not enabled in ap-northeast-3 (Osaka) region
// and returns ambiguous error codes (e.g. AccessDeniedException)
// so we cannot just ignore the error as would typically.
// We are hardcoding the region here, because go aws sdk endpoints
// package does not support Signer service
if meta.(*AWSClient).region == endpoints.ApNortheast3RegionID {
return nil
}

// Code Signing is only supported on zip packaged lambda functions.
var codeSigningConfigArn string

Expand Down
15 changes: 11 additions & 4 deletions aws/resource_aws_lambda_function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/service/lambda"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
Expand Down Expand Up @@ -192,8 +193,14 @@ func TestAccAWSLambdaFunction_disappears(t *testing.T) {
}

func TestAccAWSLambdaFunction_codeSigningConfig(t *testing.T) {
if testAccGetPartition() == "aws-us-gov" {
t.Skip("Lambda code signing config is not supported in GovCloud partition")
if got, want := testAccGetPartition(), endpoints.AwsUsGovPartitionID; got == want {
t.Skipf("Lambda code signing config is not supported in %s partition", got)
}

// We are hardcoding the region here, because go aws sdk endpoints
// package does not support Signer service
if got, want := testAccGetRegion(), endpoints.ApNortheast3RegionID; got == want {
t.Skipf("Lambda code signing config is not supported in %s region", got)
}

var conf lambda.GetFunctionOutput
Expand Down Expand Up @@ -993,8 +1000,8 @@ func TestAccAWSLambdaFunction_imageConfig(t *testing.T) {
}

func TestAccAWSLambdaFunction_tracingConfig(t *testing.T) {
if testAccGetPartition() == "aws-us-gov" {
t.Skip("Lambda tracing config is not supported in GovCloud partition")
if got, want := testAccGetPartition(), endpoints.AwsUsGovPartitionID; got == want {
t.Skipf("Lambda tracing config is not supported in %s partition", got)
}

var conf lambda.GetFunctionOutput
Expand Down