Skip to content

Add ability to override AWS endpoints during configuration discovery. #2277

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

Conversation

ammeek
Copy link
Contributor

@ammeek ammeek commented Jan 14, 2025

Currently, it is not possible to override the AWS SSM/ secret manager endpoint during configuration discovery. This stops you from being able to integrate Localstack during the configuration discovery process.

I've added the BootstrapContextCompatible annotation to the AWSServiceConfigurationProperties class to resolve this.
I've also added a test to check that this annotation has been added as I have seen similar tests throughout the project.
I am not sure if additional testing showing the configuration discovery process integrating with Localstack is required.

…tible to support configuration discovery via Localstack.
@CLAassistant
Copy link

CLAassistant commented Jan 14, 2025

CLA assistant check
All committers have signed the CLA.

@ammeek ammeek changed the title Add ability to override AWS endpoint for configuration discovery. Add ability to override AWS endpoints during configuration discovery. Jan 15, 2025
@ammeek ammeek marked this pull request as ready for review January 15, 2025 07:47
@ammeek ammeek changed the base branch from 4.7.x to 4.8.x January 15, 2025 07:56
@ammeek ammeek changed the base branch from 4.8.x to 4.9.x January 21, 2025 22:37
@sdelamo
Copy link
Contributor

sdelamo commented Mar 19, 2025

@ammeek I am not sure we need this pull-request. I think you can create a BeanCreatedEventListener for the different builders builder.

e.g

@Singleton
public class S3ClientBuilderCustomizer implements BeanCreatedEventListener<S3ClientBuilder> {

    @Override
    public S3ClientBuilder onCreated(@NonNull BeanCreatedEvent<S3ClientBuilder> event) {
        return event.getBean()
            .overrideConfiguration(c -> c.apiCallTimeout(Duration.of(60, ChronoUnit.SECONDS)));
    }
}

@ammeek
Copy link
Contributor Author

ammeek commented Mar 20, 2025

Thanks for your reply @sdelamo unfortunately, the bootstrap context disallows bean event listeners.

I would like to be able to continue to use the established convention for overriding AWS endpoints in Micronaut which is done via the AWSServiceConfigurationProperties class. This PR will allow that class to be available during configuration discovery via the bootstrap context.

@sdelamo
Copy link
Contributor

sdelamo commented Mar 24, 2025

@ammeek the motivation for this is because you need to inject AWS SDK beans in your bootstrap aware code? or is to test an integration such as secrets manager which runs at bootstrap.

@ammeek
Copy link
Contributor Author

ammeek commented Mar 24, 2025

@sdelamo Yea the motivation for this is to test an integration with secrets manager/param store at bootstrap.

@sdelamo sdelamo changed the base branch from 4.9.x to 4.10.x March 24, 2025 14:27
@sdelamo sdelamo removed this from 4.9.0 Release Mar 24, 2025
@sdelamo sdelamo merged commit 2956c5f into micronaut-projects:4.10.x Mar 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants