Skip to content

Commit

Permalink
Improvement on the module (#53)
Browse files Browse the repository at this point in the history
* Removed Local Path variable

* Updated the bash script

* Updated the binary location for the archive data resource

* Updated the binary location

* Updated the module version
  • Loading branch information
eminalemdar authored Sep 26, 2023
1 parent 840fe8d commit 7ae9fe9
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .spacelift/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: 1
module_version: 1.7.0
module_version: 1.8.0
tests:
- name: AMD64-based workerpool
project_root: examples/amd64
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ terraform {
}
module "my_workerpool" {
source = "github.com/spacelift-io/terraform-aws-spacelift-workerpool-on-ec2?ref=v1.7.0"
source = "github.com/spacelift-io/terraform-aws-spacelift-workerpool-on-ec2?ref=v1.8.0"
configuration = <<-EOT
export SPACELIFT_TOKEN="${var.worker_pool_config}"
Expand Down Expand Up @@ -119,7 +119,6 @@ $ make docs
| <a name="input_enabled_metrics"></a> [enabled\_metrics](#input\_enabled\_metrics) | List of CloudWatch metrics enabled on the ASG | `list(string)` | <pre>[<br> "GroupDesiredCapacity",<br> "GroupInServiceInstances",<br> "GroupMaxSize",<br> "GroupMinSize",<br> "GroupPendingInstances",<br> "GroupStandbyInstances",<br> "GroupTerminatingInstances",<br> "GroupTotalInstances"<br>]</pre> | no |
| <a name="input_iam_role_arn"></a> [iam\_role\_arn](#input\_iam\_role\_arn) | ARN of an existing IAM to use. Used `when create_iam_role` = `false` | `string` | `null` | no |
| <a name="input_instance_refresh"></a> [instance\_refresh](#input\_instance\_refresh) | If this block is configured, start an Instance Refresh when this Auto Scaling Group is updated based on instance refresh configration. | `any` | `{}` | no |
| <a name="input_local_path"></a> [local\_path](#input\_local\_path) | Local path for the binary download | `string` | `"/tmp"` | no |
| <a name="input_max_size"></a> [max\_size](#input\_max\_size) | Maximum number of workers to spin up | `number` | `10` | no |
| <a name="input_min_size"></a> [min\_size](#input\_min\_size) | Minimum numbers of workers to spin up | `number` | `0` | no |
| <a name="input_poweroff_delay"></a> [poweroff\_delay](#input\_poweroff\_delay) | Number of seconds to wait before powering the EC2 instance off after the Spacelift launcher stopped | `number` | `15` | no |
Expand Down
4 changes: 2 additions & 2 deletions autoscaler.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ resource "aws_ssm_parameter" "spacelift_api_key_secret" {
resource "null_resource" "download" {
count = var.enable_autoscaling ? 1 : 0
provisioner "local-exec" {
command = "${path.module}/download.sh ${var.autoscaler_version} ${var.local_path}"
command = "${path.module}/download.sh ${var.autoscaler_version}"
}
}

data "archive_file" "binary" {
count = var.enable_autoscaling ? 1 : 0
type = "zip"
source_file = "${var.local_path}/bootstrap"
source_file = "lambda/bootstrap"
output_path = "ec2-workerpool-autoscaler_${var.autoscaler_version}.zip"
depends_on = [null_resource.download]
}
Expand Down
8 changes: 4 additions & 4 deletions download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ set -ex

# Download the data.
code_version=$1
local_path=$2

curl -L -o ${local_path}/lambda.zip https://github.com/spacelift-io/ec2-workerpool-autoscaler/releases/download/${code_version}/ec2-workerpool-autoscaler_linux_amd64.zip
curl -L -o lambda.zip https://github.com/spacelift-io/ec2-workerpool-autoscaler/releases/download/${code_version}/ec2-workerpool-autoscaler_linux_amd64.zip

cd ../../../../../tmp
unzip lambda.zip
mkdir lambda
cd lambda
unzip ../lambda.zip
6 changes: 0 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,6 @@ variable "spacelift_api_key_endpoint" {
description = "Full URL of the Spacelift API endpoint to use, eg. https://demo.app.spacelift.io"
}

variable "local_path" {
type = string
description = "Local path for the binary download"
default = "/tmp"
}

variable "schedule_expression" {
type = string
description = "The scheduling expression"
Expand Down

0 comments on commit 7ae9fe9

Please sign in to comment.