June 20-22 Announcing HashiConf Europe full schedule: keynotes, sessions, labs & more Register Now
  • Overview
    • Enforce Policy as Code
    • Infrastructure as Code
    • Inject Secrets into Terraform
    • Integrate with Existing Workflows
    • Manage Kubernetes
    • Manage Network Infrastructure
    • Manage Virtual Machine Images
    • Multi-Cloud Deployment
    • Terraform CLI
    • Terraform Cloud
    • Terraform Enterprise
  • Registry
  • Tutorials
    • About the Docs
    • Intro to Terraform
    • Configuration Language
    • Terraform CLI
    • Terraform Cloud
    • Terraform Enterprise
    • Provider Use
    • Plugin Development
    • Registry Publishing
    • Integration Program
    • Terraform Tools
    • CDK for Terraform
    • Glossary
  • Community
GitHubTerraform Cloud
Download

    SDKv2

  • Overview
  • Tutorials: Custom Providers
    • Overview
    • Schema Types
    • Schema Behaviors
    • Schema Methods
    • Overview
    • Customizing Differences
    • Import
    • Retries and Customizable Timeouts
    • State Migration
  • Debugging Providers
    • Compatibility with Terraform 0.12
    • Switching to the standalone SDK
    • v2 Upgrade Guide
    • Overview
    • Naming
    • Depending on Providers
    • Deprecations, Removals, and Renames
    • Detecting Drift
    • Handling Sensitive Data
    • Testing Patterns
    • Versioning and Changelog
    • Writing Non-Go Providers
    • Overview
      • Overview
      • Test Cases
      • Test Steps
      • Sweepers
    • Testing API
    • Testing Patterns
    • Unit Testing
  • Other Plugin Docs

  • Plugin Development
  • Framework
  • Logging
  • Combining and Translating
Type '/' to Search

»Terraform Plugin SDKv2

Terraform Plugin SDKv2 is an established way to develop Terraform Plugins on protocol version 5.

Important: Which SDK Should I Use? explains the differences between Terraform Plugin SDKv2 and Terraform Plugin Framework to help you decide which option is right for your provider.

»Get Started

  • Try the Call APIs with Custom Providers tutorials on HashiCorp Learn.
  • Clone the terraform-provider-scaffolding template repository on GitHub.

»Key Concepts

  • Schemas define available fields for provider, resource, or provisioner configuration block, and give Terraform metadata about those fields.
  • Resources are an abstraction that allow Terraform to manage infrastructure objects, such as a compute instance, an access policy, or disk. Providers act as a translation layer between Terraform and an API, offering one or more resources for practitioners to define in a configuration.

»Debug and Test

  • Learn how to debug your provider using either logging calls or a debugging tool.
  • Learn how to write successful acceptance and unit tests for your provider.

»Combine or Translate

  • Combine your provider with other protocol version 5 providers.
  • Translate your provider into a protocol version 6 provider to require Terraform 1.0 and later.

»Migrate to Terraform Plugin Framework

The terraform-plugin-framework is a new way to develop Terraform providers, offering improvements and new features from Terraform Plugin SDKv2. You can refactor individual resources and data sources over time with the following compatibility:

  • Terraform 0.12 and later: First, translate your provider into a protocol version 5 provider. Then combine your provider with the translated provider. You will not be able to use protocol version 6 features.
  • Terraform 1.0 and later: First, translate your provider into a protocol version 6 provider. Then combine your provider with the translated provider.
github logoEdit this page
  • Overview
  • Docs
  • Extend
  • Privacy
  • Security
  • Press Kit
  • Consent Manager