Open ElijahLynn opened 1 year ago
Looks like the depends_on
isn't working the way it should, investigating:
e.g.
resource "aws_lambda_function" "publish_book_review" {
filename = "${local.building_path}/${local.lambda_code_filename}"
handler = "index.lambda_handler"
runtime = "python3.8"
function_name = "publish-book-review"
role = aws_iam_role.iam_for_lambda.arn
timeout = 30
depends_on = [
null_resource.build_lambda_function
]
environment {
variables = {
DYNAMODB_TABLE_NAME = "${aws_dynamodb_table.book-reviews-ddb-table.id}"
}
}
}
Working through this, using triggers: https://discuss.hashicorp.com/t/null-resources-depends-on-doesnt-work-on-replacement/10109
K, null_resource is already using triggers and you can't use triggers on any other resource so I don't think that will work. I'm not sure there is a way as is right now.
Working through this approach https://stackoverflow.com/questions/65678208/terraform-depends-on-argument-not-creating-the-specified-resource-first
I was able to deploy with Terraform the example at zip_based_lambda_functions/lambda-example/main.tf. However, if I just change a line in the zip_based_lambda_functions/api-lambda-dynamodb-example/src/index.py and do another
terraform apply
, the output rebuilds the file, yes, but it never deploys it.This article doesn't suggest how to deploy changes. https://aws.amazon.com/blogs/compute/better-together-aws-sam-cli-and-hashicorp-terraform/
Here is the tail of an apply: