terraform-aws-gitlab-runner
terraform-aws-gitlab-runner copied to clipboard
cancel-spot-instances.sh fails in Terraform container
This module "npalm/gitlab-runner/aws" is meant to be run in a Terraform container, however script bin/cancel-spot-instances.sh doesn't work because it requires bash which doesn't exist in Terraform images. Terraform images only have sh. Besides, the script also requires jq and awscli which don't exist either in Terraform alpine based images.
I get this error:
│ Error: local-exec provisioner error
│
│ with null_resource.cancel_spot_requests,
│ on main.tf line 142, in resource "null_resource" "cancel_spot_requests":
│ 142: provisioner "local-exec" {
│
│ Error running command
│ './.terraform/modules/gitlab-runner/bin/cancel-spot-instances.sh
│ voice-runners': exit status 127. Output: env: can't execute 'bash': No such
│ file or directory
Thanks for reporting. I see not another way to cancel spot instances when destroy than using a local executor. We could explore the following options:
- Run in
/bin/sh - Add an op-out flag for the script
As far as I remember this null_resource has been removed some time ago. Could you please check the module version you are using? Any chance to update to 5.0.2?
EDIT: Ah, I see. This null_resource is introduced in the examples.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.
To be tackled in #623 as we need an option to remove resources created during runtime.
The script will be removed. A Lambda function will handle the cancellation of spot instances when the agent is shutdown.
The script was created to support the examples (for testing purpose).