apiVersion: batch/v1
kind: Job
metadata:
 generateName: terrascan-hook-
 namespace: <YOU APPLICATION NAMESPACE>
 annotations:
   argocd.argoproj.io/hook: PreSync            
spec:
 ttlSecondsAfterFinished: 3600
 template:
   spec:
     securityContext:
       seccompProfile:
         type: RuntimeDefault
     containers:
     - name: terrascan-argocd
       image: <CUSTOM PRESYNC HOOK IMAGE>
       resources:
         requests:
           cpu: "1"
           memory: "256Mi"
         limits:
           cpu: "1"
           memory: "256Mi"
       env:
         - name: SERVICE_NAME
           value: <Name of service exposed for terrascan controller pod>
         - name: REMOTE_URL
           value: <YOUR PRIVATE REPOSITORY PATH>
         - name: IAC_TYPE
           value: <IAC TYPE YOU WANT SCAN> # If not provided default value is 'k8s'
         - name: IAC_VERSION
           value: <VERSION OF IAC TYPE SELECTED> # If not provided default value is 'v1' 
         - name: CLOUD_PROVIDER
           value: <TYPE OF CLOUD PROVIDER> #If not provided default value is 'all'
         - name: REMOTE_TYPE
           value: <TYPE OF REMOTE> #If not provided default value is 'git'       
       args:
       - sh
       - /home/terrascan/bin/terrascan-remote-scan.sh
       securityContext:
         seccompProfile:
           type: RuntimeDefault
         allowPrivilegeEscalation: false
         readOnlyRootFilesystem: true
         runAsNonRoot: true
         runAsUser: 101
       livenessProbe:
         exec:
           command:
           - cat
           - /home/terrascan/bin/terrascan-remote-scan.sh
         periodSeconds: 10
         initialDelaySeconds: 10
       readinessProbe:
         exec:
           command:
           - cat
           - /home/terrascan/bin/terrascan-remote-scan.sh
         periodSeconds: 10
         initialDelaySeconds: 10
     restartPolicy: Never
 backoffLimit: 1
 
