Terraform Version = 1.12.6
aws Provider Version = 2.40
resource aws_lambda_function find-images {
function_name = "sentinel-find-images"
handler = "sentinel-find-images.handler"
role = ""
runtime = "python3.6"
filename = "../../lambda/sentinel-find-images/sentinel-find-images.zip"
timeout = 900
memory_size = 3000
environment {
variables = {
STAGE = "TESTING"
}
}
}
https://gist.github.com/ciaranevans/de537317f933b98df7af306bb86e2730 For failing run
https://gist.github.com/ciaranevans/0a30164e61ae444198a59fad37c80013 For successful run
Terraform finishes deployment with line similar to:
Apply complete! Resources: 24 added, 0 changed, 0 destroyed.
All functions failed to deploy (According to Terraform), shown in debug logs above.
However they are actually deployed - my tests that wait for them to be deployed kick off and pass...
Tests are initiated once:
aws lambda list-functions --endpoint-url=http://localhost:4574 | jq '.[] | length'
returns a number == to the number of functions I'm deploying
provider aws {
region = "eu-west-2"
s3_force_path_style = true
skip_credentials_validation = true
skip_metadata_api_check = true
skip_requesting_account_id = true
endpoints {
apigateway = "http://localhost:4567"
cloudwatchlogs = "http://localhost:4586"
dynamodb = "http://localhost:4569"
iam = "http://localhost:4593"
lambda = "http://localhost:4574"
s3 = "http://localhost:4572"
sns = "http://localhost:4575"
sqs = "http://localhost:4576"
ssm = "http://localhost:4583"
}
}
terraform applyaws provider version 2.39aws provider version 2.40@ciaranevans My guess is that this is a LocalStack-specific problem.
The AWS Lambda GetFunctionConfiguration API now returns a State field and the Terraform AWS Provider (as of v2.40.0) uses this field to ensure that the lambda function is created successfully.
A missing value (as in the current LocalStack implementation) results in an empty State value which isn't either the in-progress value (Pending) or success value (Active), triggering the error you experienced.
You can pin the provider version to v2.39.0 until LocalStack support this functionality; I'd suggest opening an issue in their repo and referencing this issue.
@ewbankkit Great, thanks for taking a look into this!
I did indeed end up pinning the version. Couldn't quite figure out which end of the stick was going wrong!
Letting the LocalStack folks know!
Fixed in the latest version of LocalStack, tested with version 2.41.0 of the AWS Provider
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
@ciaranevans My guess is that this is a LocalStack-specific problem.
The AWS Lambda
GetFunctionConfigurationAPI now returns aStatefield and the Terraform AWS Provider (as of v2.40.0) uses this field to ensure that the lambda function is created successfully.A missing value (as in the current LocalStack implementation) results in an empty
Statevalue which isn't either the in-progress value (Pending) or success value (Active), triggering the error you experienced.You can pin the provider version to v2.39.0 until LocalStack support this functionality; I'd suggest opening an issue in their repo and referencing this issue.