Home > Back-end >  how to set up AWS Secrets with static credentials using terraform
how to set up AWS Secrets with static credentials using terraform

Time:11-24

I have a requirement. I am deploying a application into AWS using terraform. A part of this contains creating of a secrets resource "aws_secretsmanager_secret", for this secret I have to add userid/password of an external system which will be static and will never change. Now while deploying this I have to declare the values for the userid/password. Since this terraform will code will also get stored in the git repository. This storing of credential in plain text form is not allowed.

How to solve this problem ?

Thanks, Abhi

I have stored the credential in variables.tf that will eventually create the secrets with the variables, but this is not allowed

CodePudding user response:

Instead of storing your credentials in your variables.tf file, you can store them into environment variables, and have your tf code read those variables.

This way, when you commit your tf files to git, the variables will no be pushed in plain text.

Medium article explaining how to do it

Official documentation

  • Related