DEV Community

Sree Lasya Vallabhaneni
Sree Lasya Vallabhaneni

Posted on • Edited on

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)