| page_title | stackit_alb_certificate Resource - stackit |
|---|---|
| subcategory | |
| description | Setting up supporting infrastructure The example below creates the supporting infrastructure using the STACKIT Terraform provider, including the the automatic creation of a TLS certificate resource. |
The example below creates the supporting infrastructure using the STACKIT Terraform provider, including the the automatic creation of a TLS certificate resource.
variable "project_id" {
description = "The STACKIT Project ID"
type = string
default = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
# Create a RAS key pair
resource "tls_private_key" "example" {
algorithm = "RSA"
rsa_bits = 2048
}
# Create a TLS certificate
resource "tls_self_signed_cert" "example" {
private_key_pem = tls_private_key.example.private_key_pem
subject {
common_name = "localhost"
organization = "STACKIT Test"
}
validity_period_hours = 12
allowed_uses = [
"key_encipherment",
"digital_signature",
"server_auth",
]
}
# Create a ALB certificate
resource "stackit_alb_certificate" "certificate" {
project_id = var.project_id
name = "example-certificate"
private_key = tls_private_key.example.private_key_pem
public_key = tls_self_signed_cert.example.cert_pem
}name(String) Certificate name.private_key(String, Sensitive) The PEM encoded private key partproject_id(String) STACKIT project ID to which the certificate is associated.public_key(String) The PEM encoded public key part
region(String) The resource region (e.g. eu01). If not defined, the provider region is used.
cert_id(String) The ID of the certificate.id(String) Terraform's internal resource ID. It is structured as "project_id,region,cert_id".