Im able to make a number of kubernetes constructs in terraform and even have done so for my ephemeral stateful data that requires low latency disk performance. I can terraform up a kubernetes_persistent_volume but trying to do so with node_affinity has got me a bit perplexed as it requires a lists of lists (nodeSelectorTerms and matchExpressions), where the inside list has key/value pairs, and just not sure how to terraform all that. Heres the working yaml version:
apiVersion: v1 kind: PersistentVolume metadata: # PVs do not have namespaces name: nodeconfig spec: capacity: storage: 25Gi volumeMode: Filesystem accessModes: - ReadWriteMany persistentVolumeReclaimPolicy: Retain storageClassName: nodeconfig local: path: /mnt/nodeconfig nodeAffinity: required: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/hostname operator: In values: - myhost
Has anone dealt with this?