Skip to content

Commit 286de13

Browse files
authored
fix: ensure that key pair names do not overlap (#1338)
## Description Add a validation check to `var.environment` to make sure that we can't use `runner-` as prefix. If this prefix is used, the terminate agent lambda removes key pairs which shouldn't be removed. See #1291 (comment) Closes #1291
1 parent 2ab7761 commit 286de13

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ variable "iam_permissions_boundary" {
4747
variable "environment" {
4848
description = "A name that identifies the environment, used as prefix and for tagging."
4949
type = string
50+
51+
validation {
52+
condition = !startswith(var.environment, "runner-")
53+
error_message = "Environment name cannot begin with 'runner-' because it breaks the naming convention for ssh key pairs within the terminate-agent-hook lambda function."
54+
}
5055
}
5156

5257
variable "tags" {

0 commit comments

Comments
 (0)