Resource Definitions
Driver
Capability
Resource Type
Credentials
Credentials #
Using static credentials #
This section contains example Resource Definitions using static credentials for connecting to a Git repository in (GitOps mode).
github-for-gitops.yaml
: use static credentials defined via GitHub variables. This format is for use with the Humanitec CLI.
github-for-gitops.yaml
(view on GitHub)
:
apiVersion: entity.humanitec.io/v1b1
kind: Definition
metadata:
id: github-for-gitops
entity:
name: github-for-gitops
driver_type: humanitec/k8s-cluster-git
type: k8s-cluster
driver_inputs:
values:
# Git repository for pushing manifests
url: [email protected]:example-org/gitops-repo.git
# Branch in the git repository, optional. If not specified, the default branch is used.
branch: development
# Path in the git repository, optional. If not specified, the root is used.
path: "${context.app.id}/${context.env.id}"
# Load Balancer, optional. Though it's not related to the git, it's used to create ingress in the target K8s cluster.
loadbalancer: 35.10.10.10
secrets:
credentials:
ssh_key: my-git-ssh-key
# Alternative to ssh_key: password or Personal Account Token
# password: my-git-ssh-pat
github-for-gitops.tf
(view on GitHub)
:
resource "humanitec_resource_definition" "github-for-gitops" {
driver_type = "humanitec/k8s-cluster-git"
id = "github-for-gitops"
name = "github-for-gitops"
type = "k8s-cluster"
driver_inputs = {
values_string = jsonencode({
"url" = "[email protected]:example-org/gitops-repo.git"
"branch" = "development"
"path" = "$${context.app.id}/$${context.env.id}"
"loadbalancer" = "35.10.10.10"
})
secrets_string = jsonencode({
"credentials" = {
"ssh_key" = "my-git-ssh-key"
}
})
}
}