Skip to content

Commit fa98583

Browse files
Merge DevPortal into Main (#1061)
* Docs Changes for DevDot Migration (#1036) * Remove mentions of HashiCorp Learn * Remaining updates - terraform.io, mentions of docs nav * Update website/docs/plugin/sdkv2/resources/import.mdx Co-authored-by: Matthew Garrell <[email protected]> * Update website/docs/plugin/sdkv2/testing/index.mdx Co-authored-by: Matthew Garrell <[email protected]> * Update website/docs/plugin/sdkv2/testing/acceptance-tests/index.mdx Co-authored-by: Matthew Garrell <[email protected]> * Update website/docs/plugin/sdkv2/best-practices/index.mdx Co-authored-by: Matthew Garrell <[email protected]> * Update website/docs/plugin/sdkv2/guides/v2-upgrade-guide.mdx Co-authored-by: Matthew Garrell <[email protected]> * Update website/docs/plugin/sdkv2/resources/index.mdx Co-authored-by: Matthew Garrell <[email protected]> * Update website/docs/plugin/sdkv2/testing/index.mdx Co-authored-by: Matthew Garrell <[email protected]> Co-authored-by: Matthew Garrell <[email protected]> * Updating Sidebar to Match Design Spec (#1048) * Updating Sidebar to Match Design Spec * Update website/data/plugin-sdk-nav-data.json * Update website/data/plugin-sdk-nav-data.json * Update index.mdx (#1053) * Update index.mdx * Update website/docs/plugin/sdkv2/index.mdx Co-authored-by: Matthew Garrell <[email protected]>
1 parent a0ace48 commit fa98583

File tree

8 files changed

+20
-42
lines changed

8 files changed

+20
-42
lines changed

Diff for: website/data/plugin-sdk-nav-data.json

+2-14
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
[
22
{ "heading": "SDKv2" },
33
{ "title": "Overview", "path": "" },
4-
{
5-
"title": "Tutorials: Custom Providers",
6-
"href": "https://learn.hashicorp.com/collections/terraform/providers?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS"
7-
},
84
{
95
"title": "Schemas",
106
"routes": [
@@ -40,21 +36,13 @@
4036
}
4137
]
4238
},
43-
{
44-
"title": "Logging",
39+
{
40+
"title": "Logging",
4541
"routes": [
4642
{
4743
"title": "Overview",
4844
"path": "logging"
4945
},
50-
{
51-
"title": "Writing Logs",
52-
"href": "/plugin/log/writing"
53-
},
54-
{
55-
"title": "Filtering Logs",
56-
"href": "/plugin/log/filtering"
57-
},
5846
{
5947
"title": "HTTP Transport",
6048
"path": "logging/http-transport"

Diff for: website/docs/plugin/sdkv2/best-practices/index.mdx

+2-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ specific cloud provider, allowing each provider to fully support its unique
1515
resources and lifecycles and not settling for the lowest common denominator
1616
across all provider resources of that type (virtual machines, networks,
1717
configuration management systems, et. al). While each provider is unique, over
18-
the years we’ve accumulated some patterns that should be adhered to, to
19-
ensure a consistent user experience when using Terraform for any given provider.
20-
Listed below are a few best practices we’ve found that generally apply to most
21-
Providers, with a brief description of each, and link to read more. Each
22-
practice is also linked in navigation on the left.
18+
the years, we accumulated recommended patterns that help ensure a consistent user experience when using Terraform for any given provider. This page describes best practices that generally apply to most
19+
Providers, with a brief description of each, and link to read more.
2320

2421
This section is a work in progress, with more sections to come.
2522

Diff for: website/docs/plugin/sdkv2/guides/v2-upgrade-guide.mdx

+6-7
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ func Create(ctx context.Context, *schema.ResourceData, meta any) diag.Diagnostic
147147
// this is the standard way to convert a Go error to Diagnostics
148148
return diag.FromErr(err)
149149
}
150-
150+
151151
// Warning or Errors can be collected in a slice type
152152
var diags diag.Diagnostics
153-
153+
154154
// Diagnostics supports warnings, a detailed message
155155
// as well as linking to a specific attribute
156156
// see github.com/hashicorp/go-cty for learning the Path types
@@ -176,11 +176,10 @@ func Create(ctx context.Context, *schema.ResourceData, meta any) diag.Diagnostic
176176

177177
The `helper/schema.Resource` and `helper/schema.Schema` types both now have
178178
`Description` properties that accept strings. These properties are laying the
179-
groundwork for future improvements to Terraform, and will have no visible
180-
effect to the Terraform CLI at the moment. If you’d like to build in support
181-
for your provider starting now, it’s recommended that you set these properties
182-
to whatever you’d document the resource or field as in your terraform.io docs
183-
for the resource.
179+
groundwork for future improvements to Terraform, and has no visible
180+
effect to the Terraform CLI at the moment. If you want to build in support
181+
for your provider starting now, we recommend that you set these properties
182+
to whatever you would document the resource or field as in your provider documentation for the resource.
184183

185184
You can globally set the format of the text in these fields by setting the
186185
global variable `helper/schema.DescriptionKind`. Its acceptable values are

Diff for: website/docs/plugin/sdkv2/index.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
page_title: 'Home - Plugin Development: SDKv2'
3-
description: Learn about version 2 of the Terraform Plugin SDK.
3+
description: Maintain plugins built on the legacy SDK.
44
---
55

66
# Terraform Plugin SDKv2
@@ -11,7 +11,7 @@ Terraform Plugin SDKv2 is an established way to develop Terraform Plugins on [pr
1111

1212
## Get Started
1313

14-
- Try the [Call APIs with Custom Providers](https://learn.hashicorp.com/collections/terraform/providers?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials on HashiCorp Learn.
14+
- Try the [Call APIs with Custom Providers](https://learn.hashicorp.com/collections/terraform/providers?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials.
1515
- Clone the [terraform-provider-scaffolding](https://github.com/hashicorp/terraform-provider-scaffolding) template repository on GitHub.
1616

1717
## Key Concepts

Diff for: website/docs/plugin/sdkv2/resources/import.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $ terraform import example_thing.foo abc123
1919

2020
Implementing import support requires three changes: an `Importer` `State` function in the resource code, a `TestStep` with `ImportState: true` in the acceptance tests, and documentation of the import ID format.
2121

22-
> **Hands-on:** Try the [Implement Import](https://learn.hashicorp.com/tutorials/terraform/provider-import?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial on HashiCorp Learn. In this tutorial, you will implement the import functionality on an example Terraform provider.
22+
> **Hands-on:** Try the [Implement Import](https://learn.hashicorp.com/tutorials/terraform/provider-import?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. In this tutorial, you can implement the import functionality on an example Terraform provider.
2323
2424
### Resource Code Implementation
2525

Diff for: website/docs/plugin/sdkv2/resources/index.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: >-
77

88
# Resources
99

10-
A key component to Terraform Provider development is defining the creation, read, update, and deletion functionality of a resource to map those API operations into the Terraform lifecycle. While the basic aspects of developing Terraform resources have already been covered in the [Call APIs with Terraform Providers Learn collection](https://learn.hashicorp.com/collections/terraform/providers?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) and [Schemas](/plugin/sdkv2/schemas), this section covers more advanced features of resource development.
10+
A key component to Terraform Provider development is defining the creation, read, update, and deletion functionality of a resource to map those API operations into the Terraform lifecycle. While the [Call APIs with Terraform Providers tutorial](https://learn.hashicorp.com/collections/terraform/providers?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) and [Schemas documentation](/plugin/sdkv2/schemas) cover the basic aspects of developing Terraform resources, this section covers more advanced features of resource development.
1111

1212
## Import
1313

Diff for: website/docs/plugin/sdkv2/testing/acceptance-tests/index.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ left over from testing and development.
3232

3333
Provider acceptance tests use a Terraform CLI binary to run real Terraform commands. The goal is to approximate using the provider with Terraform in production as closely as possible.
3434

35-
Terraform Core and Terraform Plugins act as gRPC client and server, implemented using HashiCorp's [go-plugin](https://github.com/hashicorp/go-plugin) system (see the [RPC Plugin Model](https://github.com/hashicorp/terraform/tree/main/docs/plugin-protocol) section of the Terraform Core documentation). When `go test` is run, the SDK's acceptance test framework starts a plugin server in the same process as the Go test framework. This plugin server runs for the duration of the test case, and each Terraform command (`terraform plan`, `terraform apply`, etc) creates a client that reattaches to this server.
35+
Terraform Core and Terraform Plugins act as gRPC client and server, implemented using HashiCorp's [go-plugin](https://github.com/hashicorp/go-plugin) system (refer to the [RPC Plugin Model](https://github.com/hashicorp/terraform/tree/main/docs/plugin-protocol) section of the Terraform documentation). When `go test` is run, the SDK's acceptance test framework starts a plugin server in the same process as the Go test framework. This plugin server runs for the duration of the test case, and each Terraform command (`terraform plan`, `terraform apply`, etc) creates a client that reattaches to this server.
3636

37-
Real-world Terraform usage requires a config file and Terraform working directory on the local filesystem. The framework uses the [`internal/plugintest` package](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest) to manage temporary directories and files during test runs. This library is not intended for use directly by provider developers.
37+
Real-world Terraform usage requires a config file and Terraform working directory on the local filesystem. The framework uses the [`internal/plugintest` package](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugintest) to manage temporary directories and files during test runs. Provider developers should not use this library directly.
3838

3939
While the test framework provides a reasonable simulation of real-world usage, there are some differences, the major one being in the lifecycle of the plugin gRPC server. During normal Terraform operation, the plugin server starts and stops once per graph walk, of which there may be several during one Terraform command. The acceptance test framework, however, maintains one plugin gRPC server for the duration of each test case. In theory, it is possible for providers to carry internal state between operations during tests - but providers would have to go out of their way (and the SDK's public API) to do this.
4040

Diff for: website/docs/plugin/sdkv2/testing/index.mdx

+4-10
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ description: |-
1010
Here we cover information needed to write successful tests for Terraform
1111
Plugins. Tests are a vital part of the Terraform ecosystem, verifying we can
1212
deliver on our mission to safely and predictably create, change, and improve
13-
infrastructure. Documentation for Terraform tests are broken into categories
14-
briefly described below. Each category has more detailed information by clicking
15-
on the matching item in the left navigation.
13+
infrastructure. Documentation for Terraform tests falls into categories
14+
briefly described on this page. Each category has more detailed information on a separate page within the documentation.
1615

17-
-> **Note:** Recent versions of Terraform CLI also support [developer overrides in the CLI configuration](/cli/config/config-file#development-overrides-for-provider-developers), which can be useful for manually testing providers. The acceptance testing framework uses real Terraform CLI executions, so developer overrides are only recommended as a last resort option for missing functionality.
16+
-> **Note:** Recent versions of Terraform CLI also support [developer overrides in the CLI configuration](/cli/config/config-file#development-overrides-for-provider-developers), which can be useful for manually testing providers. The acceptance testing framework uses real Terraform CLI executions, so we only recommend developer overrides as a last resort option for missing functionality.
1817

1918
## Acceptance Tests
2019

@@ -46,7 +45,7 @@ For a given plugin, Acceptance Tests can be run from the root of the project by
4645
using a common make task:
4746

4847
```shell
49-
$ make testacc
48+
$ make testacc
5049
```
5150

5251
See [Acceptance Testing](/plugin/sdkv2/testing/acceptance-tests) to learn more.
@@ -67,8 +66,3 @@ $ make test
6766
```
6867

6968
See [Unit Testing](/plugin/sdkv2/testing/unit-testing) to learn more.
70-
71-
## Next Steps
72-
73-
See the navigation on the left of this page for documentation and guides on
74-
writing tests for Terraform Plugins.

0 commit comments

Comments
 (0)