Skip to content

Commit 4965d06

Browse files
authored
Merge pull request #2518 from philips-labs/develop
chore: Release
2 parents 3f9fd74 + cd9b9b1 commit 4965d06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1316
-1022
lines changed

MAINTAINERS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
Gertjan Maas <gertjan.maas@philips.com>
1+
Navdeep Gupta <navdeep.gupta@philips.com>
22
Niek Palm <[email protected]>
3+
Scott Guymer <[email protected]>

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ This [Terraform](https://www.terraform.io/) module creates the required infrastr
2626
- [Sub modules](#sub-modules)
2727
- [ARM64 configuration for submodules](#arm64-configuration-for-submodules)
2828
- [Debugging](#debugging)
29+
- [Security Consideration](#security-consideration)
2930
- [Requirements](#requirements)
3031
- [Providers](#providers)
3132
- [Modules](#modules)
@@ -352,6 +353,14 @@ In case the setup does not work as intended follow the trace of events:
352353
- Once an EC2 instance is running, you can connect to it in the EC2 user interface using Session Manager (use `enable_ssm_on_runners = true`). Check the user data script using `cat /var/log/user-data.log`. By default several log files of the instances are streamed to AWS CloudWatch, look for a log group named `<environment>/runners`. In the log group you should see at least the log streams for the user data installation and runner agent.
353354
- Registered instances should show up in the Settings - Actions page of the repository or organization (depending on the installation mode).
354355

356+
## Security Consideration
357+
358+
This module creates resources in your AWS infrastructure, and EC2 instances for hosting the self-hosted runners on-demand. IAM permissions are set to a minimal level, and could be further limit by using permission boundaries. Instances permissions are limit to retrieve and delete the registration token, access the instance own tags, and terminate the instance itself.
359+
360+
The examples are using standard AMI's for different operation systems. Instances are not hardened, and sudo operation are not blocked. To provide an out of the box working expierence by default the module installs and configure the runner. However secrets are not hard coded, they finally end up in the memory of the instances. You can harden the instance by providing your own AMI and overwriting the cloud-init script.
361+
362+
We welcome any improvement to the standard module to make the default as secure as possible, in the end it remains your responsibility to keep your environment secure.
363+
355364
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
356365
## Requirements
357366

@@ -380,7 +389,6 @@ In case the setup does not work as intended follow the trace of events:
380389

381390
| Name | Type |
382391
|------|------|
383-
| [aws_resourcegroups_group.resourcegroups_group](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/resourcegroups_group) | resource |
384392
| [aws_sqs_queue.queued_builds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sqs_queue) | resource |
385393
| [aws_sqs_queue.queued_builds_dlq](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sqs_queue) | resource |
386394
| [aws_sqs_queue_policy.build_queue_dlq_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sqs_queue_policy) | resource |
@@ -409,6 +417,7 @@ In case the setup does not work as intended follow the trace of events:
409417
| <a name="input_enable_runner_binaries_syncer"></a> [enable\_runner\_binaries\_syncer](#input\_enable\_runner\_binaries\_syncer) | Option to disable the lambda to sync GitHub runner distribution, useful when using a pre-build AMI. | `bool` | `true` | no |
410418
| <a name="input_enable_runner_detailed_monitoring"></a> [enable\_runner\_detailed\_monitoring](#input\_enable\_runner\_detailed\_monitoring) | Should detailed monitoring be enabled for the runner. Set this to true if you want to use detailed monitoring. See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-cloudwatch-new.html for details. | `bool` | `false` | no |
411419
| <a name="input_enable_ssm_on_runners"></a> [enable\_ssm\_on\_runners](#input\_enable\_ssm\_on\_runners) | Enable to allow access the runner instances for debugging purposes via SSM. Note that this adds additional permissions to the runner instances. | `bool` | `false` | no |
420+
| <a name="input_enable_user_data_debug_logging_runner"></a> [enable\_user\_data\_debug\_logging\_runner](#input\_enable\_user\_data\_debug\_logging\_runner) | Option to enable debug logging for user-data, this logs all secrets as well. | `bool` | `false` | no |
412421
| <a name="input_enabled_userdata"></a> [enabled\_userdata](#input\_enabled\_userdata) | Should the userdata script be enabled for the runner. Set this to false if you are using your own prebuilt AMI. | `bool` | `true` | no |
413422
| <a name="input_environment"></a> [environment](#input\_environment) | A name that identifies the environment, used as prefix and for tagging. | `string` | `null` | no |
414423
| <a name="input_fifo_build_queue"></a> [fifo\_build\_queue](#input\_fifo\_build\_queue) | Enable a FIFO queue to remain the order of events received by the webhook. Suggest to set to true for repo level runners. | `bool` | `false` | no |
@@ -451,9 +460,9 @@ In case the setup does not work as intended follow the trace of events:
451460
| <a name="input_runner_allow_prerelease_binaries"></a> [runner\_allow\_prerelease\_binaries](#input\_runner\_allow\_prerelease\_binaries) | (Deprecated, no longer used), allow the runners to update to prerelease binaries. | `bool` | `null` | no |
452461
| <a name="input_runner_architecture"></a> [runner\_architecture](#input\_runner\_architecture) | The platform architecture of the runner instance\_type. | `string` | `"x64"` | no |
453462
| <a name="input_runner_as_root"></a> [runner\_as\_root](#input\_runner\_as\_root) | Run the action runner under the root user. Variable `runner_run_as` will be ignored. | `bool` | `false` | no |
463+
| <a name="input_runner_binaries_s3_logging_bucket"></a> [runner\_binaries\_s3\_logging\_bucket](#input\_runner\_binaries\_s3\_logging\_bucket) | Bucket for action runner distribution bucket access logging. | `string` | `null` | no |
464+
| <a name="input_runner_binaries_s3_logging_bucket_prefix"></a> [runner\_binaries\_s3\_logging\_bucket\_prefix](#input\_runner\_binaries\_s3\_logging\_bucket\_prefix) | Bucket prefix for action runner distribution bucket access logging. | `string` | `null` | no |
454465
| <a name="input_runner_binaries_s3_sse_configuration"></a> [runner\_binaries\_s3\_sse\_configuration](#input\_runner\_binaries\_s3\_sse\_configuration) | Map containing server-side encryption configuration for runner-binaries S3 bucket. | `any` | `{}` | no |
455-
| <a name="input_runner_binaries_s3_logging_bucket"></a> [runner\_binaries\_s3\_logging\_bucket](#input\_runner\_binaries\_s3\_logging\_bucket) | Bucket for action runner distribution bucket access logging. | `string` | `null` | no |
456-
| <a name="input_runner_binaries_s3_logging_bucket_prefix"></a> [runner\_binaries\_s3\_logging\_bucket\_prefix](#input\_runner\_binaries\_s3\logging\_bucket\_prefix) | Bucket prefix for action runner distribution bucket access logging. | `string` | `null` | no |
457466
| <a name="input_runner_binaries_syncer_lambda_timeout"></a> [runner\_binaries\_syncer\_lambda\_timeout](#input\_runner\_binaries\_syncer\_lambda\_timeout) | Time out of the binaries sync lambda in seconds. | `number` | `300` | no |
458467
| <a name="input_runner_binaries_syncer_lambda_zip"></a> [runner\_binaries\_syncer\_lambda\_zip](#input\_runner\_binaries\_syncer\_lambda\_zip) | File location of the binaries sync lambda zip file. | `string` | `null` | no |
459468
| <a name="input_runner_boot_time_in_minutes"></a> [runner\_boot\_time\_in\_minutes](#input\_runner\_boot\_time\_in\_minutes) | The minimum time for an EC2 runner to boot and register as a runner. | `number` | `5` | no |

examples/base/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
resource "aws_resourcegroups_group" "resourcegroups_group" {
2+
name = "${var.prefix}-group"
3+
resource_query {
4+
query = templatefile("${path.module}/templates/resource-group.json", {
5+
example = var.prefix
6+
})
7+
}
8+
}

examples/base/outputs.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "vpc" {
2+
value = module.vpc
3+
}

templates/resource-group.json renamed to examples/base/templates/resource-group.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"ResourceTypeFilters": ["AWS::AllSupported"],
33
"TagFilters": [
44
{
5-
"Key": "Environment",
6-
"Values": ["${environment}"]
5+
"Key": "Example",
6+
"Values": ["${example}"]
77
}
88
]
99
}

examples/base/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
variable "prefix" {
2+
description = "Prefix used for resource naming."
3+
type = string
4+
}
5+
6+
variable "aws_region" {
7+
description = "AWS region to create the VPC, assuming zones `a` and `b` exists."
8+
type = string
9+
}

examples/base/vpc.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module "vpc" {
2+
source = "terraform-aws-modules/vpc/aws"
3+
version = "3.16.0"
4+
5+
name = "${var.prefix}-vpc"
6+
cidr = "10.0.0.0/16"
7+
8+
azs = ["${var.aws_region}a", "${var.aws_region}b"]
9+
private_subnets = ["10.0.1.0/24", "10.0.2.0/24"]
10+
public_subnets = ["10.0.101.0/24", "10.0.102.0/24"]
11+
12+
enable_dns_hostnames = true
13+
enable_nat_gateway = true
14+
map_public_ip_on_launch = false
15+
single_nat_gateway = true
16+
}

examples/default/main.tf

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,19 @@ resource "random_id" "random" {
77
byte_length = 20
88
}
99

10+
module "base" {
11+
source = "../base"
1012

11-
################################################################################
12-
### Hybrid account
13-
################################################################################
13+
prefix = local.environment
14+
aws_region = local.aws_region
15+
}
1416

1517
module "runners" {
1618
source = "../../"
1719
create_service_linked_role_spot = true
1820
aws_region = local.aws_region
19-
vpc_id = module.vpc.vpc_id
20-
subnet_ids = module.vpc.private_subnets
21+
vpc_id = module.base.vpc.vpc_id
22+
subnet_ids = module.base.vpc.private_subnets
2123

2224
prefix = local.environment
2325
tags = {

examples/default/providers.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
provider "aws" {
22
region = local.aws_region
3+
4+
default_tags {
5+
tags = {
6+
Example = local.environment
7+
}
8+
}
39
}

examples/default/vpc.tf

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)