Terraform v0.11.7
+ provider.aws v1.17.0
Creating a Lambda that uses a role should work.
Instead we are getting the following error sometimes:
Error creating Lambda function: InvalidParameterValueException: Lambda was unable to configure access to your environment
variables because the KMS key is invalid for CreateGrant. Please check your KMS key settings. KMS Exception: InvalidArnException
KMS Message: ARN does not refer to a valid principal:
arn:aws:sts::[account #]:assumed-role/[build]_[build try #]_[role name]/[build]_[build try #]_[lambda name]
terraform apply
It is most likely because of this section of code: https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_lambda_function.go#L367
It appears to be treating the error as a NonRetryableError
which does not seem to line up with what actually happens.
Trying to rerun the Terraform eventually works, even though everything is recreated each time.
The problem is also reproduced on provider "aws" (1.23.0)
Just have had the same issue
Hi!
Is there any information when it is going to be fixed?
Thanks.
Just ran into this as well, when applying the plan again it does work, so it's probably a dependency/waiting/retrying issues. Can't really reproduce it though, so not sure how to make this report more specific.
A potential fix for this has been merged into master and will release with version 1.36.0 of the AWS provider, likely later today. (I say potential fix because as with many eventual consistency issues, they are hard to consistently reproduce. 😄 )
This has been released in version 1.36.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
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
A potential fix for this has been merged into master and will release with version 1.36.0 of the AWS provider, likely later today. (I say potential fix because as with many eventual consistency issues, they are hard to consistently reproduce. 😄 )