-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor GitHub runner module and add ECS cluster resource
- Loading branch information
Dave Arnold
committed
Sep 18, 2024
1 parent
6401be6
commit 8635cf3
Showing
3 changed files
with
175 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # The name of the ECS cluster | ||
| image_name = "github-runner" | ||
| image_version = "1.23.0" | ||
|
|
||
| ecs_cluster_name = "automation-repo-runners" | ||
| vpc_id = "vpc-00576a396ec570b94" | ||
|
|
||
| namespace = "csvd-ghe-runner" | ||
| repo_org = "CSVD" | ||
|
|
||
| subnets = [ | ||
| "subnet-04b80d7ce5199f82b" | ||
| ] | ||
|
|
||
| security_groups = [ | ||
| # "sg-0d828d223df9834a6" | ||
| "sg-0641c697588b9aa6b" | ||
| ] | ||
|
|
||
| certs = { | ||
| bucket = "image-pipeline-assets" | ||
| key = "katello-server-ca.pem" | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| variable "ecs_cluster_name" { | ||
| description = "The name of the ECS cluster" | ||
| type = string | ||
|
|
||
| validation { | ||
| condition = length(var.ecs_cluster_name) > 0 | ||
| error_message = "The ECS cluster name must not be empty." | ||
| } | ||
| } | ||
|
|
||
| variable "github_runners" { | ||
| description = "A list of GitHub runners" | ||
| type = list(object({ | ||
| hostname = string | ||
| namespace = optional(string, null) | ||
| repo_name = optional(string, null) | ||
| labels = optional(list(string)) | ||
| subnets = optional(list(string)) | ||
| tag = optional(string) | ||
|
|
||
| network_configuration = optional(object({ | ||
| subnets = optional(list(string), []), | ||
| security_groups = optional(list(string), []), | ||
| assign_public_ip = optional(bool, false) | ||
| }), {} | ||
| ) | ||
|
|
||
| runner_group = optional(object({ | ||
| name = optional(string) | ||
| visibility = optional(string, "selected") | ||
| selected_workflows = optional(list(string), []) | ||
| selected_repository_ids = optional(list(string), []) | ||
| allows_public_repositories = optional(bool, false) | ||
| create = optional(bool, false) | ||
| }), { create = false }) | ||
| # end of variable definition | ||
| })) | ||
|
|
||
| validation { | ||
| condition = length(var.github_runners) > 0 | ||
| error_message = "The list of GitHub runners must not be empty." | ||
| } | ||
| } | ||
|
|
||
| variable "repo_org" { | ||
| description = "The GitHub organization" | ||
| type = string | ||
|
|
||
| validation { | ||
| condition = length(var.repo_org) > 0 | ||
| error_message = "The GitHub organization must not be empty." | ||
| } | ||
| } | ||
|
|
||
| variable "namespace" { | ||
| description = "The namespace for the resources" | ||
| type = string | ||
|
|
||
| validation { | ||
| condition = length(var.namespace) > 0 | ||
| error_message = "The namespace must not be empty." | ||
| } | ||
| } | ||
|
|
||
| variable "subnets" { | ||
| description = "A list of subnets" | ||
| type = list(string) | ||
| default = [] | ||
| validation { | ||
| condition = length(var.subnets) >= 0 | ||
| error_message = "The list of subnets must not be empty." | ||
| } | ||
| } | ||
|
|
||
| variable "security_groups" { | ||
| description = "A list of security groups" | ||
| type = list(string) | ||
| default = [] | ||
| validation { | ||
| condition = length(var.security_groups) >= 0 | ||
| error_message = "The list of security groups must not be empty." | ||
| } | ||
| } | ||
|
|
||
| variable "assign_public_ip" { | ||
| default = false | ||
| type = bool | ||
| } | ||
|
|
||
| variable "cluster_size" { | ||
| default = 3 | ||
| } | ||
|
|
||
| variable "vpc_id" {} | ||
|
|
||
| variable "create_vpc_endpoint" { | ||
| type = bool | ||
| default = false | ||
| } | ||
|
|
||
| variable "image_name" {} | ||
| variable "image_version" {} | ||
|
|
||
| variable "server_url" { | ||
| default = "" | ||
| } | ||
|
|
||
| variable "certs" { | ||
| type = object({ | ||
| bucket = string | ||
| key = string | ||
| }) | ||
| default = null | ||
| } |