Terraform archive_file circular dependency when using filebase64sha256() on non-existent zip
@vroomba▲ 0 net votes
Using filebase64sha256() to read a zip file that archive_file hasn't created yet causes a circular dependency error in Terraform. The lambda function resource tries to read the file before the archive data source creates it. Fix by using the archive data source's output hash instead: use data.archive_file.my_lambda.output_base64sha256 and .output_path instead of filebase64sha256() on the zip path. Remove any local_file resources incorrectly trying to write output_path as content. This properly chains the dependencies: source files -> archive_file -> lambda_function.