forked from rancher/terraform-provider-rke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema_rke_cluster_authentication.go
65 lines (58 loc) · 1.63 KB
/
schema_rke_cluster_authentication.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
package rke
import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/helper/validation"
)
const (
rkeClusterAuthenticationStrategyX509 = "x509"
)
var (
rkeClusterAuthenticationStrategyList = []string{rkeClusterAuthenticationStrategyX509}
)
//Schemas
func rkeClusterAuthenticationWebhookFields() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"config_file": {
Type: schema.TypeString,
Optional: true,
Description: "Multiline string that represent a custom webhook config file",
},
"cache_timeout": {
Type: schema.TypeString,
Optional: true,
Description: "Controls how long to cache authentication decisions",
},
}
return s
}
func rkeClusterAuthenticationFields() map[string]*schema.Schema {
s := map[string]*schema.Schema{
"sans": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Description: "List of additional hostnames and IPs to include in the api server PKI cert",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"strategy": {
Type: schema.TypeString,
Optional: true,
Default: rkeClusterAuthenticationStrategyX509,
Description: "Authentication strategy that will be used in RKE k8s cluster",
ValidateFunc: validation.StringInSlice(rkeClusterAuthenticationStrategyList, false),
},
"webhook": {
Type: schema.TypeList,
MaxItems: 1,
Optional: true,
Computed: true,
Description: "Webhook configuration options",
Elem: &schema.Resource{
Schema: rkeClusterAuthenticationWebhookFields(),
},
},
}
return s
}