Terraform Q-Day Inventory: Find RSA and ECC Keys in State
Q-Day is when quantum computers break RSA and elliptic curves. Use Terraform state and jq to list every KMS key, ACM certificate and TLS key before Y2Q.
DevOps
The NSA asked for an immediate post-quantum transition. Use Terraform state to list every TLS policy you run, then control the policy from one variable.
On 2 December 2026 the NSA advised the operators of US National Security Systems to "immediately accelerate" the transition to post-quantum cryptography (PQC). The same day Amazon, Anthropic, Apple, Cloudflare, Google, Microsoft, OpenAI and Oracle published a joint statement that asks organizations "to accelerate the migration as soon as possible".
If your infrastructure is in Terraform, you have an advantage: the state file already knows every TLS policy you run. This article shows how to get that list, and how to make the next policy change a one-line change.
Run this in each root module. It is read-only.
terraform show -json | jq -r '
.. | objects
| select(.type? == "aws_lb_listener" and .values.ssl_policy != null)
| [.address, .values.ssl_policy] | @tsv'For CloudFront distributions:
terraform show -json | jq -r '
.. | objects
| select(.type? == "aws_cloudfront_distribution")
| [.address, .values.viewer_certificate[0].minimum_protocol_version] | @tsv'For API Gateway custom domains:
terraform show -json | jq -r '
.. | objects
| select(.type? == "aws_api_gateway_domain_name")
| [.address, .values.security_policy] | @tsv'Put the output of all workspaces in one file. That file is the start of your cryptographic inventory: resource address, current policy, owner.
A policy name that is copied into forty listeners is forty changes. Move it to one variable with a validation rule:
variable "alb_tls_policy" {
description = "TLS security policy for all ALB HTTPS listeners"
type = string
validation {
condition = can(regex("PQ", var.alb_tls_policy))
error_message = "Use a post-quantum (PQ) security policy. See the AWS documentation for the current policy names."
}
}
resource "aws_lb_listener" "https" {
load_balancer_arn = aws_lb.main.arn
port = 443
protocol = "HTTPS"
certificate_arn = aws_acm_certificate.main.arn
ssl_policy = var.alb_tls_policy
default_action {
type = "forward"
target_group_arn = aws_lb_target_group.app.arn
}
}AWS adds and renames security policies over time. Take the current post-quantum policy name from the Elastic Load Balancing documentation for your region. Do not copy it from a blog post, this one included.
A check block reads the listener as it exists in AWS and gives a warning in each plan when it does not use the approved policy. This also finds a change that someone made in the console:
check "tls_policy_is_post_quantum" {
data "aws_lb_listener" "public" {
load_balancer_arn = aws_lb.main.arn
port = 443
}
assert {
condition = data.aws_lb_listener.public.ssl_policy == var.alb_tls_policy
error_message = "The public listener does not use the approved post-quantum TLS policy."
}
}For a hard stop in CI, run the jq command from step 1 on the plan file (terraform show -json plan.out) and fail the job when a policy is not on your approved list.
Change the variable in a development workspace. Run terraform plan and confirm that only the policy changes.
Test the endpoint with OpenSSL 3.5 or later:
openssl s_client -connect dev.example.com:443 -groups X25519MLKEM768 </dev/null 2>/dev/null \
| grep -E "Negotiated TLS1.3 group|Server Temp Key"Check that old clients can still connect. Post-quantum policies are hybrid, so a client without ML-KEM uses the classical key exchange.
Apply to staging, then to production.
The hybrid group X25519MLKEM768 uses a classical algorithm and a post-quantum algorithm together. An attacker must break both. The Anthropic result is theoretical, but it is one more reason to keep the classical part.
The advisory does not ask you to redesign your infrastructure this week. It asks you to start. With Terraform, the start is three commands that tell you where you are, and one variable that controls where you go next.
For KMS key types and ACM certificates, see Terraform for Post-Quantum Cryptography: Migrate TLS and KMS.
Q-Day is when quantum computers break RSA and elliptic curves. Use Terraform state and jq to list every KMS key, ACM certificate and TLS key before Y2Q.
DevOpsPrepare for post-quantum cryptography with Terraform. Configure hybrid TLS policies, KMS key types, ACM certificates
Provision digital provenance and C2PA content signing infrastructure with Terraform: certificate authorities, signing services, ledgers, and verification APIs.
DevOpsSecure AI workloads with Terraform. Deploy Bedrock guardrails, model access IAM policies, prompt injection detection