Right now I have a container for an API that I am looking to push to an AWS Fargate instance that has a connection string for a DB on a privately hosted server. For testing this has been stored in a string in my Golang program, but I don't really want to push that even with the program already compiled.
I have looked into using the GO AWS SDK for the SecretsManager, but I am not sure if that is the best way to go, or if it will even work like I am hoping it will. What is the best way to handle this?
Hardcoding things into the program is obviously never the best choice, so I share your pain and the need for something better, that could be:
Doing this with CloudFormation we will have in the first case:
...
Environment:
-
Name: CONNECTION_STRING
Value: 'YOUR VALUE'
...
While in the second case we would have:
...
Environment:
-
Name: CONNECTION_STRING
Value: '{{resolve:secretsmanager:MySecret:SecretString:connection_string}}'
...