hcp-terraform-operator
by HashiCorp
Official Helm chart for HCP Terraform Operator for Kubernetes.
About this chart
Installation
Use the option --version VERSION with helm install and helm upgrade commands to specify the version you want to install.
Steps
-
Add the Helm repository
$ helm repo add hashicorp https://helm.releases.hashicorp.com -
Update your local Helm chart repository cache
$ helm repo update -
Install
$ helm install demo hashicorp/hcp-terraform-operator \ --version 2.12.1 \ --namespace tfc-operator-system \ --create-namespace
Below are examples of the Operator installation/upgrade Helm chart with options.
Install with options
$ helm install demo hashicorp/hcp-terraform-operator \
--version 2.12.1 \
--namespace tfc-operator-system \
--create-namespace \
--set operator.syncPeriod=10m \
--set 'operator.watchedNamespaces={white,blue,red}' \
--set controllers.agentPool.workers=5 \
--set controllers.agentToken.workers=5 \
--set controllers.module.workers=5 \
--set controllers.project.workers=5 \
--set controllers.runsCollector.workers=5 \
--set controllers.workspace.workers=5
In the above example, the Operator will watch 3 namespaces in the Kubernetes cluster: white, blue, and red.
Install to work with Terraform Enterprise
If targeting a Terraform Enterprise instance rather than HCP Terraform, set the API endpoint URL using the operator.tfeAddress value:
$ helm install demo hashicorp/hcp-terraform-operator \
--version 2.12.1 \
--set operator.tfeAddress="https://tfe-api.my-company.com"
If you encounter a TLS-related issue using the Operator with Terraform Enterprise, you may need to configure your own CA certificates using the customCAcertificates value, or by skipping TLS verification using the operator.skipTLSVerify value.
For more information, please refer to the FAQ.
Upgrade with options
$ helm upgrade demo hashicorp/hcp-terraform-operator \
--version 2.12.1 \
--namespace hcp-terraform-operator-system \
--set operator.syncPeriod=5m \
--set controllers.agentPool.workers=5 \
--set controllers.agentToken.workers=5 \
--set controllers.module.workers=10 \
--set controllers.project.workers=2 \
--set controllers.runsCollector.workers=7 \
--set controllers.workspace.workers=20
In the above example, the Operator will watch all namespaces in the Kubernetes cluster.
In some cases, such as when a new version of the Operator adds a new controller and, consequently, a new CRD, or when it changes an existing CRD schema, manual steps will be required to update the CRD. This is necessary because Helm does not upgrade CRDs during the upgrade operation. In both cases, manual steps involving kubectl apply or kubectl replace must be performed to add a new CRD or upgrade the existing one.
For a more detailed explanation, please refer to the FAQ.
Upgrade recommendations
-
2.8.0to2.9.0-
The
AgentPoolCRD has been changed:$ kubectl replace -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.9.0/charts/hcp-terraform-operator/crds/app.terraform.io_agentpools.yaml -
The
ModuleCRD has been changed:$ kubectl replace -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.9.0/charts/hcp-terraform-operator/crds/app.terraform.io_modules.yaml -
The
ProjectCRD has been changed:$ kubectl replace -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.9.0/charts/hcp-terraform-operator/crds/app.terraform.io_projects.yaml -
The
WorkspaceCRD has been changed:$ kubectl replace -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.9.0/charts/hcp-terraform-operator/crds/app.terraform.io_workspaces.yaml
-
-
2.7.0to2.8.0-
The
WorkspaceCRD has been changed:$ kubectl replace -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.8.0/charts/hcp-terraform-operator/crds/app.terraform.io_workspaces.yaml
-
-
2.6.0to2.7.0-
The
WorkspaceCRD has been changed:$ kubectl replace -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.7.0/charts/hcp-terraform-operator/crds/app.terraform.io_workspaces.yaml -
The
AgentPoolCRD has been changed:$ kubectl replace -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.7.0/charts/hcp-terraform-operator/crds/app.terraform.io_agentpools.yaml
-
-
2.5.0to2.6.0-
The
AgentPoolCRD has been changed:$ kubectl replace -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.6.0/charts/hcp-terraform-operator/crds/app.terraform.io_agentpools.yaml
-
-
2.3.0to2.4.0-
The
WorkspaceCRD has been changed:$ kubectl replace -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.4.0/charts/terraform-cloud-operator/crds/app.terraform.io_workspaces.yaml
-
-
2.2.0to2.3.0-
The
WorkspaceCRD has been changed:$ kubectl replace -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.3.0/charts/terraform-cloud-operator/crds/app.terraform.io_workspaces.yaml
-
-
2.1.0to2.2.0-
A new controller
Projecthas been added:$ kubectl apply -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.2.0/charts/terraform-cloud-operator/crds/app.terraform.io_projects.yaml
-
-
2.0.0to2.1.0-
The
WorkspaceCRD has been changed:$ kubectl replace -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.1.0/charts/terraform-cloud-operator/crds/app.terraform.io_workspaces.yaml
-
-
2.0.0-betaXto2.0.0-
The
AgentPoolCRD has been changed:$ kubectl replace -f https://raw.githubusercontent.com/hashicorp/hcp-terraform-operator/v2.0.0/charts/terraform-cloud-operator/crds/app.terraform.io_agentpools.yaml
-
Values
| Key | Type | Default | Description |
|---|---|---|---|
| controllers.agentPool.syncPeriod | string | "30s" | The minimum frequency at which watched Agent Pool resources are reconciled. Format: 5s, 1m, etc. |
| controllers.agentPool.workers | int | 1 | The number of the Agent Pool controller workers. |
| controllers.agentToken.syncPeriod | string | "15m" | The minimum frequency at which watched Agent Token resources are reconciled. Format: 5s, 1m, etc. |
| controllers.agentToken.workers | int | 1 | The number of the Agent Token controller workers. |
| controllers.module.syncPeriod | string | "5m" | The minimum frequency at which watched Module resources are reconciled. Format: 5s, 1m, etc. |
| controllers.module.workers | int | 1 | The number of the Module controller workers. |
| controllers.project.syncPeriod | string | "5m" | The minimum frequency at which watched Project resources are reconciled. Format: 5s, 1m, etc. |
| controllers.project.workers | int | 1 | The number of the Project controller workers. |
| controllers.runsCollector.syncPeriod | string | "15s" | The minimum frequency at which watched Runs Collector resources are reconciled. Format: 5s, 1m, etc. |
| controllers.runsCollector.workers | int | 1 | The number of the Runs Collector controller workers. |
| controllers.workspace.syncPeriod | string | "5m" | The minimum frequency at which watched Workspace resources are reconciled. Format: 5s, 1m, etc. |
| controllers.workspace.workers | int | 1 | The number of the Workspace controller workers. |
| customCAcertificates | string | "" | The base64 encoded custom Certificate Authority bundle used to validate API TLS certificates. |
| imagePullSecrets | list | [] | Reference to one or more secrets essential for pulling container images. |
| kubeRbacProxy.image.pullPolicy | string | "IfNotPresent" | Image pull policy. |
| kubeRbacProxy.image.repository | string | "quay.io/brancz/kube-rbac-proxy" | Image repository. |
| kubeRbacProxy.image.tag | string | "v0.20.1" | Image tag. |
| kubeRbacProxy.resources.limits.cpu | string | "500m" | Limits as a maximum amount of CPU to be used by a container. |
| kubeRbacProxy.resources.limits.memory | string | "128Mi" | Limits as a maximum amount of memory to be used by a container. |
| kubeRbacProxy.resources.requests.cpu | string | "50m" | Guaranteed minimum amount of CPU to be used by a container. |
| kubeRbacProxy.resources.requests.memory | string | "64Mi" | Guaranteed minimum amount of memory to be used by a container. |
| kubeRbacProxy.securityContext | object | {"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"seccompProfile":{"type":"RuntimeDefault"}} | Container security context. More information in Kubernetes documentation. |
| operator.affinity | object | {} | Kubernetes Affinity. More information: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity |
| operator.env | object | {} | Environment variables. |
| operator.image.pullPolicy | string | "IfNotPresent" | Image pull policy. |
| operator.image.repository | string | "hashicorp/hcp-terraform-operator" | Image repository. |
| operator.image.tag | string | "" | Image tag. Defaults to .Chart.AppVersion. |
| operator.resources.limits.cpu | string | "500m" | Limits as a maximum amount of CPU to be used by a container. |
| operator.resources.limits.memory | string | "128Mi" | Limits as a maximum amount of memory to be used by a container. |
| operator.resources.requests.cpu | string | "50m" | Guaranteed minimum amount of CPU to be used by a container. |
| operator.resources.requests.memory | string | "64Mi" | Guaranteed minimum amount of memory to be used by a container. |
| operator.securityContext | object | {"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"seccompProfile":{"type":"RuntimeDefault"}} | Container security context. More information in Kubernetes documentation. |
| operator.skipTLSVerify | bool | false | Whether or not to ignore TLS certification warnings. |
| operator.syncPeriod | string | "1h" | The minimum frequency at which watched resources are reconciled. Format: 5s, 1m, etc. |
| operator.tfeAddress | string | "" | The API URL of a Terraform Enterprise instance. |
| operator.tolerations | list | [] | Kubernetes Tolerations. More information: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ |
| operator.watchedNamespaces | list | [] | List of namespaces the controllers should watch. |
| podLabels | object | {} | Additional labels to add to the Operator pods. |
| priorityClassName | string | "" | Deployment priorityClassName. More information in Kubernetes documentation. |
| rbac.create | bool | true | Specifies whether a Role-Based Access Control (RBAC) resources should be created. |
| replicaCount | int | 2 | The number of Operator replicas. |
| securityContext | object | {"runAsNonRoot":true} | Deployment pod security context. More information in Kubernetes documentation. |
| serviceAccount.annotations | object | {} | Additional annotations for the ServiceAccount. |
| serviceAccount.create | bool | true | Specifies whether a ServiceAccount should be created. |
| serviceAccount.name | string | "" | The name of the service account to use. If not set and create is true, a name is generated using the fullname template. |
Deploy hcp-terraform-operator with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has hcp-terraform-operator on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the charthcp-terraform-operator is pinned at v2.12.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply