DEV Community

Sree Lasya Vallabhaneni
Sree Lasya Vallabhaneni

Posted on • Edited on

3

Add aws credentials in terraform

Create a terraform.tfvars file in your terraform directory

If you give the name as mentioned above, terraform by default recognize that as a local environment file and you do not version control it.

Edit the file add these two variables

aws_access_key = "XXXXXXXXXXX"
aws_secret_key = "XXXX+XXXX"

In this way, you do not have to specifically mention the credentials every time you want to run:

terraform plan
terraform apply

If you create a file with a different name, you can pass the file name while running terraform commands

The above concept is keeping in mind AWS is the default provider and the credentials associated is the default user.

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE