To keep Terraform configuration secure, you shouldn't hardcode credentials. How can you securely provide your backend configuration using Terraform CLI?

Experience Level: Junior
Tags: Terraform

Answer

First insert the backend block into Terraform configuration. Don't provide credentials. Such setup is called Partial Configuration.

This way you can keep the configuration in version control without leaking sensitive information.

Later run terraform init -backend-config=PATH or terraform init -backend-config="KEY=VALUE"

This way you can provide the credentials on-demand.

Comments

No Comments Yet.
Be the first to tell us what you think.
Terraform CLI
Terraform CLI

Are you learning Terraform ? Try our test we designed to help you progress faster.

Test yourself