Skip to content

Commit fdc6d8f

Browse files
committed
Remove links to source code and make examples generic in migrating - attributes & blocks - blocks (#418)
1 parent ade54df commit fdc6d8f

File tree

1 file changed

+11
-22
lines changed
  • website/docs/plugin/framework/migrating/attributes-blocks

1 file changed

+11
-22
lines changed

website/docs/plugin/framework/migrating/attributes-blocks/blocks.mdx

+11-22
Original file line numberDiff line numberDiff line change
@@ -75,39 +75,28 @@ func (r *ThingResource) Schema(ctx context.Context, req resource.SchemaRequest,
7575
/* ... */
7676
```
7777
78-
7978
## Example
8079
81-
The following examples show how to migrate portions of the [tls](https://github.com/hashicorp/terraform-provider-tls)
82-
provider.
83-
84-
For a complete example, clone the
85-
`terraform-provider-tls` repository and compare the `common_cert.go` file in
86-
[v3.4.0](https://github.com/hashicorp/terraform-provider-tls/blob/v3.4.0/internal/provider/common_cert.go)
87-
with the `resource_cert_request.go` file in
88-
[v4.0.1](https://github.com/hashicorp/terraform-provider-tls/blob/v4.0.1/internal/provider/resource_cert_request.go).
89-
9080
### SDKv2
9181
92-
The following example from the `common_cert.go` file shows the implementation of the `subject` nested block on the
93-
`cert_request` resource's schema with SDKv2.
82+
The following example shows the implementation of the `example_nested_block` nested block with SDKv2.
9483
9584
```go
9685
map[string]*schema.Schema{
97-
"private_key_pem": &schema.Schema{
86+
"example_attribute": &schema.Schema{
9887
Type: schema.TypeString,
9988
/* ... */
10089

101-
"subject" = &schema.Schema{
90+
"example_nested_block" = &schema.Schema{
10291
Type: schema.TypeList,
10392
MaxItems: 1,
10493
Elem: &schema.Resource{
10594
Schema: map[string]*schema.Schema{
106-
"organization": {
95+
"example_block_attribute_one": {
10796
Type: schema.TypeString,
10897
/* ... */
10998
},
110-
"common_name": {
99+
"example_block_attribute_two": {
111100
Type: schema.TypeString,
112101
/* ... */
113102
},
@@ -116,23 +105,23 @@ map[string]*schema.Schema{
116105
117106
### Framework
118107
119-
The following example from the `resource_cert_request.go` file shows how the nested `subject` block on the
120-
`cert_request` resource is defined with the Framework after the migration.
108+
The following example shows how the nested `example_nested_block` block
109+
is defined with the Framework after the migration.
121110
122111
```go
123112
schema.Schema{
124113
Attributes: map[string]schema.Attribute{
125-
"private_key_pem": schema.StringAttribute{
114+
"example_attribute": schema.StringAttribute{
126115
/* ... */
127116

128117
Blocks: map[string]schema.Block{
129-
"subject": schema.ListNestedBlock{
118+
"example_nested_block": schema.ListNestedBlock{
130119
NestedObject: schema.NestedBlockObject{
131120
Attributes: map[string]schema.Attribute{
132-
"organization": schema.StringAttribute{
121+
"example_block_attribute_one": schema.StringAttribute{
133122
/* ... */
134123
},
135-
"common_name": schema.StringAttribute{
124+
"example_block_attribute_two": schema.StringAttribute{
136125
/* ... */
137126
},
138127
Validators: validator.List{

0 commit comments

Comments
 (0)