Terraform’s dynamic provider credentials enable secure, short-lived authentication for HashiCorp Vault and cloud providers.
We are excited to announce the general availability of dynamic provider credentials, an authentication model for Terraform Cloud that’s also coming soon to Terraform Enterprise. Initially launched as a public beta in January, dynamic provider credentials help users create short-lived, just-in-time (JIT) credentials for HashiCorp Vault and the official Terraform providers for the major cloud vendors (Amazon Web Services, Microsoft Azure, and Google Cloud). This post reviews the details and benefits of this powerful new authentication method.
Previously, Terraform Cloud and Enterprise users commonly relied on static credentials to authenticate with Vault and cloud providers. However, this practice posed both operational and security obstacles. Managing these static, long-lived credentials did not scale well without tedious, manual intervention. Users set credentials as workspace variables or variable sets in Terraform, adding additional complexity to their authentication process. Manually storing static credentials also introduced security vulnerabilities, even if the credentials were rotated regularly.
Dynamic provider credentials are temporary, time-bound, and unique to each Terraform workload. They are generated on demand, as opposed to static credentials, which are defined ahead of time and shared. Dynamic credentials do not require manual rotation or revocation when they are no longer needed.
Dynamic provider credentials leverage workload identity and implementation of the OpenID Connect (OIDC) standard. Organizations first configure Terraform Cloud as a trusted identity provider with their cloud platform or Vault. Terraform Cloud then generates a signed identity token for every workload to obtain temporary, short-lived credentials that are injected into the run environment. This exchange happens automatically for the supported providers by adding a few simple environment variables to the workspace.
The Vault provider allows users to configure Vault authentication methods, roles, and policies, and to write and access static secrets for workloads in Terraform. Administrators now have a simple and secure way to authenticate a Terraform workspace to Vault without manually rotating credentials or exposing them as workspace variables.
Terraform Cloud dynamic provider credentials natively integrate with the Amazon Web Services (AWS), Microsoft Azure, and Google Cloud providers. Once an OIDC trust relationship is established, cloud admins scope roles with permissions appropriate to each workload. This eliminates the need for long-term API access keys or service principals and ensures that each Terraform Cloud run receives only the permissions it needs.
Simplify processes: Managing long-lived credentials requires custom solutions and processes typically taken on by the cloud platform team. Dynamic provider credentials simplify these processes by retrieving credentials on the fly, helping teams avoid the burden of manual secrets rotation.
Reduce risk: Storing long-lived static credentials presents severe security risks, as cloud credentials are highly sensitive and can grant powerful privileges. Using temporary, short-lived credentials removes the need to store long-lived secrets in Terraform Cloud and significantly limits the impact of accidental credential exposure and reuse.
Permissions control: Dynamic provider credentials provide platform teams with more granular permissions control, allowing them to scope privileges down to specific Terraform operations based on the run phase, workspace, project, or organization. This control helps keep permissions tightly scoped and enables the least privilege principle.
Get started with Terraform Cloud for free to begin provisioning and managing your infrastructure in any environment. And try HCP Vault, the easiest way to get started with Vault. Link your Terraform Cloud and HashiCorp Cloud Platform accounts together for a seamless sign-in experience.
Terraform Enterprise now supports more flexible deployment options for self-hosted environments, including cloud-managed Kubernetes services.
Assigning agents at the organization level provides a faster, more consistent, and scalable approach to agent pool configuration.
Learn how creating a golden image pipeline can help unify and streamline your imaging and provisioning workflows throughout your infrastructure estate.