Skip to content

Commit

Permalink
Update generated example library content (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasBabin committed Sep 9, 2024
1 parent c9cd297 commit fecb0e0
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
30 changes: 30 additions & 0 deletions resource-definitions/template-driver/namespace/short-namespace.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
resource "humanitec_resource_definition" "custom-namespace" {
driver_type = "humanitec/template"
id = "custom-namespace"
name = "custom-namespace"
type = "k8s-namespace"
driver_inputs = {
values_string = jsonencode({
"templates" = {
"init" = "name: {{ trunc 8 \"$${context.env.id}\" }}-{{ trunc 8 \"$${context.app.id}\" }}\n"
"manifests" = <<END_OF_TEXT
namespace.yaml:
location: cluster
data:
apiVersion: v1
kind: Namespace
metadata:
labels:
pod-security.kubernetes.io/enforce: restricted
name: {{ .init.name }}
END_OF_TEXT
"outputs" = "namespace: {{ .init.name }}\n"
}
})
}
}

resource "humanitec_resource_definition_criteria" "custom-namespace_criteria_0" {
resource_definition_id = resource.humanitec_resource_definition.custom-namespace.id

}
50 changes: 50 additions & 0 deletions resource-definitions/template-driver/tls-cert/certificate-crd.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
resource "humanitec_resource_definition" "certificate-crd" {
driver_type = "humanitec/template"
id = "certificate-crd"
name = "certificate-crd"
type = "tls-cert"
driver_inputs = {
values_string = jsonencode({
"templates" = {
"init" = <<END_OF_TEXT
tlsSecretName: {{ .id }}-tls
hostName: $${resources.dns.outputs.host}
certificateName: {{ .id }}-cert
END_OF_TEXT
"manifests" = <<END_OF_TEXT
certificate-crd.yml:
data:
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: {{ .init.certificateName }}
spec:
secretName: {{ .init.tlsSecretName }}
duration: 2160h # 90d
renewBefore: 720h # 30d
isCA: false
privateKey:
algorithm: RSA
encoding: PKCS1
size: 2048
usages:
- server auth
- client auth
dnsNames:
- {{ .init.hostName | toString | toRawJson }}
# The name of the issuerRef must point to the issuer / clusterIssuer in your cluster
issuerRef:
name: letsencrypt-prod
kind: ClusterIssuer
location: namespace
END_OF_TEXT
"outputs" = "tls_secret_name: {{ .init.tlsSecretName }}\n"
}
})
}
}

resource "humanitec_resource_definition_criteria" "certificate-crd_criteria_0" {
resource_definition_id = resource.humanitec_resource_definition.certificate-crd.id
class = "default"
}
13 changes: 13 additions & 0 deletions resource-definitions/wildcard-dns/dns-template.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "humanitec_resource_definition" "dns-template" {
driver_type = "humanitec/dns-wildcard"
id = "dns-template"
name = "dns-template"
type = "dns"
driver_inputs = {
values_string = jsonencode({
"domain" = "my-test-domain.com"
"template" = "preview-$${context.app.id}-$${context.env.id}"
})
}
}

0 comments on commit fecb0e0

Please sign in to comment.