Skip to content

Commit 029bdbe

Browse files
committed
feat: add entrypoints for module and for ts code
added script to collect variables from submodules
1 parent 20bf60f commit 029bdbe

File tree

13 files changed

+493
-34
lines changed

13 files changed

+493
-34
lines changed

API.md

Lines changed: 212 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

main.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
locals {
2+
is_ecs = upper(var.runner_platform) == "ECS" ? 1: 0
3+
is_aca = upper(var.runner_platform) == "ACA" ? 1: 0
4+
is_cr = upper(var.runner_platform) == "GCR" ? 1: 0
5+
}
6+
7+
module "ecs" {
8+
count = local.is_ecs
9+
source = "./modules/elastic-container-service"
10+
PAT = var.PAT
11+
github_config_url = var.github_config_url
12+
}
13+
14+
module "aca" {
15+
count = local.is_aca
16+
source = "./modules/azure-container-apps"
17+
PAT = var.PAT
18+
github_config_url = var.github_config_url
19+
}
20+
21+
module "gcr" {
22+
count = local.is_cr
23+
source = "./modules/google-cloud-run"
24+
PAT = var.PAT
25+
github_config_url = var.github_config_url
26+
}

modules/azure-container-apps/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ No modules.
6464

6565
| Name | Description | Type | Default | Required |
6666
|------|-------------|------|---------|:--------:|
67-
| <a name="input_aca_PAT_B54A3B25"></a> [aca\_PAT\_B54A3B25](#input\_aca\_PAT\_B54A3B25) | Github PAT with Actions:Read and Admin:Read+Write scopes | `any` | n/a | yes |
68-
| <a name="input_aca_github_config_url_7230B339"></a> [aca\_github\_config\_url\_7230B339](#input\_aca\_github\_config\_url\_7230B339) | Github URL where runners should register to. Format https://<GitHub host>/<your\_enterprise/org/repo> | `any` | n/a | yes |
67+
| <a name="input_PAT"></a> [PAT](#input\_PAT) | Github PAT with Actions:Read and Admin:Read+Write scopes | `any` | n/a | yes |
6968
| <a name="input_aca_location_486B7D73"></a> [aca\_location\_486B7D73](#input\_aca\_location\_486B7D73) | Location where to provision resources to | `string` | `"westeurope"` | no |
69+
| <a name="input_github_config_url"></a> [github\_config\_url](#input\_github\_config\_url) | Github URL where runners should register to. Format https://<GitHub host>/<your\_enterprise/org/repo> | `any` | n/a | yes |
7070

7171
## Outputs
7272

modules/azure-container-apps/cdk.tf.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@
329329
"secret": [
330330
{
331331
"name": "pat",
332-
"value": "${var.aca_PAT_B54A3B25}"
332+
"value": "${var.PAT}"
333333
}
334334
],
335335
"template": {
@@ -343,7 +343,7 @@
343343
},
344344
{
345345
"name": "GITHUB_CONFIG_URL",
346-
"value": "${var.aca_github_config_url_7230B339}"
346+
"value": "${var.github_config_url}"
347347
},
348348
{
349349
"name": "AZURE_TENANT_ID",
@@ -615,21 +615,21 @@
615615
}
616616
},
617617
"variable": {
618-
"aca_PAT_B54A3B25": {
618+
"PAT": {
619619
"description": "Github PAT with Actions:Read and Admin:Read+Write scopes",
620620
"nullable": false,
621621
"sensitive": true
622622
},
623-
"aca_github_config_url_7230B339": {
624-
"description": "Github URL where runners should register to. Format https://<GitHub host>/<your_enterprise/org/repo>",
625-
"nullable": false
626-
},
627623
"aca_location_486B7D73": {
628624
"default": "westeurope",
629625
"description": "Location where to provision resources to",
630626
"nullable": false,
631627
"sensitive": false,
632628
"type": "string"
629+
},
630+
"github_config_url": {
631+
"description": "Github URL where runners should register to. Format https://<GitHub host>/<your_enterprise/org/repo>",
632+
"nullable": false
633633
}
634634
}
635635
}

modules/elastic-container-service/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ No modules.
5757

5858
| Name | Description | Type | Default | Required |
5959
|------|-------------|------|---------|:--------:|
60-
| <a name="input_aws_PAT_4017AC3F"></a> [aws\_PAT\_4017AC3F](#input\_aws\_PAT\_4017AC3F) | Github PAT with Actions:Read and Admin:Read+Write scopes | `any` | n/a | yes |
61-
| <a name="input_aws_github_config_url_BFDD14B2"></a> [aws\_github\_config\_url\_BFDD14B2](#input\_aws\_github\_config\_url\_BFDD14B2) | Github URL where runners should register to. Format https://<GitHub host>/<your\_enterprise/org/repo> | `any` | n/a | yes |
60+
| <a name="input_PAT"></a> [PAT](#input\_PAT) | Github PAT with Actions:Read and Admin:Read+Write scopes | `any` | n/a | yes |
61+
| <a name="input_github_config_url"></a> [github\_config\_url](#input\_github\_config\_url) | Github URL where runners should register to. Format https://<GitHub host>/<your\_enterprise/org/repo> | `any` | n/a | yes |
6262

6363
## Outputs
6464

modules/elastic-container-service/cdk.tf.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
"uniqueId": "aws_AutoscalerTaskDefinition_24A76F67"
116116
}
117117
},
118-
"container_definitions": "${jsonencode([{\"name\" = \"autoscaler\", \"image\" = \"ghcr.io/hi-fi/gha-runners-on-managed-env:test\", \"essential\" = true, \"environment\" = [{\"name\" = \"PAT\", \"value\" = var.aws_PAT_4017AC3F}, {\"name\" = \"GITHUB_CONFIG_URL\", \"value\" = var.aws_github_config_url_BFDD14B2}, {\"name\" = \"TASK_DEFINITION_ARN\", \"value\" = aws_ecs_task_definition.aws_RunnerTaskDefinition_9C7563BE.arn}, {\"name\" = \"ECS_CLUSTER\", \"value\" = aws_ecs_cluster.aws_Cluster_BA268616.arn}, {\"name\" = \"ECS_SUBNETS\", \"value\" = join(\",\", data.aws_subnets.aws_Subnets_75E5377D.ids)}, {\"name\" = \"ECS_SECURITY_GROUPS\", \"value\" = join(\",\", data.aws_security_groups.aws_SecurityGroups_BAABB08D.ids)}, {\"name\" = \"SCALE_SET_NAME\", \"value\" = \"ecs-runner-set\"}], \"logConfiguration\" = {\"logDriver\" = \"awslogs\", \"options\" = {\"awslogs-group\" = aws_cloudwatch_log_group.aws_AutoscalerLogGroup_BFE58053.name, \"awslogs-region\" = data.aws_region.aws_Region_7477CA06.name, \"awslogs-stream-prefix\" = \"ecs\"}}}])}",
118+
"container_definitions": "${jsonencode([{\"name\" = \"autoscaler\", \"image\" = \"ghcr.io/hi-fi/gha-runners-on-managed-env:test\", \"essential\" = true, \"environment\" = [{\"name\" = \"PAT\", \"value\" = var.PAT}, {\"name\" = \"GITHUB_CONFIG_URL\", \"value\" = var.github_config_url}, {\"name\" = \"TASK_DEFINITION_ARN\", \"value\" = aws_ecs_task_definition.aws_RunnerTaskDefinition_9C7563BE.arn}, {\"name\" = \"ECS_CLUSTER\", \"value\" = aws_ecs_cluster.aws_Cluster_BA268616.arn}, {\"name\" = \"ECS_SUBNETS\", \"value\" = join(\",\", data.aws_subnets.aws_Subnets_75E5377D.ids)}, {\"name\" = \"ECS_SECURITY_GROUPS\", \"value\" = join(\",\", data.aws_security_groups.aws_SecurityGroups_BAABB08D.ids)}, {\"name\" = \"SCALE_SET_NAME\", \"value\" = \"ecs-runner-set\"}], \"logConfiguration\" = {\"logDriver\" = \"awslogs\", \"options\" = {\"awslogs-group\" = aws_cloudwatch_log_group.aws_AutoscalerLogGroup_BFE58053.name, \"awslogs-region\" = data.aws_region.aws_Region_7477CA06.name, \"awslogs-stream-prefix\" = \"ecs\"}}}])}",
119119
"cpu": "256",
120120
"execution_role_arn": "${aws_iam_role.aws_TaskExecutionRole_FAB64402.arn}",
121121
"family": "Autoscaler",
@@ -301,12 +301,12 @@
301301
}
302302
},
303303
"variable": {
304-
"aws_PAT_4017AC3F": {
304+
"PAT": {
305305
"description": "Github PAT with Actions:Read and Admin:Read+Write scopes",
306306
"nullable": false,
307307
"sensitive": true
308308
},
309-
"aws_github_config_url_BFDD14B2": {
309+
"github_config_url": {
310310
"description": "Github URL where runners should register to. Format https://<GitHub host>/<your_enterprise/org/repo>",
311311
"nullable": false
312312
}

modules/google-cloud-run/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ No modules.
5353

5454
| Name | Description | Type | Default | Required |
5555
|------|-------------|------|---------|:--------:|
56-
| <a name="input_cr_PAT_DD795492"></a> [cr\_PAT\_DD795492](#input\_cr\_PAT\_DD795492) | Github PAT with Actions:Read and Admin:Read+Write scopes | `any` | n/a | yes |
57-
| <a name="input_cr_github_config_url_9957B21B"></a> [cr\_github\_config\_url\_9957B21B](#input\_cr\_github\_config\_url\_9957B21B) | Github URL where runners should register to. Format https://<GitHub host>/<your\_enterprise/org/repo> | `any` | n/a | yes |
56+
| <a name="input_PAT"></a> [PAT](#input\_PAT) | Github PAT with Actions:Read and Admin:Read+Write scopes | `any` | n/a | yes |
57+
| <a name="input_github_config_url"></a> [github\_config\_url](#input\_github\_config\_url) | Github URL where runners should register to. Format https://<GitHub host>/<your\_enterprise/org/repo> | `any` | n/a | yes |
5858

5959
## Outputs
6060

modules/google-cloud-run/cdk.tf.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@
6666
"env": [
6767
{
6868
"name": "PAT",
69-
"value": "${var.cr_PAT_DD795492}"
69+
"value": "${var.PAT}"
7070
},
7171
{
7272
"name": "GITHUB_CONFIG_URL",
73-
"value": "${var.cr_github_config_url_9957B21B}"
73+
"value": "${var.github_config_url}"
7474
},
7575
{
7676
"name": "JOB_NAME",
@@ -342,12 +342,12 @@
342342
}
343343
},
344344
"variable": {
345-
"cr_PAT_DD795492": {
345+
"PAT": {
346346
"description": "Github PAT with Actions:Read and Admin:Read+Write scopes",
347347
"nullable": false,
348348
"sensitive": true
349349
},
350-
"cr_github_config_url_9957B21B": {
350+
"github_config_url": {
351351
"description": "Github URL where runners should register to. Format https://<GitHub host>/<your_enterprise/org/repo>",
352352
"nullable": false
353353
}

0 commit comments

Comments
 (0)