Skip to content

Fix tf format and add Editor config #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# Override for Makefile
[{Makefile,makefile,GNUmakefile}]
indent_style = tab
indent_size = 4

[Makefile.*]
indent_style = tab
indent_size = 4

[{*.yaml,*.yml,*.md}]
indent_style = space
indent_size = 2

[*.sh]
indent_style = tab
indent_size = 2

[*.{tf,tfvars,tpl,variant}]
indent_style = space
indent_size = 2

[*.json]
insert_final_newline = false
2 changes: 1 addition & 1 deletion .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"extends": [
"config:base"
]
}
}
1 change: 1 addition & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ repository:
description: This component is responsible for provisioning EC2 instances for GitHub runners
homepage: https://cloudposse.com/accelerate
topics: terraform, terraform-component

30 changes: 15 additions & 15 deletions README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions README.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ description: |-
#### Workflow Permissions

1. Browse to
[https://github.com/organizations/{Org}/settings/actions](https://github.com/organizations/{Org}/settings/actions)
(Organization) or
[https://github.com/{Org}/{Repo}/settings/actions](https://github.com/{Org}/{Repo}/settings/actions) (Repository)
[https://github.com/organizations/{Org}/settings/actions](https://github.com/organizations/{Org}/settings/actions)
(Organization) or
[https://github.com/{Org}/{Repo}/settings/actions](https://github.com/{Org}/{Repo}/settings/actions) (Repository)

2. Set the default permissions for the GITHUB_TOKEN to Read Only

Expand Down Expand Up @@ -217,10 +217,10 @@ description: |-
and skip the rest. Otherwise, complete the private key setup in `core-<default-region>-auto`.

1. Convert the private key to a PEM file using the following command:
`openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in {DOWNLOADED_FILE_NAME}.pem -out private-key-pkcs8.key`
`openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in {DOWNLOADED_FILE_NAME}.pem -out private-key-pkcs8.key`
1. Upload PEM file key to the specified ssm path: `/github/runners/acme/private-key` in `core-<default-region>-auto`
1. Create another sensitive SSM parameter `/github/runners/acme/registration-token` in `core-<default-region>-auto` with
any basic value, such as "foo". This will be overwritten by the rotator.
any basic value, such as "foo". This will be overwritten by the rotator.
1. Update the GitHub App ID and Installation ID in the `github-action-token-rotator` catalog.

> [!TIP]
Expand All @@ -230,21 +230,21 @@ description: |-
#### (ClickOps) Obtain the Runner Registration Token

1. Browse to
[https://github.com/organizations/{Org}/settings/actions/runners](https://github.com/organizations/{Org}/settings/actions/runners)
(Organization) or
[https://github.com/{Org}/{Repo}/settings/actions/runners](https://github.com/{Org}/{Repo}/settings/actions/runners)
(Repository)
[https://github.com/organizations/{Org}/settings/actions/runners](https://github.com/organizations/{Org}/settings/actions/runners)
(Organization) or
[https://github.com/{Org}/{Repo}/settings/actions/runners](https://github.com/{Org}/{Repo}/settings/actions/runners)
(Repository)

2. Click the **New Runner** button (Organization) or **New Self Hosted Runner** button (Repository)

3. Copy the Github Runner token from the next screen. Note that this is the only time you will see this token. Note that
if you exit the `New {Self Hosted} Runner` screen and then later return by clicking the `New {Self Hosted} Runner`
button again, the registration token will be invalidated and a new token will be generated.
if you exit the `New {Self Hosted} Runner` screen and then later return by clicking the `New {Self Hosted} Runner`
button again, the registration token will be invalidated and a new token will be generated.

<img src="/assets/refarch/cleanshot-2022-03-01-at-16.12.26-20220302-005927.png" height="1010" width="833" /><br/>

4. Add the `REGISTRATION_TOKEN` to the `/github/token` SSM parameter in the account where Github runners are hosted
(usually `automation`), encrypted with KMS.
(usually `automation`), encrypted with KMS.

```
chamber write github token <value>
Expand All @@ -262,11 +262,11 @@ description: |-
following tips:

1. The private key is stored at the given parameter path:
`parameter_store_private_key_path: /github/runners/acme/private-key`
`parameter_store_private_key_path: /github/runners/acme/private-key`
1. The private key is Base 64 encoded. If you pull the key from SSM and decode it, it should begin with
`-----BEGIN PRIVATE KEY-----`
`-----BEGIN PRIVATE KEY-----`
1. If the private key has changed, you must _redeploy_ `github-action-token-rotator`. Run a plan against the component
to make sure there are not changes required.
to make sure there are not changes required.

## The GitHub Registration Token is valid, but the Runners are not registering with GitHub

Expand Down
1 change: 1 addition & 0 deletions docs/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

30 changes: 15 additions & 15 deletions src/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/context.tf
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ variable "descriptor_formats" {
Describe additional descriptors to be output in the `descriptors` output map.
Map of maps. Keys are names of descriptors. Values are maps of the form
`{
format = string
labels = list(string)
format = string
labels = list(string)
}`
(Type is `any` so the map values can later be enhanced to provide additional options.)
`format` is a Terraform format string to be passed to the `format()` function.
Expand Down
4 changes: 2 additions & 2 deletions src/modules/graceful_scale_in/context.tf
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ variable "descriptor_formats" {
Describe additional descriptors to be output in the `descriptors` output map.
Map of maps. Keys are names of descriptors. Values are maps of the form
`{
format = string
labels = list(string)
format = string
labels = list(string)
}`
(Type is `any` so the map values can later be enhanced to provide additional options.)
`format` is a Terraform format string to be passed to the `format()` function.
Expand Down
2 changes: 1 addition & 1 deletion src/templates/amazon-cloudwatch-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@
},
"force_flush_interval": 15
}
}
}
20 changes: 10 additions & 10 deletions src/templates/create-latest-svc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ runner_plat=linux

function fatal()
{
echo "error: $1" >&2
exit 1
echo "error: $1" >&2
exit 1
}

if [ -z "${runner_scope}" ]; then fatal "supply scope as argument 1"; fi
Expand All @@ -40,7 +40,7 @@ which jq || fatal "jq required. Please install in PATH with apt-get, brew, etc"

# bail early if there's already a runner there. also sudo early
if [ -d ./runner ]; then
fatal "Runner already exists. Use a different directory or delete ./runner"
fatal "Runner already exists. Use a different directory or delete ./runner"
fi

sudo -u ${svc_user} mkdir runner
Expand Down Expand Up @@ -68,14 +68,14 @@ latest_version=$(echo ${latest_version_label:1})
runner_file="actions-runner-${runner_plat}-x64-${latest_version}.tar.gz"

if [ -f "${runner_file}" ]; then
echo "${runner_file} exists. skipping download."
echo "${runner_file} exists. skipping download."
else
runner_url="https://github.com/actions/runner/releases/download/${latest_version_label}/${runner_file}"
runner_url="https://github.com/actions/runner/releases/download/${latest_version_label}/${runner_file}"

echo "Downloading ${latest_version_label} for ${runner_plat} ..."
echo $runner_url
echo "Downloading ${latest_version_label} for ${runner_plat} ..."
echo $runner_url

curl -O -L ${runner_url}
curl -O -L ${runner_url}
fi

ls -la *.tar.gz
Expand All @@ -98,7 +98,7 @@ pushd ./runner
#---------------------------------------
runner_url="https://github.com/${runner_scope}"
if [ -n "${ghe_hostname}" ]; then
runner_url="https://${ghe_hostname}/${runner_scope}"
runner_url="https://${ghe_hostname}/${runner_scope}"
fi

echo
Expand All @@ -113,7 +113,7 @@ echo
echo "Configuring as a service ..."
prefix=""
if [ "${runner_plat}" == "linux" ]; then
prefix="sudo "
prefix="sudo "
fi

${prefix}./svc.sh install ${svc_user}
Expand Down
Loading