-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Automatically populate PropertySource with instance metadata when running within an EC2-based environment #962
Conversation
Thanks @kennyk65 for a PR! We need an integration test for that. Until Localstack supports metadata endpoint (localstack/localstack#8911) we would need to mock it - ideally with WireMock, to make sure whole flow works as expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall - great stuff! Thanks a lot! While most comments are details, an integration test is a must to merge it.
...aws-autoconfigure/src/main/java/io/awspring/cloud/autoconfigure/imds/ImdsPropertySource.java
Show resolved
Hide resolved
...autoconfigure/src/test/java/io/awspring/cloud/autoconfigure/imds/ImdsPropertySourceTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Maciej Walkowiak <[email protected]>
…ud-aws into imds-changes
Thanks @kennyk65 once again and apologies it took so long. |
Thanks! Let me know if I can help out with anything else. |
📢 Type of change
📜 Description
A new package added to the autoconfigure project (with test classes) to populate a PropertySource whenever IMDS is present, which occurs on EC2, ElasticBeanstalk, ECS, EKS, etc. Auto configuration silently ignores the absence of IMDS. A starter pom is added, docs are updated.
💡 Motivation and Context
Issue addressed is: #954
There are various times when an application needs to know its IP address, availability zone, region, mac address, etc. All this is available via IMDS. This feature simply adds these properties to the Environment when available.
💚 How did you test it?
Three new classes, three new JUnit tests. Plus I created a sample application using the libraries for a sanity test.
📝 Checklist
🔮 Next steps
Others may wish to expand this to retrieve dynamic data, user data, set a common prefix, etc. May want to use a ConfigProperties only to cause the one and only property to be documented.