apiVersion: batch/v1
kind: Job
metadata:
  name: cas-shelf-tfe-add-app
spec:
  backoffLimit: 0
  activeDeadlineSeconds: 900
  parallelism: 1
  completions: 1
  template:
    metadata:
      name: cas-shelf-tfe-add-app
    spec:
      containers:
        - name: cas-shelf-tfe-add-app
          resources:
            limits:
              cpu: 1000m
              memory: 128Mi
            requests:
              cpu: 100m
              memory: 64Mi
          image: docker.pkg.github.com/bcgov/cas-shelf/cas-shelf-tfe-add-app:0.1
          imagePullPolicy: Always
          env:
            - name: TFC_TOKEN
              valueFrom:
                secretKeyRef:
                  key: token
                  name: terraform-cloud-workspace
            - name: TFC_WORKSPACE_ID
              valueFrom:
                secretKeyRef:
                  key: workspace_id
                  name: terraform-cloud-workspace
          command: ["bash",  "/script.sh", "namespace", "app"]
      restartPolicy: Never

# Usage
# oc create -f cas-shelf-tfe-add-app.yml
# oc delete -f cas-shelf-tfe-add-app.yml
