-
Notifications
You must be signed in to change notification settings - Fork 43
/
provider.go
102 lines (98 loc) · 3.64 KB
/
provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Copyright 2016-2023, Pulumi Corporation.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package tpinvschema
import (
"context"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
// An assortment of invalid resources according to
// https://github.com/pulumi/terraform-plugin-sdk/blob/b374785cb6462f8d89eb31d4874a9e3228d74633/helper/schema/resource.go#L1132
//
//nolint:lll
func Provider() *schema.Provider {
return &schema.Provider{
Schema: map[string]*schema.Schema{},
ResourcesMap: map[string]*schema.Resource{
"invalid_res": {
Schema: map[string]*schema.Schema{
"opt_and_req_prop": {
Type: schema.TypeString,
Optional: true,
Required: true,
},
},
Create: func(*schema.ResourceData, interface{}) error { return nil },
Update: func(*schema.ResourceData, interface{}) error { return nil },
Read: func(*schema.ResourceData, interface{}) error { return nil },
Delete: func(*schema.ResourceData, interface{}) error { return nil },
},
"no_read_res": {
Schema: map[string]*schema.Schema{},
Create: func(*schema.ResourceData, interface{}) error { return nil },
Delete: func(*schema.ResourceData, interface{}) error { return nil },
},
"block_string_res": {
Schema: map[string]*schema.Schema{
"block_string_prop": {
Type: schema.TypeString,
Required: true,
ConfigMode: schema.SchemaConfigModeBlock,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
Create: func(*schema.ResourceData, interface{}) error { return nil },
Update: func(*schema.ResourceData, interface{}) error { return nil },
Read: func(*schema.ResourceData, interface{}) error { return nil },
Delete: func(*schema.ResourceData, interface{}) error { return nil },
},
"computed_default_res": {
Schema: map[string]*schema.Schema{
"computed_default_prop": {
Type: schema.TypeString,
Computed: true,
Default: "default",
},
},
Create: func(*schema.ResourceData, interface{}) error { return nil },
Read: func(*schema.ResourceData, interface{}) error { return nil },
Delete: func(*schema.ResourceData, interface{}) error { return nil },
},
"max_string_res": {
Schema: map[string]*schema.Schema{
"max_string_prop": {
Type: schema.TypeString,
MaxItems: 1,
Optional: true,
},
},
Create: func(*schema.ResourceData, interface{}) error { return nil },
Update: func(*schema.ResourceData, interface{}) error { return nil },
Read: func(*schema.ResourceData, interface{}) error { return nil },
Delete: func(*schema.ResourceData, interface{}) error { return nil },
},
"create_and_create_context_res": {
Schema: map[string]*schema.Schema{},
Create: func(*schema.ResourceData, interface{}) error { return nil },
Read: func(*schema.ResourceData, interface{}) error { return nil },
Delete: func(*schema.ResourceData, interface{}) error { return nil },
CreateContext: func(context.Context, *schema.ResourceData, interface{}) diag.Diagnostics {
return nil
},
},
},
}
}