github.com/hernad/nomad@v1.6.112/e2e/terraform/tls_ca.tf (about)

     1  # Copyright (c) HashiCorp, Inc.
     2  # SPDX-License-Identifier: MPL-2.0
     3  
     4  # tls_ca.tf defines the certificate authority we use for mTLS
     5  
     6  resource "tls_private_key" "ca" {
     7    algorithm   = "ECDSA"
     8    ecdsa_curve = "P384"
     9  }
    10  
    11  resource "tls_self_signed_cert" "ca" {
    12    private_key_pem = tls_private_key.ca.private_key_pem
    13  
    14    subject {
    15      common_name  = "${local.random_name} Nomad E2E Cluster"
    16      organization = local.random_name
    17    }
    18  
    19    validity_period_hours = 720
    20  
    21    is_ca_certificate = true
    22    allowed_uses      = ["cert_signing"]
    23  }
    24  
    25  resource "local_file" "ca_key" {
    26    filename = "keys/tls_ca.key"
    27    content  = tls_private_key.ca.private_key_pem
    28  }
    29  
    30  resource "local_file" "ca_cert" {
    31    filename = "keys/tls_ca.crt"
    32    content  = tls_self_signed_cert.ca.cert_pem
    33  }