Skip to content

Commit 18bcadf

Browse files
committed
ci: add collect-modules action
1 parent 81c7022 commit 18bcadf

File tree

5 files changed

+86
-2
lines changed

5 files changed

+86
-2
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Find modules in the repository
2+
description: >
3+
Looks for modules in the repository and outputs their paths.
4+
5+
outputs:
6+
tf-modules:
7+
description: Paths to the Terraform modules found in the repository
8+
value: ${{ steps.find-modules.outputs.tf-modules }}
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- name: Find modules
14+
id: find-modules
15+
run: |
16+
set -eu
17+
18+
tf_modules=()
19+
for module_cfg in $(find . -name .module.toml); do
20+
case $(yq -o y .module.type $module_cfg) in
21+
null)
22+
echo "Warning: module type not found in $module_cfg"
23+
continue
24+
;;
25+
terraform)
26+
echo "Found Terraform module in $module_cfg"
27+
tf_modules+=($(dirname $module_cfg))
28+
;;
29+
esac
30+
done
31+
32+
echo tf-modules=$(printf '%s\n' "${tf_modules[@]}" | jq -cnR '[inputs]') > $GITHUB_OUTPUT
33+
shell: bash

.github/workflows/ci.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ on:
66
pull_request:
77

88
jobs:
9+
collect-modules:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
tf-modules: ${{ steps.collect-modules.outputs.tf-modules }}
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: ./.github/actions/collect-modules
18+
id: collect-modules
19+
920
typos:
1021
runs-on: ubuntu-latest
1122
steps:
@@ -49,11 +60,11 @@ jobs:
4960

5061
terraform-docs:
5162
runs-on: ubuntu-latest
63+
depends-on: collect-modules
5264

5365
strategy:
5466
matrix:
55-
terraform_module:
56-
- asset-account/terraform/stack-set
67+
terraform_module: ${{fromJson(needs.collect-modules.outputs.tf-modules)}}
5768

5869
steps:
5970
- uses: actions/checkout@v4

asset-account/terraform/config.ini

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Default configuration
2+
[default]
3+
# The API host to connect to (default: api.cloudsmith.io).
4+
api_host=
5+
6+
# The API proxy to connect through (default: None).
7+
api_proxy=
8+
9+
# Whether to verify SSL connection to the API (default: True)
10+
api_ssl_verify=true
11+
12+
# The user agent to use for requests (default: calculated).
13+
api_user_agent=
14+
15+
16+
# Profile-based configuration
17+
# You can set as many additional profiles as you need to provide
18+
# for different configuration environments (e.g. prod vs staging).
19+
# Add your overrides in the sections and then specify one of:
20+
# * -P your-profile-name (as an argument)
21+
# * --profile your-profile-name (an an argument)
22+
# * CLOUDSMITH_PROFILE=your-profile-name (as an env variable)
23+
[profile:your-profile-name]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Default configuration
2+
[default]
3+
# The API key for authenticating with the API.
4+
api_key = 081f0cb15310ecc7f856ebe9f56ade9fd311f72b
5+
# Profile-based configuration
6+
# You can set as many additional profiles as you need to provide
7+
# for different configuration environments (e.g. prod vs staging).
8+
# Add your overrides in the sections and then specify one of:
9+
# * -P your-profile-name (as an argument)
10+
# * --profile your-profile-name (an an argument)
11+
# * CLOUDSMITH_PROFILE=your-profile-name (as an env variable)
12+
[profile:your-profile-name]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[module]
2+
name = "aws-elastio-asset-account-stack-set"
3+
description = "Terraform module for creating an asset account stack"
4+
type = "terraform"
5+
version = "0.33.0"

0 commit comments

Comments
 (0)