TerraformPilot

DevOps

Terraform TLS Policy Inventory for Post-Quantum Migration

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.

LLuca Berton3 min read

Introduction

#

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.

What Happened

#
  • The advisory: the NSA said frontier AI companies disclosed recent discoveries that affect some cryptography in use today. The details are not public.
  • The Anthropic papers: on 30 November Anthropic published four papers. An internal Claude model found a theoretical attack on the lattice math behind ML-KEM and ML-DSA. Anthropic and independent reviewers say it has no practical effect on today's systems (The Next Web).
  • The threat level: ONCD, NSA and CISA say the advances "do not present an immediate and widespread threat".
  • The risk: "harvest now, decrypt later". Encrypted traffic that is copied today can be opened when a large quantum computer exists.

Step 1: List Every TLS Policy in State

#

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.

Step 2: Control the Policy From One Variable

#

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.

Step 3: Detect Drift From the Policy

#

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.

Step 4: Roll Out in Stages

#
  1. Change the variable in a development workspace. Run terraform plan and confirm that only the policy changes.

  2. 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"
  3. Check that old clients can still connect. Post-quantum policies are hybrid, so a client without ML-KEM uses the classical key exchange.

  4. Apply to staging, then to production.

Keep Hybrid Mode

#

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.

Conclusion

#

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.

#Terraform#Security#AWS#Cryptography#Post-Quantum#TLS

Share this article