Files
terraform-git/config/config.hcl
T
unkinben fd82876f5f
ci/woodpecker/pr/plan Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
Manage Gitea users; add teabot personality bot accounts
Add a data-driven 'user' config kind so Gitea accounts are declared as
config/git.unkin.net/user/<name>.yaml, mirroring the existing repository
and team kinds. Wire the yaml into a new modules/user submodule that
creates a gitea_user (provider go-gitea/gitea 0.7.0, already pinned).

The provider's user resource requires a password; generate a per-user
random_password so nothing sensitive is hardcoded and only a placeholder
lives in state (tokens come later from vault-plugin-secrets-gitea).

Provision teabot's implementer and reviewer personality accounts with a
conservative posture: not site admins, no org creation, no repo creation,
limited profile visibility.

Claude-Session: https://claude.ai/code/session_015ur3i7D2azsMAWTSVABApv
2026-07-27 17:22:19 +10:00

67 lines
2.8 KiB
HCL

locals {
config_files = fileset(".", "**/*.yaml")
all_configs = {
for file_path in local.config_files :
file_path => yamldecode(file(file_path))
}
config = {
organisation = {
for file_path, content in local.all_configs :
trimsuffix(replace(file_path, "/config.yaml", ""), ".yaml") => merge(content, {
name = split("/", file_path)[1]
gitea_url = split("/", file_path)[0]
})
if endswith(file_path, "/config.yaml") && length(split("/", file_path)) == 3
}
repository = {
for file_path, content in local.all_configs :
"${split("/", file_path)[0]}/${split("/", file_path)[1]}/${trimsuffix(basename(file_path), ".yaml")}" => merge(content, {
name = trimsuffix(basename(file_path), ".yaml")
organisation = split("/", file_path)[1]
gitea_url = split("/", file_path)[0]
})
if length(regexall("/repository/", file_path)) > 0
}
team = {
for file_path, content in local.all_configs :
"${split("/", file_path)[0]}/${split("/", file_path)[1]}/${trimsuffix(basename(file_path), ".yaml")}" => merge(content, {
name = trimsuffix(basename(file_path), ".yaml")
organisation = split("/", file_path)[1]
gitea_url = split("/", file_path)[0]
})
if length(regexall("/team/", file_path)) > 0
}
user = {
for file_path, content in local.all_configs :
"${split("/", file_path)[0]}/${trimsuffix(basename(file_path), ".yaml")}" => merge(content, {
username = trimsuffix(basename(file_path), ".yaml")
gitea_url = split("/", file_path)[0]
})
if length(regexall("/user/", file_path)) > 0
}
branch_protection = merge([
for file_path, content in local.all_configs : {
for idx, rule in try(content.branch_protection, []) :
"${split("/", file_path)[0]}/${split("/", file_path)[1]}/${trimsuffix(basename(file_path), ".yaml")}/${rule.rule_name}" => merge(rule, {
repository = trimsuffix(basename(file_path), ".yaml")
organisation = split("/", file_path)[1]
gitea_url = split("/", file_path)[0]
})
}
if length(regexall("/repository/", file_path)) > 0
]...)
deploy_key = {
for file_path, content in local.all_configs :
"${split("/", file_path)[0]}/${split("/", file_path)[1]}/${split("/", replace(file_path, "deploy_key/", ""))[2]}/${trimsuffix(basename(file_path), ".yaml")}" => merge(content, {
title = trimsuffix(basename(file_path), ".yaml")
repository = split("/", replace(file_path, "deploy_key/", ""))[2]
organisation = split("/", file_path)[1]
gitea_url = split("/", file_path)[0]
})
if length(regexall("/deploy_key/", file_path)) > 0
}
}
}