Created
March 27, 2024 10:21
-
-
Save jamesdavidson/e805d2ae89a3a2eb629f1d01baad3bce to your computer and use it in GitHub Desktop.
Self signed cert and private key for development and local testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform { | |
required_providers { | |
tls = { | |
version = "4.0.5" | |
} | |
local = { | |
version = "2.5.1" | |
} | |
} | |
} | |
resource "tls_private_key" "capriv" { | |
algorithm = "RSA" | |
} | |
resource "tls_self_signed_cert" "cacert" { | |
private_key_pem = tls_private_key.capriv.private_key_pem | |
subject { | |
common_name = "example.com" | |
organization = "ACME Examples, Inc" | |
} | |
validity_period_hours = 168 // 1 week | |
allowed_uses = [ | |
"cert_signing", | |
] | |
} | |
resource "local_sensitive_file" "capriv" { | |
content = tls_private_key.capriv.private_key_pem | |
filename = "capriv.pem" | |
} | |
resource "local_file" "cacert" { | |
content = tls_self_signed_cert.cacert.cert_pem | |
filename = "cacert.pem" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment