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

Documentation Correction: Missing Trailing Slash in aws-parameterstore Path #1311

Closed
lexeldev opened this issue Dec 23, 2024 · 1 comment
Closed

Comments

@lexeldev
Copy link

Type: Bug

Component:

Parameter Store

Describe the bug

There is a discrepancy in the Spring Cloud AWS documentation regarding the configuration of the aws-parameterstore path. The documentation specifies the path as aws-parameterstore:/config/spring, but in practice, the path must include a trailing slash (aws-parameterstore:/config/spring/) to correctly load parameters into Spring’s environment properties.

This issue occurs when using application.yml, but it is likely to affect application.properties as well.

Version Information:

  • Spring Cloud AWS Version: 3.0.0

Steps to Reproduce:

  1. Follow the Documentation Example:

    • Add the following property to application.yml:
      spring:
        config:
          import: aws-parameterstore:/config/spring
    • Assume parameters in Parameter Store are stored under /config/spring:
      /config/spring/message = Welcome
      /config/spring/httpUrl = external-service:3030/
      
  2. Attempt to Use Properties in application.yml:

    message: ${message}
    httpUrl: ${httpUrl}
    
  3. Run the Application:

Observe that ${message} and ${httpUrl} are not resolved as expected.

Expected Behavior:

When the spring.config.import property is set the parameters should be correctly loaded and available for use in application.yml or application.properties as ${message} and ${httpUrl}.

Actual Behavior:

Without the trailing slash (aws-parameterstore:/config/spring), the parameters are not correctly loaded into the Spring environment, leading to unresolved placeholders in the configuration.

Suggested Fix:

Update the documentation to include a trailing slash in the aws-parameterstore path example. The corrected snippet should be:

spring.config.import=aws-parameterstore:/config/spring/

Updated Documentation Example:

To fetch parameters from Parameter Store and add them to Spring’s environment properties, add the spring.config.import property to application.properties or application.yml.

For example, assuming that the parameters in Parameter Store are stored under the path /config/spring/:

Parameter Name Parameter Value
/config/spring/message Welcome
/config/spring/httpUrl external-service:3030/

Once the spring.config.import statement is added:

spring.config.import=aws-parameterstore:/config/spring/

Two parameters are added to the environment: message and httpUrl, which can be accessed in application.yml as ${message} and ${httpUrl} respectively.

@kunalvarpe
Copy link
Contributor

This is duplicate of #1058. Also this is fixed in documentations greater that 3.1.0 versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants