From 219082d11fb0213d72928b270a7646a724f6592e Mon Sep 17 00:00:00 2001 From: Henry Skiba Date: Sun, 18 May 2025 09:58:38 +0800 Subject: [PATCH 1/6] Add example samconfig file and document usage --- .gitignore | 1 + README.md | 12 ++++++++++++ samconfig.toml.example | 11 +++++++++++ 3 files changed, 24 insertions(+) create mode 100644 samconfig.toml.example diff --git a/.gitignore b/.gitignore index decfcce..74a77b6 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,5 @@ bootstrap .aws-sam +# Local SAM configuration (not committed) samconfig.toml diff --git a/README.md b/README.md index dec5c97..d5a4db1 100644 --- a/README.md +++ b/README.md @@ -31,3 +31,15 @@ sam deploy \ The `ExtraRunnerLabels` parameter is optional. When supplied, the labels are added to the default runner labels. All other parameters are required and must be specified for your environment. + +## Local `samconfig.toml` + +This repository ignores `samconfig.toml` so you can maintain environment- +specific settings locally. Copy `samconfig.toml.example` to `samconfig.toml` +and adjust the values for your AWS account. Then run SAM commands with the +desired configuration environment, for example: + +```bash +sam build --config-env dev +sam deploy --config-env dev +``` diff --git a/samconfig.toml.example b/samconfig.toml.example new file mode 100644 index 0000000..557d089 --- /dev/null +++ b/samconfig.toml.example @@ -0,0 +1,11 @@ +version = 0.1 + +[dev.deploy.parameters] +stack_name = "autoscaler-dev" +region = "us-east-2" +parameter_overrides = "GitHubPATSecretName=my-dev-secret ExtraRunnerLabels=dev ImageId=ami-1234567890 SubnetId=subnet-123456 SecurityGroupIds=sg-123456 KeyName=dev-key" + +[prod.deploy.parameters] +stack_name = "autoscaler-prod" +region = "us-east-2" +parameter_overrides = "GitHubPATSecretName=my-prod-secret ExtraRunnerLabels=prod ImageId=ami-abcdef0123 SubnetId=subnet-abcdef SecurityGroupIds=sg-abcdef KeyName=prod-key" From be319a19e84b8d0d431beb7857263420da14f3d9 Mon Sep 17 00:00:00 2001 From: Henry Skiba Date: Sun, 18 May 2025 10:04:44 +0800 Subject: [PATCH 2/6] update defaults for example --- samconfig.example.toml | 24 ++++++++++++++++++++++++ samconfig.toml.example | 11 ----------- 2 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 samconfig.example.toml delete mode 100644 samconfig.toml.example diff --git a/samconfig.example.toml b/samconfig.example.toml new file mode 100644 index 0000000..8a84526 --- /dev/null +++ b/samconfig.example.toml @@ -0,0 +1,24 @@ +version = 0.1 + +[default.deploy.parameters] +stack_name = "github-runner-autoscaler" +region = "us-east-2" +resolve_s3 = true +s3_prefix = "github-runner-autoscaler" +[default.deploy.parameters.parameter_overrides] +ImageId = "ami-0c0c88099397fccb4" +GitHubPATSecretName = "github-runner-autoscaler-pat" + +[dev.deploy.parameters] +[dev.deploy.parameters.parameter_overrides] +ExtraRunnerLabels = "dev" +SubnetId = "subnet-12345678" +SecurityGroupIds = "sg-12345678" +KeyName = "terraform-20220125192645402400000001" + +[prod.deploy.parameters] +[prod.deploy.parameters.parameter_overrides] +ExtraRunnerLabels = "dev" +SubnetId = "subnet-98765432" +SecurityGroupIds = "sg-98765432" +KeyName = "terraform-20220125192645402400000002" diff --git a/samconfig.toml.example b/samconfig.toml.example deleted file mode 100644 index 557d089..0000000 --- a/samconfig.toml.example +++ /dev/null @@ -1,11 +0,0 @@ -version = 0.1 - -[dev.deploy.parameters] -stack_name = "autoscaler-dev" -region = "us-east-2" -parameter_overrides = "GitHubPATSecretName=my-dev-secret ExtraRunnerLabels=dev ImageId=ami-1234567890 SubnetId=subnet-123456 SecurityGroupIds=sg-123456 KeyName=dev-key" - -[prod.deploy.parameters] -stack_name = "autoscaler-prod" -region = "us-east-2" -parameter_overrides = "GitHubPATSecretName=my-prod-secret ExtraRunnerLabels=prod ImageId=ami-abcdef0123 SubnetId=subnet-abcdef SecurityGroupIds=sg-abcdef KeyName=prod-key" From 863014c78a4dbacbf13f9fafae0e3f1cfe1b6968 Mon Sep 17 00:00:00 2001 From: Henry Skiba Date: Sun, 18 May 2025 10:19:25 +0800 Subject: [PATCH 3/6] remove parameter blocks (only do overrides) --- samconfig.example.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/samconfig.example.toml b/samconfig.example.toml index 8a84526..01650ec 100644 --- a/samconfig.example.toml +++ b/samconfig.example.toml @@ -9,14 +9,12 @@ s3_prefix = "github-runner-autoscaler" ImageId = "ami-0c0c88099397fccb4" GitHubPATSecretName = "github-runner-autoscaler-pat" -[dev.deploy.parameters] [dev.deploy.parameters.parameter_overrides] ExtraRunnerLabels = "dev" SubnetId = "subnet-12345678" SecurityGroupIds = "sg-12345678" KeyName = "terraform-20220125192645402400000001" -[prod.deploy.parameters] [prod.deploy.parameters.parameter_overrides] ExtraRunnerLabels = "dev" SubnetId = "subnet-98765432" From 57416f684692a5173202bf6e0ccd17c76a613446 Mon Sep 17 00:00:00 2001 From: Henry Skiba Date: Sun, 18 May 2025 10:27:22 +0800 Subject: [PATCH 4/6] update example --- samconfig.example.toml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/samconfig.example.toml b/samconfig.example.toml index 01650ec..ed85bad 100644 --- a/samconfig.example.toml +++ b/samconfig.example.toml @@ -5,18 +5,10 @@ stack_name = "github-runner-autoscaler" region = "us-east-2" resolve_s3 = true s3_prefix = "github-runner-autoscaler" -[default.deploy.parameters.parameter_overrides] -ImageId = "ami-0c0c88099397fccb4" +capabilities = "CAPABILITY_IAM" GitHubPATSecretName = "github-runner-autoscaler-pat" - -[dev.deploy.parameters.parameter_overrides] -ExtraRunnerLabels = "dev" -SubnetId = "subnet-12345678" -SecurityGroupIds = "sg-12345678" -KeyName = "terraform-20220125192645402400000001" - -[prod.deploy.parameters.parameter_overrides] -ExtraRunnerLabels = "dev" -SubnetId = "subnet-98765432" -SecurityGroupIds = "sg-98765432" -KeyName = "terraform-20220125192645402400000002" +ExtraRunnerLabels = "example" +ImageId = "ami-0c0c88099397fccb4" +SubnetId = "subnet-1234567890def" +SecurityGroupIds = "sg-1234567890def" +KeyName = "terraform-20250518" From 46915e7967f17a6e993a83a8f62749815e86dc4e Mon Sep 17 00:00:00 2001 From: Henry Skiba Date: Sun, 18 May 2025 10:48:20 +0800 Subject: [PATCH 5/6] switch to yaml for samconfig --- .gitignore | 1 + samconfig.example.toml | 14 -------------- samconfig.example.yaml | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 14 deletions(-) delete mode 100644 samconfig.example.toml create mode 100644 samconfig.example.yaml diff --git a/.gitignore b/.gitignore index 74a77b6..2c7b5f8 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ bootstrap # Local SAM configuration (not committed) samconfig.toml +samconfig.yaml diff --git a/samconfig.example.toml b/samconfig.example.toml deleted file mode 100644 index ed85bad..0000000 --- a/samconfig.example.toml +++ /dev/null @@ -1,14 +0,0 @@ -version = 0.1 - -[default.deploy.parameters] -stack_name = "github-runner-autoscaler" -region = "us-east-2" -resolve_s3 = true -s3_prefix = "github-runner-autoscaler" -capabilities = "CAPABILITY_IAM" -GitHubPATSecretName = "github-runner-autoscaler-pat" -ExtraRunnerLabels = "example" -ImageId = "ami-0c0c88099397fccb4" -SubnetId = "subnet-1234567890def" -SecurityGroupIds = "sg-1234567890def" -KeyName = "terraform-20250518" diff --git a/samconfig.example.yaml b/samconfig.example.yaml new file mode 100644 index 0000000..28ccb9e --- /dev/null +++ b/samconfig.example.yaml @@ -0,0 +1,16 @@ +version: 0.1 +vor_stream_sdlc: + deploy: + parameters: + stack_name: github-runner-autoscaler + region: us-east-2 + resolve_s3: true + s3_prefix: github-runner-autoscaler + capabilities: CAPABILITY_IAM + parameter_overrides: + - GitHubPATSecretName=github-runner-autoscaler-pat + - ExtraRunnerLabels=vor-stream-sdlc + - ImageId=ami-0c0c88099397fccb4 + - SubnetId=subnet-0eb6da43c6f0ef528 + - SecurityGroupIds=sg-0f185b577cb2b2802 + - KeyName=terraform-20220125192645402400000001 From 753993667b4bd9e9ef283d349194f33e9e158b75 Mon Sep 17 00:00:00 2001 From: Henry Skiba Date: Sun, 18 May 2025 10:55:24 +0800 Subject: [PATCH 6/6] updates to tempalte --- README.md | 8 ++++---- samconfig.example.yaml | 25 ++++++++++++++++++++----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index d5a4db1..38c72da 100644 --- a/README.md +++ b/README.md @@ -34,10 +34,10 @@ be specified for your environment. ## Local `samconfig.toml` -This repository ignores `samconfig.toml` so you can maintain environment- -specific settings locally. Copy `samconfig.toml.example` to `samconfig.toml` -and adjust the values for your AWS account. Then run SAM commands with the -desired configuration environment, for example: +This repository ignores `samconfig.toml` and `samconfig.yaml` so you can +maintain environment-specific settings locally. Copy `samconfig.example.yaml` +to `samconfig.yaml` and adjust the values for your AWS account. Then run SAM +commands with the desired configuration environment, for example: ```bash sam build --config-env dev diff --git a/samconfig.example.yaml b/samconfig.example.yaml index 28ccb9e..607513d 100644 --- a/samconfig.example.yaml +++ b/samconfig.example.yaml @@ -1,5 +1,5 @@ version: 0.1 -vor_stream_sdlc: +dev: deploy: parameters: stack_name: github-runner-autoscaler @@ -9,8 +9,23 @@ vor_stream_sdlc: capabilities: CAPABILITY_IAM parameter_overrides: - GitHubPATSecretName=github-runner-autoscaler-pat - - ExtraRunnerLabels=vor-stream-sdlc + - ExtraRunnerLabels=dev - ImageId=ami-0c0c88099397fccb4 - - SubnetId=subnet-0eb6da43c6f0ef528 - - SecurityGroupIds=sg-0f185b577cb2b2802 - - KeyName=terraform-20220125192645402400000001 + - SubnetId=subnet-0123456789def + - SecurityGroupIds=sg-0123456789def + - KeyName=terraform-2025051802 +prod: + deploy: + parameters: + stack_name: github-runner-autoscaler + region: us-east-2 + resolve_s3: true + s3_prefix: github-runner-autoscaler + capabilities: CAPABILITY_IAM + parameter_overrides: + - GitHubPATSecretName=github-runner-autoscaler-pat + - ExtraRunnerLabels=prod + - ImageId=ami-0c0c88099397fccb4 + - SubnetId=subnet-0123456789def + - SecurityGroupIds=sg-0123456789def + - KeyName=terraform-2025051801