Skip to content

fix: Don't call GetFunctionCodeSigningConfig or GetRuntimeManagementConfig on Lambdas packaged as Images (aws_lambda_functions)#14729

Merged
kodiakhq[bot] merged 4 commits intocloudquery:mainfrom
AshCorr:ash/AwsLambdaFunctions
Oct 20, 2023
Merged

fix: Don't call GetFunctionCodeSigningConfig or GetRuntimeManagementConfig on Lambdas packaged as Images (aws_lambda_functions)#14729
kodiakhq[bot] merged 4 commits intocloudquery:mainfrom
AshCorr:ash/AwsLambdaFunctions

Conversation

@AshCorr
Copy link
Copy Markdown
Contributor

@AshCorr AshCorr commented Oct 19, 2023

Summary

When syncing aws_lambda_functions Cloudquery has 2 resolvers for GetFunctionCodeSigningConfig and GetRuntimeManagementConfig. The AWS API does not support calling either of these APIs with Lambdas that use containerised images and this results in errors in Cloudquery.

Thankfully Cloudquery is great and doesn't panic when it encounters these errors and theres no loss in data, but it does log it as "something bad happening" when in reality this is expected behaviour from the AWS API.

It looks like there was an attempt to fix this before for GetFunctionCodeSigningConfig but it doesn't seem to be preventing the errors.

2:39PM ERR column resolver finished with error error="operation error Lambda: GetFunctionCodeSigningConfig, https response error StatusCode: 400, RequestID: (redacted), InvalidParameterValueException: Code signing is not supported for functions created with container images." client=(redacted) module=aws-src table=aws_lambda_functions
2:39PM ERR column resolver finished with error error="operation error Lambda: GetRuntimeManagementConfig, https response error StatusCode: 400, RequestID: (redacted), InvalidParameterValueException: Lambda couldn't get a runtime management configuration because (redacted) is a container image function." client=(redacted) module=aws-src table=aws_lambda_functions

Part of #14652

svc := cl.Services(client.AWSServiceLambda).Lambda

// skip getting CodeSigningConfig since containerized lambda functions does not support this feature
// value can be nil if the caller doesn't have GetFunctionConfiguration permission and only has List*
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// skip getting CodeSigningConfig since containerized lambda functions does not support this feature
// value can be nil if the caller doesn't have GetFunctionConfiguration permission and only has List*
lambdaType := resource.Get("code_repository_type").(*scalar.String)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure why we previously relied on untyped resource.Get instead of directly accessing values from r.Configuration. Either way, this approach seemed to not be working for us as we were still getting errors from GetRuntimeManagementConfig.

@AshCorr AshCorr marked this pull request as ready for review October 19, 2023 14:29
…mentConfig on Lambdas packaged as Images (`aws_lambda_functions`)
@AshCorr AshCorr force-pushed the ash/AwsLambdaFunctions branch from eae2760 to 05c9355 Compare October 19, 2023 14:29
@AshCorr AshCorr changed the title fix(aws): Don't call GetFunctionCodeSigningConfig or GetRuntimeManagementConfig on Lambdas packaged as Images (aws_lambda_functions) fix: Don't call GetFunctionCodeSigningConfig or GetRuntimeManagementConfig on Lambdas packaged as Images (aws_lambda_functions) Oct 19, 2023
@erezrokah erezrokah requested review from bbernays and removed request for hermanschaaf and yevgenypats October 19, 2023 14:58
Copy link
Copy Markdown
Collaborator

@bbernays bbernays left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find!

@bbernays bbernays added the automerge Automatically merge once required checks pass label Oct 20, 2023
@kodiakhq kodiakhq bot merged commit 6fc30d3 into cloudquery:main Oct 20, 2023
kodiakhq bot pushed a commit that referenced this pull request Oct 23, 2023
🤖 I have created a release *beep* *boop*
---


## [22.16.0](plugins-source-aws-v22.15.2...plugins-source-aws-v22.16.0) (2023-10-23)


### This Release has the Following Changes to Tables
- Table `aws_efs_filesystems`: column added with name `file_system_policy` and type `utf8`

### Features

* Add `policy` column to `aws_efs_filesystems` table ([#14672](#14672)) ([833b9c2](833b9c2))


### Bug Fixes

* Changed the condition to check for policies in policies table ([#13935](#13935)) ([f136331](f136331))
* **deps:** Update github.com/cloudquery/arrow/go/v14 digest to f46436f ([#14803](#14803)) ([f5248d7](f5248d7))
* **deps:** Update module github.com/cloudquery/codegen to v0.3.10 ([#14773](#14773)) ([98f3e2c](98f3e2c))
* **deps:** Update module github.com/cloudquery/codegen to v0.3.11 ([#14870](#14870)) ([4fa917d](4fa917d))
* Don't call GetFunctionCodeSigningConfig or GetRuntimeManagementConfig on Lambdas packaged as Images (`aws_lambda_functions`) ([#14729](#14729)) ([6fc30d3](6fc30d3))
* Handle `NotFound` error when syncing Subscriptions with deleted topic (`aws_sns_subscriptions`) ([#14771](#14771)) ([6fcf43d](6fcf43d))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/plugin/source/aws automerge Automatically merge once required checks pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants