Are you following the tutorial for HCP Vault or self-hosted? I would have assumed HCP since this is in the HCP Vault category but I see in your example commands it looks like youre starting Vault in dev mode.
I see you posted this a several hours before me, so decided to test the self-hosted workflow and its working for me as written in the tutorial.
Even though with those above, I still got the error when running read mongodb/creds/tester
Error reading mongodb/creds/tester: Error making API request.
URL: GET http://127.0.0.1:8200/v1/mongodb/creds/tester
Code: 500. Errors:
* 1 error occurred:
* invalid character 'd' looking for beginning of object key string
Good news, as written (accounting for updating commands for Windows) its working for me. Bad news, that doesn’t help me help you.
How is Docker configured for you? Is it using Hyper-V or WSL2? I took a pretty vanilla Windows laptop with WSL2 using Ubuntu and just did a choco install docker-desktop, started Docker and its working (caveat this is my test laptop so possible I did things in the past I am forgetting).
The commands I used seem to match yours. I took these, copied them from the developer.hashicorp.com portal into Notepad on Windows, cleaned up the line breaks and added " " where needed.
One other thing I did, I installed MongoDB Compass GUI (https://www.mongodb.com/try/download/shell) and verified I could log in with the username and password used when starting the Docker container. At that point, I was confident MongoDB started properly and knew it was accepting connections.
The error you’re encountering when trying to read MongoDB dynamic secrets from Vault is likely due to a syntax or configuration issue. The error message suggests there’s a problem with the JSON format or the way the MongoDB plugin is configured in Vault.
To troubleshoot, consider the following steps:
Check JSON Syntax: Ensure the JSON syntax in your creation_statements is correct and properly escaped. JSON syntax issues can lead to parsing errors.
Verify Connection URL: Double-check the connection_url format and credentials. Ensure the MongoDB instance is accessible from Vault and that the credentials (username and password) are correct.
Inspect Vault Server Logs: The Vault server logs might provide more context about the error. Look for any additional error messages or warnings that could indicate the source of the issue.
Review MongoDB Plugin Configuration: Ensure the MongoDB plugin is correctly configured and that the plugin_name, allowed_roles, and connection_url parameters are set correctly.
Use Correct Quotes: Ensure you’re using standard quotes (") in your commands rather than typographic quotes (“ and ”), which can cause issues in command-line environments.
MongoDB Permissions: Verify that the MongoDB user (mdbadmin) has the necessary permissions to grant roles and create users in the database.
If you’ve verified these aspects and the issue persists, providing more details about your Vault and MongoDB setup might help diagnose the problem further.