I've defined Jenkins credentials as a kubectl secrets.
apiVersion: v1
kind: Secret
metadata:
name: "git"
labels:
"jenkins.io/credentials-type": "basicSSHUserPrivateKey"
annotations:
"jenkins.io/credentials-description" : "private key"
type: Opaque
stringData:
username: user
privateKey: |
-----BEGIN OPENSSH PRIVATE KEY-----
-----END OPENSSH PRIVATE KEY-----
Then in Jenkins I have defined pipelines which are using this key.
Unfortunately, when I apply terraform configuration the key parameter in job configuration is empty and I need to set it up manually to "git". It's on the list, it is visible, but its not marked as the default key. Default value is "not specified".
Is there any way to prevent it and make this key work as it should out of the box?