From dc234233e0dfbb5a05acd63c336842f9f9f9457a Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Mon, 3 Aug 2026 00:10:31 +1000 Subject: [PATCH] Add terraform-ipam CI Vault access Grant the terraform-ipam Woodpecker pipeline the same Vault footprint as the other terraform-* runners, plus a KV read for its provider tokens: - k8s auth role woodpecker_terraform_ipam (SA terraform-ipam / woodpecker ns) - consul secret backend role + ACL policy writing infra/terraform/ipam/* - consul creds read policy - kv read policy for kv/service/terraform/ipam (netbox_token + kea_token) Claude-Session: https://claude.ai/code/session_01JUoARVdmhxKQHyyyp1pxeT --- .../k8s/au/syd1/woodpecker_terraform_ipam.yaml | 7 +++++++ .../consul_root/au/syd1/terraform-ipam.yaml | 5 +++++ .../consul_root/au/syd1/creds/terraform-ipam.yaml | 11 +++++++++++ policies/kv/service/terraform/ipam.yaml | 13 +++++++++++++ .../consul_root/au/syd1/terraform-ipam.hcl | 7 +++++++ 5 files changed, 43 insertions(+) create mode 100644 config/auth_kubernetes_role/k8s/au/syd1/woodpecker_terraform_ipam.yaml create mode 100644 config/consul_secret_backend_role/consul_root/au/syd1/terraform-ipam.yaml create mode 100644 policies/consul_root/au/syd1/creds/terraform-ipam.yaml create mode 100644 policies/kv/service/terraform/ipam.yaml create mode 100644 resources/secret_backend/consul_root/au/syd1/terraform-ipam.hcl diff --git a/config/auth_kubernetes_role/k8s/au/syd1/woodpecker_terraform_ipam.yaml b/config/auth_kubernetes_role/k8s/au/syd1/woodpecker_terraform_ipam.yaml new file mode 100644 index 0000000..b2f6011 --- /dev/null +++ b/config/auth_kubernetes_role/k8s/au/syd1/woodpecker_terraform_ipam.yaml @@ -0,0 +1,7 @@ +bound_service_account_names: + - terraform-ipam +bound_service_account_namespaces: + - woodpecker +token_ttl: 600 +token_max_ttl: 600 +audience: https://kubernetes.default.svc.cluster.local diff --git a/config/consul_secret_backend_role/consul_root/au/syd1/terraform-ipam.yaml b/config/consul_secret_backend_role/consul_root/au/syd1/terraform-ipam.yaml new file mode 100644 index 0000000..c5d82f8 --- /dev/null +++ b/config/consul_secret_backend_role/consul_root/au/syd1/terraform-ipam.yaml @@ -0,0 +1,5 @@ +consul_roles: + - terraform-ipam +ttl: 120 +max_ttl: 300 +datacenters: [] diff --git a/policies/consul_root/au/syd1/creds/terraform-ipam.yaml b/policies/consul_root/au/syd1/creds/terraform-ipam.yaml new file mode 100644 index 0000000..b6e25b6 --- /dev/null +++ b/policies/consul_root/au/syd1/creds/terraform-ipam.yaml @@ -0,0 +1,11 @@ +--- +rules: + - path: "consul_root/au/syd1/creds/terraform-ipam" + capabilities: + - read + +auth: + approle: + - terraform_ipam + k8s/au/syd1: + - woodpecker_terraform_ipam diff --git a/policies/kv/service/terraform/ipam.yaml b/policies/kv/service/terraform/ipam.yaml new file mode 100644 index 0000000..7572a05 --- /dev/null +++ b/policies/kv/service/terraform/ipam.yaml @@ -0,0 +1,13 @@ +# Allow the Terraform IPAM runner to read the NetBox + KeaAPI tokens +# (netbox_token / kea_token fields) used by the netbox and kea providers. +--- +rules: + - path: "kv/data/service/terraform/ipam" + capabilities: + - read + +auth: + approle: + - terraform_ipam + k8s/au/syd1: + - woodpecker_terraform_ipam diff --git a/resources/secret_backend/consul_root/au/syd1/terraform-ipam.hcl b/resources/secret_backend/consul_root/au/syd1/terraform-ipam.hcl new file mode 100644 index 0000000..6f94b75 --- /dev/null +++ b/resources/secret_backend/consul_root/au/syd1/terraform-ipam.hcl @@ -0,0 +1,7 @@ +key_prefix "infra/terraform/ipam/" { + policy = "write" +} + +session_prefix "" { + policy = "write" +} -- 2.47.3