Skip to content

terraform-aws-signing-kms

A small, focused OpenTofu / Terraform module that provisions an AWS KMS asymmetric signing key plus an IAM role assumable from an external OIDC IDP (default: GitLab.com). Built for release-binary signing chains where:

  • The private key never leaves AWS KMS.
  • No long-lived credential can sign: only the CI job whose OIDC sub claim matches a caller-supplied pattern. The key policy denies signing to every other principal, the account root included. The one exception is opt-in, for a human key ceremony: a role named in mint_principal_arns may also sign, held to a DIGEST with RSASSA_PKCS1_V1_5_SHA_256. That is the shape minting the key's OpenPGP identity needs, and it is the release-signing path too, so the role can sign anything the CI signer can. Leave it empty and no human can sign.
  • The apply role that manages the infrastructure cannot sign directly. It is the one principal allowed to change the key policy, because OpenTofu manages that policy, so a compromise able to act as the apply role reaches as far as a policy change can, signing included. Protect the apply runner accordingly.

Sibling to terraform-aws-bootstrap (state backend + OIDC IDP) and terraform-aws-security-baseline (account hardening + operator role). This module composes after both.

Start here

  • phpboyscout/infra — the first user of this module: provisions the gtb-release-signing-v1 key for phpboyscout/go-tool-base's Phase 2 signed-update pipeline.
  • go-tool-base — the consuming tool, whose Phase 2 signing prep document describes the wider trust model the AWS half implements.

Further reading

The blog carries a curated route through this subject: Infrastructure with AWS and OpenTofu collects everything written about it, ordered so you can start at the beginning rather than newest-first.

Ask phpbotscout

phpbotscout

He answers questions about the projects over on the Discord, citing the docs where they already cover it, and offering to raise an issue where they don't. Bring a bug, an idea, or a questionable engineering decision.

Join the Discord