Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter Store cannot be disabled in profile-specific config file #1110

Open
dominik-kovacs opened this issue Mar 20, 2024 · 4 comments
Open
Assignees
Labels
component: parameter-store Parameter Store integration related issue component: secrets-manager Secrets Manager integration related issue
Milestone

Comments

@dominik-kovacs
Copy link
Contributor

dominik-kovacs commented Mar 20, 2024

Type: Bug

Component:
Parameter Store (v3.1.1)

Describe the bug
Parameter Store cannot be disabled in a profile-specific config file

Sample
working example

application.yml

spring:
  config:
    import:
      - aws-parameterstore:/ecs-config/application/

  cloud:
    aws:
      parameterstore:
        enabled: false  

not working example

application.yml

spring:
  config:
    import:
      - aws-parameterstore:/ecs-config/application/

together with
application-dev.yml

spring:
  cloud:
    aws:
      parameterstore:
        enabled: false  

the application does not start with dev profile

err:

***************************
APPLICATION FAILED TO START
***************************

Description:

Config data resource '[ParameterStoreConfigDataResource@306851c7 context = '/ecs-config/application/', optional = false]' via location 'aws-parameterstore:/ecs-config/application/' does not exist

Action:

Check that the value 'aws-parameterstore:/ecs-config/application/' at class path resource [application.yml] - 4:9 is correct, or prefix it with 'optional:'

Minimal non-working example project
https://github.com/dominik-kovacs/spring-cloud-aws-parameter-store-demo

@tinah-1973
Copy link

You can set the import to optional:

optional:aws-parameterstore:/ecs-config/application/

@dominik-kovacs
Copy link
Contributor Author

@tinah-1973 thank you but I don't want to have it optional. I need it to fail when there is a missing config in prod env for example

@maciejwalkowiak maciejwalkowiak self-assigned this Mar 30, 2024
@maciejwalkowiak maciejwalkowiak added this to the 3.2.0 M2 milestone Mar 30, 2024
@maciejwalkowiak maciejwalkowiak added component: parameter-store Parameter Store integration related issue component: secrets-manager Secrets Manager integration related issue labels Mar 30, 2024
@dominik-kovacs
Copy link
Contributor Author

I am playing with it a bit more, looks like no spring.cloud.aws.parameterstore.* property can be overridden by a profile-specific config file.

@DalinSeivewright
Copy link

I can confirm this is the behavior I am seeing. I can enable/disable parameterstore for example in my application.properties but it is completely ignored in other profile properties files. A workaround that seemed to work fine for me (and might work for you @dominik-kovacs) is to set it to a custom property and then set that property instead in the other profile properties as configuration resolving still happens normally in spring.

# application.properties
spring.cloud.aws.parameterstore.enabled=${my.custom.property}
# application-local.properties
my.custom.property=false
# application-prod.properties
my.custom.property=true

@maciejwalkowiak maciejwalkowiak modified the milestones: 3.2.0 M2, 3.3.x Sep 16, 2024
@maciejwalkowiak maciejwalkowiak modified the milestones: 3.3.x, 3.3.0 Sep 29, 2024
@maciejwalkowiak maciejwalkowiak modified the milestones: 3.3.0, 3.3.0 M2 Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: parameter-store Parameter Store integration related issue component: secrets-manager Secrets Manager integration related issue
Projects
None yet
Development

No branches or pull requests

4 participants