terraform-plugin-sdk
moduleThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
README¶
Terraform Plugin SDK
This SDK enables building Terraform plugin which allows Terraform's users to manage existing and popular service providers as well as custom in-house solutions. The SDK is stable and broadly used across the provider ecosystem.
For new provider development it is recommended to investigateterraform-plugin-framework, which is a reimagined provider SDK that supports additional capabilities. Refer to theWhich SDK Should I Use? documentation for more information about differences between SDKs.
Terraform itself is a tool for building, changing, and versioning infrastructure safely and efficiently. You can find more about Terraform on itswebsite andits GitHub repository.
Terraform CLI Compatibility
Terraform 0.12.0 or later is needed for version 2.0.0 and later of the Plugin SDK.
When running provider tests, Terraform 0.12.26 or later is needed for version 2.0.0 and later of the Plugin SDK. Users can still use any version after 0.12.0.
Go Compatibility
This project follows thesupport policy of Go as its support policy. The two latest major releases of Go are supported by the project.
Currently, that means Go1.24 or later must be used when including this project as a dependency.
Getting Started
See theCall APIs with Terraform Providers guide onlearn.hashicorp.com for a guided tour of provider development.
Documentation
SeeExtending Terraform section on the website.
Scope (Providers VS Core)
Terraform Core
- acts as gRPCclient
- interacts with the user
- parses (HCL/JSON) configuration
- manages state as whole, asksProvider(s) to mutate provider-specific parts of state
- handles backends & provisioners
- handles inputs, outputs, modules, and functions
- discoversProvider(s) and their versions per configuration
- managesProvider(s) lifecycle (i.e. spins up & tears down provider process)
- passes relevant parts of parsed (valid JSON/HCL) and interpolated configuration toProvider(s)
- decides ordering of (Create, Read, Update, Delete) operations on resources and data sources
- ...
Terraform Provider (via this SDK)
- acts as gRPCserver
- executes any domain-specific logic based on received parsed configuration
- (Create, Read, Update, Delete, Import, Validate) a Resource
- Read a Data Source
- tests domain-specific logic via provided acceptance test framework
- providesCore updated state of a resource or data source and/or appropriate feedback in the form of validation or other errors
Migrating to SDK v1 from built-in SDK
Migrating to the standalone SDK v1 is covered on thePlugin SDK section of the website.
Migrating to SDK v2 from SDK v1
Migrating to the v2 release of the SDK is covered in thev2 Upgrade Guide of the website.
Versioning
The Terraform Plugin SDK is aGo module versioned usingsemantic versioning. SeeSUPPORT.md for information on our support policies.
Contributing
License
Directories¶
| Path | Synopsis |
|---|---|
helper | |
customdiff Package customdiff provides a set of reusable and composable functions to enable more "declarative" use of the CustomizeDiff mechanism available for resources in package helper/schema. | Package customdiff provides a set of reusable and composable functions to enable more "declarative" use of the CustomizeDiff mechanism available for resources in package helper/schema. |
schema schema is a high-level framework for easily writing new providers for Terraform. | schema is a high-level framework for easily writing new providers for Terraform. |
internal | |
addrs Package addrs contains types that represent "addresses", which are references to specific objects within a Terraform configuration or state. | Package addrs contains types that represent "addresses", which are references to specific objects within a Terraform configuration or state. |
configs/configschema Package configschema contains types for describing the expected structure of a configuration block whose shape is not known until runtime. | Package configschema contains types for describing the expected structure of a configuration block whose shape is not known until runtime. |
plugintest Package plugintest contains utilities to help with writing tests for Terraform plugins. | Package plugintest contains utilities to help with writing tests for Terraform plugins. |
tfdiags Package tfdiags is a utility package for representing errors and warnings in a manner that allows us to produce good messages for the user. | Package tfdiags is a utility package for representing errors and warnings in a manner that allows us to produce good messages for the user. |
The meta package provides a location to set the release version and any other relevant metadata for the SDK. | The meta package provides a location to set the release version and any other relevant metadata for the SDK. |