Static credentials

Hard-coding credentials directly into the Terraform provider block.

Static credentials involve providing the AWS Access Key ID and Secret Access Key directly in your Terraform provider block. This method is the simplest to implement but it’s generally considered insecure, as your sensitive AWS keys are hard-coded into your script.

Example:

provider "aws" {
  region     = "us-west-2"
  access_key = "your-access-key-id"
  secret_key = "your-secret-access-key"
}

In this example, replace "your-access-key-id" and "your-secret-access-key" with your actual AWS Access Key ID and Secret Access Key respectively. The region field should also be replaced with the AWS region you wish to work in.

Important Note:

This method poses a high security risk, especially if your Terraform scripts are stored in a version control system. It is generally recommended for learning purposes or testing environments, but should be avoided in production.

Last modified July 21, 2024: update (e2ae86c)