The Terraform Plugin Framework is the modern SDK for building custom Terraform providers in Go. Master resources, data sources, schema attributes, plan modifiers, and acceptance testing patterns for production-grade providers.
0 / 5 completed
1 / 5
A team develops a custom Terraform provider using the Terraform Plugin Framework. What interface must a resource type implement?
In the Terraform Plugin Framework, a custom resource must implement the resource.Resource interface, which requires Metadata(), Schema(), Create(), Read(), Update(), and Delete() methods. This is the modern approach, replacing the older SDKv2 schema.Resource struct.
2 / 5
In a Terraform Plugin Framework provider, what is the role of the Schema() method on a resource?
The Schema() method returns a schema.Schema that declares all attributes of the resource: their data types (types.String, types.Int64, etc.), whether they are required/optional/computed, validators, and plan modifiers (like RequiresReplace()). Terraform uses this schema to validate configuration and plan changes.
3 / 5
A Terraform provider's acceptance test calls resource.TestCheckResourceAttr(). What distinguishes acceptance tests from unit tests in provider development?
Acceptance tests in Terraform provider development use resource.Test() to execute actual Terraform plan/apply/destroy cycles against real provider APIs (AWS, GCP, etc.). They validate end-to-end resource lifecycle behavior. Because they create real resources, they require credentials and may incur costs — unlike unit tests which mock dependencies.
4 / 5
A Plugin Framework data source implements datasource.DataSource. How does a data source fundamentally differ from a resource in Terraform?
A data source is read-only: it fetches information about existing infrastructure (or external data) without creating or modifying anything. A resource manages the full CRUD lifecycle. Data sources implement only Read(), while resources implement Create(), Read(), Update(), and Delete().
5 / 5
A resource attribute uses schema.StringAttribute{Computed: true}. What does Computed: true mean in the Plugin Framework?
Computed: true means the attribute's value is set by the provider (from the API response) rather than by the user's configuration. Examples include auto-generated IDs, ARNs, or timestamps. If a user tries to set a purely computed attribute in their config, Terraform returns a validation error.