@@ -73,28 +73,18 @@ map[string]schema.Attribute{
73
73
74
74
## Example
75
75
76
- The following examples show how to migrate portions of the [tls](https://github.com/hashicorp/terraform-provider-tls)
77
- provider.
78
-
79
- For a complete example, clone the
80
- ` terraform-provider-tls` repository and compare the ` data_source_certificate.go ` file in
81
- [v3.4.0](https://github.com/hashicorp/terraform-provider-tls/blob/v3.4.0/internal/provider/data_source_certificate.go)
82
- with
83
- [v4.0.1](https://github.com/hashicorp/terraform-provider-tls/blob/v4.0.1/internal/provider/data_source_certificate.go).
84
-
85
76
### SDKv2
86
77
87
- The following example from the ` data_source_certificate.go ` file shows the implementation of the ` certificates` nested
88
- block on the ` certificate` data source's schema.
78
+ The following example shows the implementation of the ` example_nested_block` with SDKv2.
89
79
90
80
` ` ` go
91
81
Schema: map [string ]*schema.Schema {
92
- " certificates " : {
82
+ " example_nested_block " : {
93
83
Type: schema.TypeList ,
94
84
Computed: true ,
95
85
Elem: &schema.Resource {
96
86
Schema: map [string ]*schema.Schema {
97
- " signature_algorithm " : {
87
+ " example_block_attribute " : {
98
88
Type: schema.TypeString ,
99
89
Computed: true ,
100
90
/* ... */
@@ -105,15 +95,15 @@ Schema: map[string]*schema.Schema{
105
95
106
96
The following shows the same section of provider code after the migration.
107
97
108
- This code defines the ` certificates ` block as an attribute on the ` certificate ` data source's schema, where the
98
+ This code defines the ` example_nested_block ` block as an attribute on the schema, where the
109
99
` types.ObjectType ` is being used to define the nested block.
110
100
111
101
` ` ` go
112
102
map [string ]schema.Attribute {
113
- " certificates " : schema.ListAttribute {
103
+ " example_nested_block " : schema.ListAttribute {
114
104
ElementType: types.ObjectType {
115
105
AttrTypes: map [string ]attr.Type {
116
- " signature_algorithm " : types.StringType ,
106
+ " example_block_attribute " : types.StringType ,
117
107
},
118
108
},
119
109
Computed: true ,
0 commit comments