terraformer: Error: Import AWS Lambda ends w/ an error

I’m trying to import AWS Lambda and get an error related to GetPolicy. There is an open question reg. it in StackOverflow that was opened a week ago.

My feeling that it is related to Line 104 @ https://github.com/GoogleCloudPlatform/terraformer/blob/master/providers/aws/lambda.go

sudo ./terraformer import aws --resources=lambda --regions=eu-west-1
2023/01/04 23:01:50 aws importing region eu-west-1
2023/01/04 23:01:50 aws importing... lambda
2023/01/04 23:01:51 aws error initializing resources in service lambda, err: operation error Lambda: GetPolicy, https response error StatusCode: 404, RequestID: 67d8e12c-adf2-405f-9d65-5045981e0cb7, ResourceNotFoundException: The resource you requested does not exist.
2023/01/04 23:01:51 aws Connecting....

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 9
  • Comments: 33

Commits related to this issue

Most upvoted comments

This is still an issue that wasn’t fixed. I’m having the same problem.

using the forked git provided by @eazevedo-cloud. git clone it and run it. it really worked well.

image

Here provided the way to install and run it:

  1. Clone the repo with the following command git clone https://github.com/eazevedo-cloud/terraformer.git

  2. It will install into a directory called terraformer. You may rename into terraformer-forked so that you could allow both official terraform and terraformer exist in your machine mv terraformer terrafomer-forked

  3. You may install Go in your machine.

  4. Build the forked code with Go go build -o terraformer-forked

  5. Move the file to the user program file (In case you are using windows, you may move the installed item to Program files, and add the program files to Environment Variables) sudo mv terraformer-forked /usr/local/bin/

  6. (Optional) Verify the installation terraformer-forked version

  7. Now you may run the command of import instead of terraformer, change to terraformer-forked

    provided a sample: terraformer-forked import aws --resources="lambda" --regions="ap-southeast-1"

Hope it helps.

Cheers!!!

Almost a year has passed, and this issue is still relevant. Is it me, or is terraformer not keeping up since terraform introduced the -generate-config-out option in plan for resources listed in import blocks?

This bug basically makes importing lambdas completely broken. What a shame, since terraformer is such a cool project.

Please reopen this issue.

Still relevant. Please reopen this issue.

This still an issue on version v0.8.24

Same problem.

This is still an issue. Please re-open the issue

Same problem. I have a lot of lambda without policy and cant add policy right now. How I can import all of them

@sergeylanzman can we re-open this? It still isn’t resolved even when installing/building from main.

Hello, I have the same problem.

Compiled the fix from @vgavro (https://github.com/GoogleCloudPlatform/terraformer/pull/1818) and it works. When release ?

Hi guys, I forked and changed the lambda code to fix that issue. Just tested successfully!

image

image

Not a big deal, but hope it can help https://github.com/eazevedo-cloud/terraformer/commit/ba6271cfae33d5157d4f0f637e19b1317c5d2a74

Cheers!

Can we re-open this? It’s still an issue.

Nice, but it is still a bug (especially when you want this export for audit needs).

@mosheka - i have been looking at cloudtrail logs and it appears that it fails on finding the first lambda with no resource policy (inline policy doesn’t cut it apparently). so, if you can put resource policy on all your lambdas you should (theoretically because im still going through my lambdas to add missing policy) get it to work.

my feeling is that this issue needs a fork-n-fix such that where there is no policy (404), it attempts inline and otherwise does not raise exception.

same problem

@sergeylanzman apparently this is NOT really fixed. We are still getting this error.

@sergeylanzman is there any new release containing this fix coming soon?

Need the fix as well - terracognita also has a bug with lambda - but more-so on the templating front

It would be awesome to have this fixed as soon as possible!

This is still an issue. Please re-open the issue

Same issue here also.

Can we re-open this? It’s still an issue.

yes, it is a bug. or rather, a section of code that is incomplete. either way it needs attention and im half-inclined to do it although i already have my finger in too many pies so i resist temptation.