Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra Volume Mounts for TFE Server #53

Open
jherlehy opened this issue Oct 25, 2023 · 0 comments
Open

Extra Volume Mounts for TFE Server #53

jherlehy opened this issue Oct 25, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@jherlehy
Copy link

Other helm charts by the Hashi team have the ability to specify extra volumes and volume mounts via the helm values file. I would like to see the capability added to this chart as well to enable some kubernetes based integrations.

Reason - The CSI secrets-store driver can be used to connect secrets from a cloud platform (AWS Secrets Manager, GCP Secrets Manager, etc) to a k8s resource that requires mounting the secrets as a volume on the pod.

This can let me do something like the following by wrapping the TFE chart and adding some additional templates.

apiVersion: secrets-store.csi.x-k8s.io/v1
kind: SecretProviderClass
metadata:
  annotations:
    helm.sh/hook: pre-install,pre-upgrade
  name: terraform-enterprise-secrets
spec:
  provider: aws
  parameters:
    objects: |
      - objectName: /terraform-enterprise/license
        objectType: "secretsmanager"
        objectAlias: tfe-license
      - objectName: /terraform-enterprise/database/password
        objectType: "secretsmanager"
        objectAlias: tfe-database-password
      - objectName: /terraform-enterprise/redis/password
        objectType: "secretsmanager"
        objectAlias: tfe-redis-password
      - objectName: /terraform-enterprise/encryption-password
        objectType: "secretsmanager"
        objectAlias: tfe-encryption-password
  secretObjects:
    - secretName: terraform-enterprise-secrets
      type: Opaque
      data:
        - key: TFE_LICENSE
          objectName: tfe-license
        - key: TFE_DATABASE_PASSWORD
          objectName: tfe-database-password
        - key: TFE_REDIS_PASSWORD
          objectName: tfe-redis-password
        - key: TFE_ENCRYPTION_PASSWORD
          objectName: tfe-encryption-password
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: terraform-enterprise
  name: terraform-enterprise
spec:
  replicas: 1
  selector:
    matchLabels:
      app: terraform-enterprise
  template:
    metadata:
      labels:
        app: terraform-enterprise
    spec:
      serviceAccountName: terraform-enterprise
      containers:
        - name: terraform-enterprise
          image: hashicorp/terraform-enterprise:v202310-1
          imagePullPolicy: IfNotPresent
          envFrom:
            - configMapRef:
                name: terraform-enterprise-env-config
            - secretRef:
                name: terraform-enterprise-env-secrets
            - secretRef:
                name: terraform-enterprise-secrets
          ports:
            - containerPort: 8080
            - containerPort: 8443
            - containerPort: 9090
            - containerPort: 9091
          readinessProbe:
            httpGet:
              path: /_health_check
              port: 8080
              scheme: HTTP
          resources:
            limits:
              memory: 8G
            requests:
              cpu: 2000m
              memory: 8G
          volumeMounts:
            - mountPath: /etc/ssl/private/terraform-enterprise/cert.pem
              name: certificates
              subPath: tls.crt
            - mountPath: /etc/ssl/private/terraform-enterprise/key.pem
              name: certificates
              subPath: tls.key
            - mountPath: /etc/secrets
              name: terraform-enterprise-secrets
      volumes:
        - name: certificates
          secret:
            secretName: terraform-enterprise-certificates
        - name: terraform-enterprise-secrets
          csi:
            driver: secrets-store.csi.k8s.io
            readOnly: true
            volumeAttributes:
              secretProviderClass: terraform-enterprise-secrets

This would help enable management of TFE without introducing potential for tracking credentials in a source control system.

@amy-hashi amy-hashi added the enhancement New feature or request label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants