-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update generated example library content (#75)
- Loading branch information
1 parent
c9cd297
commit fecb0e0
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
resource-definitions/template-driver/namespace/short-namespace.tf
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
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
50
resource-definitions/template-driver/tls-cert/certificate-crd.tf
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
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" | ||
} |
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
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}" | ||
}) | ||
} | ||
} | ||
|