Building your first Terraform configuration
After installing Terraform and the AWS CLI, it is time to configure connectivity between them to be able to create resources with Terraform.
To authenticate the Terraform AWS provider with your IAM credentials, you need to set the AWS_ACCESS_KEY_ID
environment variable in your terminal by adding your key after the =
sign:
export AWS_ACCESS_KEY_ID=
Then add your secret key as follows, again after the =
sign:
export AWS_SECRET_ACCESS_KEY=
You can verify your credentials and connectivity with the following command:
aws sts get-caller-identity
And you should receive a similar output to the following:
{ "Account": "1234567890", "UserId": "ABCDEFGHJIKLM", "Arn": "arn:aws:iam:: 1234567890:user/erol_kavas" }
Now that you have successfully built your first Terraform configuration, let’s move...