Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the module in a loop has issues downloading the lambda package #31

Open
iress-ac opened this issue Nov 2, 2022 · 0 comments · May be fixed by #33
Open

Using the module in a loop has issues downloading the lambda package #31

iress-ac opened this issue Nov 2, 2022 · 0 comments · May be fixed by #33

Comments

@iress-ac
Copy link

iress-ac commented Nov 2, 2022

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.

@iress-ac iress-ac changed the title Issue using the module in a loop Using the module in a loop has issues downloading the lambda package Nov 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant