-
Notifications
You must be signed in to change notification settings - Fork 221
/
schema_secret_v2.go
73 lines (66 loc) · 1.53 KB
/
schema_secret_v2.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
package rancher2
import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
norman "github.com/rancher/norman/types"
"k8s.io/api/core/v1"
)
const (
secretV2Kind = "Secret"
secretV2APIVersion = "v1"
secretV2APIType = "secret"
secretV2ClusterIDsep = "."
)
//Types
type SecretV2 struct {
norman.Resource
v1.Secret
K8SType string `json:"_type,omitempty"`
}
func secretV2Fields() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"cluster_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "K8s cluster ID",
},
"data": {
Type: schema.TypeMap,
Required: true,
Sensitive: true,
Description: "Secret data map",
},
"name": {
Type: schema.TypeString,
Required: true,
Description: "K8s Secret name",
},
"namespace": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Default: "default",
Description: "K8s Secret namespace",
},
"immutable": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Description: "If set to true, ensures that data stored in the Secret cannot be updated",
},
"type": {
Type: schema.TypeString,
Optional: true,
Default: string(v1.SecretTypeOpaque),
Description: "Used to facilitate programmatic handling of Secret data",
},
"resource_version": {
Type: schema.TypeString,
Computed: true,
},
}
for k, v := range commonAnnotationLabelFields() {
s[k] = v
}
return s
}