There's a bit of code in this module that downloads the lambda package from GitHub if it's not on disk already:
|
provisioner "local-exec" { |
|
command = "test -f ${local.package_directory}/${local.package_filename} || (mkdir -p ${local.package_directory} && wget -P ${local.package_directory} ${var.package_url})" |
|
} |
If this module is used in a loop in terraform, the code consistently encounters some race condition errors:
Error running command 'test -f .terraform/modules/tenant.cloudfront_auth_okta_native.okta_native/infra/terraform/modules/_lambda/packages/rotate_key_pair.zip || (mkdir -p .terraform/modules/tenant.cloudfront_auth_okta_native.okta_native/infra/terraform/modules/_lambda/packages && wget -P .terraform/modules/tenant.cloudfront_auth_okta_native.okta_native/infra/terraform/modules/_lambda/packages https://github.com/iress/cloudfront-auth/releases/download/v3.2.0/rotate_key_pair.zip)': exit status 1. Output: Connecting to github.com (140.82.121.3:443)
Connecting to objects.githubusercontent.com (185.199.110.133:443)
wget: can't open '.terraform/modules/tenant.cloudfront_auth_okta_native.okta_native/infra/terraform/modules/_lambda/packages/rotate_key_pair.zip': File exists
We've been able to work around this by setting terraform's parallelism to 1, but this has the effect of slowing down our builds.
Ideally the code would be made safer for multiple threads or another mechanism would be used to download the package.
There's a bit of code in this module that downloads the lambda package from GitHub if it's not on disk already:
cloudfront-auth/infra/terraform/modules/_lambda/main.tf
Lines 12 to 14 in 2b9e826
If this module is used in a loop in terraform, the code consistently encounters some race condition errors:
We've been able to work around this by setting terraform's parallelism to 1, but this has the effect of slowing down our builds.
Ideally the code would be made safer for multiple threads or another mechanism would be used to download the package.