spring-cloud / spring-cloud-vault

Configuration Integration with HashiCorp Vault
http://cloud.spring.io/spring-cloud-vault/
Apache License 2.0
274 stars 152 forks source link

Conditional import of Vault config source fails #563

Closed fdw closed 3 years ago

fdw commented 3 years ago

Describe the bug Versions: Spring Cloud 2020.0.0 and Spring Boot 2.4. I want to enable a Vault config source by default, with one profile ("local") not using it (for local development). My application.yml file looks basically like this:

management:
  endpoints:
    web:
      exposure:
        include: health, info, startup, loggers, configprops
---
spring:
  config:
    activate:
      on-profile: local
<credentials hardcoded>
---
spring:
  config:
    import: vault://
    activate:
      on-profile: "!local"
  cloud:
    vault:
      <configuration>
      kv:
        enabled: false

Using the default profile works flawlessly, and the credentials are taken from Vault. However, when using the local profile, I get this error: Config data location 'vault://' does not exist. I had expected the import to be conditional on the profil !local.

What can I do to have Vault enabled by default, but offering another profile without Vault?

mp911de commented 3 years ago

Config data location 'vault://' does not exist should not be triggered as Vault is expected to be on the class path. Other than that, the actual selection of config imports is subject to Spring Boot. I'd suggest filing this ticket there.

fdw commented 3 years ago

Okay, thanks, I will open a new ticket there. Feel free to close this one :)