diff --git a/README.md b/README.md index 11359fa5c..a64b4c241 100644 --- a/README.md +++ b/README.md @@ -387,6 +387,7 @@ terraform destroy | [runners\_additional\_volumes](#input\_runners\_additional\_volumes) | Additional volumes that will be used in the runner config.toml, e.g Docker socket | `list(any)` | `[]` | no | | [runners\_concurrent](#input\_runners\_concurrent) | Concurrent value for the runners, will be used in the runner config.toml. | `number` | `10` | no | | [runners\_disable\_cache](#input\_runners\_disable\_cache) | Runners will not use local cache, will be used in the runner config.toml | `bool` | `false` | no | +| [runners\_add\_dind\_volumes](#input\_runners\_add\_dind\_volumes) | Add certificates and docker.sock to the volumes to support docker-in-docker (dind) | `bool` | `false` | no | | [runners\_docker\_runtime](#input\_runners\_docker\_runtime) | docker runtime for runners, will be used in the runner config.toml | `string` | `""` | no | | [runners\_ebs\_optimized](#input\_runners\_ebs\_optimized) | Enable runners to be EBS-optimized. | `bool` | `true` | no | | [runners\_environment\_vars](#input\_runners\_environment\_vars) | Environment variables during build execution, e.g. KEY=Value, see runner-public example. Will be used in the runner config.toml | `list(string)` | `[]` | no | diff --git a/locals.tf b/locals.tf index 8ff1f3654..f885ca343 100644 --- a/locals.tf +++ b/locals.tf @@ -17,7 +17,7 @@ locals { name_sg = var.overrides["name_sg"] == "" ? local.tags["Name"] : var.overrides["name_sg"] name_iam_objects = var.overrides["name_iam_objects"] == "" ? local.tags["Name"] : var.overrides["name_iam_objects"] runners_additional_volumes = <<-EOT - %{~for volume in var.runners_additional_volumes~},"${volume}"%{endfor~} + %{~if var.runners_add_dind_volumes~},"/certs/client", "/builds", "/var/run/docker.sock:/var/run/docker.sock"%{endif~}%{~for volume in var.runners_additional_volumes~},"${volume}"%{endfor~} EOT runners_machine_autoscaling = templatefile("${path.module}/template/runners_machine_autoscaling.tpl", { diff --git a/variables.tf b/variables.tf index f508e9c50..dfe6d06c1 100644 --- a/variables.tf +++ b/variables.tf @@ -189,6 +189,12 @@ variable "runners_disable_cache" { default = false } +variable "runners_add_dind_volumes" { + description = "Add certificates and docker.sock to the volumes to support docker-in-docker (dind)" + type = bool + default = false +} + variable "runners_additional_volumes" { description = "Additional volumes that will be used in the runner config.toml, e.g Docker socket" type = list(any)