I've configured a HashiCorp Vault cluster in their cloud and done the necessary steps mentioned at - https://learn.hashicorp.com/tutorials/cloud/vault-auth-method-aws?in=vault/cloud-ops . I've created the required AWS roles , users & policies and am able to connect to the vault using the admin token via the CLI.
However for our Java application I'm trying to have our spring boot application authenticate using the AWS iam auth method. I've got the bootstrap.yml to have the following :
spring.cloud.vault:
uri: {HashiCorp Cloud Public URL}
authentication: AWS_IAM
kv:
enabled:true
aws-iam:
role: vault-role-for-aws-ec2role
aws-path: aws
endpoint-uri: sts.ap-southeast-1.amazonaws.com
The role "vault-role-for-aws-ec2role" is configured to use the policy to read the key values :
Grant 'read' permission to paths prefixed by 'kv/test/ec2'
path "kv/test/ec2" {
capabilities = [ "read" ]
}
However when I try to startup my springboot application it fails giving the following error :
2022-06-22 02:50:16.050 INFO 21435 --- [ main] o.s.v.c.e.LeaseAwareVaultPropertySource : Vault location [secret/application/dev] not resolvable: hostname cannot be null 2022-06-22 02:50:16.051 WARN 21435 --- [ main] LeaseEventPublisher$LoggingErrorListener : [RequestedSecret [path='secret/application', mode=ROTATE]] Lease [leaseId='null', leaseDuration=PT0S, renewable=false] hostname cannot be null
java.lang.IllegalArgumentException: hostname cannot be null
I'm not sure what could be going wrong. Can anyone help ?