> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# terraform-hardcoded-credential

> A Terraform provider, resource or module sets a credential to a literal value.

## What it flags

A literal string, including a heredoc, assigned to a credential argument in a `.tf` file:

* In a `provider` block, any secret-named argument such as `access_key`, `secret_key`, `token`, `password` or `client_secret`.
* In a `resource` or `module` block, `password`, `master_password`, `admin_password`, `administrator_login_password`, `root_password`, `client_secret`, `secret_key`, `api_key`, `api_token`, `auth_token` or `secret_string`, and any argument whose name ends in `_password` or `_secret`, such as a module's `db_password`.

The value is committed to version control and also lands in the Terraform state and plan output. The message shows only the first four characters. Rotate the committed credential after moving it out of the file.

Not flagged: references such as `var.db_password` or `data.aws_ssm_parameter.db.value`, interpolated strings, URLs, values shorter than 8 characters, and placeholders such as `change-me` or `example`. Values in `.tfvars` files are not read by this rule.

```hcl theme={null}
variable "db_password" {
  type      = string
  sensitive = true
}

resource "aws_db_instance" "main" {
  password = var.db_password
}
```

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "terraform-hardcoded-credential": "off" }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.