Skip to content

Parameter Store property "spring.cloud.aws.parameterstore.endpoint" is not loaded correctly when declared in an "application.properties" of a specifc spring profileย #966

Open
@HenriqueDelben

Description

Type: Bug

Component:
Parameter Store

Describe the bug
The property "spring.cloud.aws.parameterstore.endpoint" is not loaded correctly when specified under a specific application.properties profile

Ex.:

# application.properties 
spring.cloud.aws.parameterstore.endpoint=http://ssm.sa-east-1.amazonaws.com
# application-dev.properties
spring.cloud.aws.parameterstore.endpoint=http://localhost:4566

If the application is executed with:

java -jar app.jar --spring.profiles.active=dev

The expected endpoint to be used by Spring Cloud AWS's auto-configured SsmClient would be "http://localhost:4566". But instead, "http://ssm.sa-east-1.amazonaws.com" is used.

Sample

# application-dev.properties 
spring.cloud.aws.parameterstore.endpoint=http://localhost:4566

Making a GET request with "dev" profile active to "/teste":

@RestController
public class ControllerParameterStore {

    @Value("${foo}")
    public String foo;
    private final ServiceParameterStore serviceParameterStore;

    public ControllerParameterStore(ServiceParameterStore serviceParameterStore) {

        this.serviceParameterStore = serviceParameterStore;
    }

    @GetMapping("/teste")
    public String teste() {
        return foo;
    }
}

Should return "foo from localhost:4566". As stated here:

2023-11-20T17:45:39.054-03:00 INFO 80862 --- [ restartedMain] com.example.demo.DemoApplication : The following 1 profile is active: "dev"

And showed here:

aws ssm get-parameter --name foo --with-decryption --endpoint-url http://localhost:4566
{
    "Parameter": {
        "Name": "foo",
        "Type": "SecureString",
        "Value": "foo from localhost:4566",
        "Version": 1,
        "LastModifiedDate": "2023-11-20T17:40:12.731000-03:00",
        "ARN": "arn:aws:ssm:sa-east-1:000000000000:parameter/foo",
        "DataType": "text"
    }
}

Instead returns this: "foo from amazon sa-east-1 server". From the default aws server (configured automatically I think), as you can see here

aws ssm get-parameter --name foo --with-decryption 
{
    "Parameter": {
        "Name": "foo",
        "Type": "SecureString",
        "Value": "foo from amazon sa-east-1 server",
        "Version": 1,
        "LastModifiedDate": "2023-11-20T17:41:51.835000-03:00",
        "ARN": "arn:aws:ssm:sa-east-1:0000000000:parameter/foo",
        "DataType": "text"
    }

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions