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

Trouble Importing Lambda Function with Terraform's New Import Block #34374

Closed
ankitaameenaa opened this issue Dec 7, 2023 · 2 comments
Closed

Comments

@ankitaameenaa
Copy link

Terraform Version

Terraform v1.6.2
on windows_amd64
+ provider registry.terraform.io/hashicorp/aws v5.22.0

Terraform Configuration Files

import {
id = "xxxxxx"
to = aws_lambda_function.xxxxxx
}

Debug Output

will provide if needed

Expected Behavior

Should be able to create generated.tf

Actual Behavior

Error: Invalid combination of arguments

with aws_lambda_function.DeviceUsageJob,
on generated.tf line 16:
(source code not available)

"s3_bucket": one of filename,image_uri,s3_bucket must be specified

Steps to Reproduce

terraform init
terraform plan -generate-config-out=generated.tf

Additional Context

It is generating a 'generated.tf' file in which, for some Lambda functions, the creation configuration includes 's3_bucket' without specifying one of filename, image_uri, or s3_bucket. However, for some other Lambda functions, it does not generate the configuration and gives an error stating that 's3_bucket' must be specified as one of filename, image_uri, or `s3_bucket."

References

No response

@ankitaameenaa ankitaameenaa added bug new new issue not yet triaged labels Dec 7, 2023
@jbardin
Copy link
Member

jbardin commented Dec 7, 2023

Hi @ankitaameenaa,

The error here is again from the provider, not from Terraform itself. The state returned by the provider for the aws_lambda_function resource appears to be missing values which would be required if it were written in the configuration. Since Terraform cannot guess what these values should be, it is up to the provider to return them in the read state. While the resource implementation would need to be changed in the provider to allow for config generation, the normal import process should work as expected if you create a resource block for the aws_lambda_function manually.

Thanks!

@jbardin jbardin closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2023
@jbardin jbardin added provider/aws and removed new new issue not yet triaged labels Dec 7, 2023
Copy link
Contributor

github-actions bot commented Jan 7, 2024

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 Jan 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants