Reputation: 1309
I'm creating/updating a lambda function using terraform and I need to run it AFTER it is created or updated. I know there is a terraform data source aws_lambda_invocation
but it runs BEFORE the lambda function created/updated.
Is there any way to achieve this in terraform?
Upvotes: 1
Views: 2653
Reputation: 491
Store your terraform state file in S3. Set trigger on state files update action. So whenever there is a change in terraform it will update statte file in S3. You can set trigger from S3 to trigger lambda. https://docs.aws.amazon.com/lambda/latest/dg/with-s3-example.html
Upvotes: 0
Reputation: 238061
Normally you would use depends_on for that:
data "aws_lambda_invocation" "fun" {
# ...
depends_on = [aws_lambda_function.fun]
}
Upvotes: 4