generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 40
/
k8s_cluster_data_source.go
182 lines (176 loc) · 5.7 KB
/
k8s_cluster_data_source.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
package connector
import (
"fmt"
"strings"
"github.com/harness/harness-go-sdk/harness/nextgen"
"github.com/harness/terraform-provider-harness/helpers"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func DatasourceConnectorKubernetes() *schema.Resource {
resource := &schema.Resource{
Description: "Datasource for looking up a Kubernetes connector.",
ReadContext: resourceConnectorK8sRead,
Schema: map[string]*schema.Schema{
"inherit_from_delegate": {
Description: "Credentials are inherited from the delegate.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"delegate_selectors": {
Description: "Selectors to use for the delegate.",
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
},
},
},
"delegate_selectors": {
Description: "Selectors to use for the delegate.",
Type: schema.TypeSet,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
"username_password": {
Description: "Username and password for the connector.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"master_url": {
Description: "The URL of the Kubernetes cluster.",
Type: schema.TypeString,
Computed: true,
},
"username": {
Description: "Username for the connector.",
Type: schema.TypeString,
Computed: true,
},
"username_ref": {
Description: "Reference to the secret containing the username for the connector.",
Type: schema.TypeString,
Computed: true,
},
"password_ref": {
Description: "Reference to the secret containing the password for the connector.",
Type: schema.TypeString,
Computed: true,
},
},
},
},
"service_account": {
Description: "Service account for the connector.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"master_url": {
Description: "The URL of the Kubernetes cluster.",
Type: schema.TypeString,
Computed: true,
},
"service_account_token_ref": {
Description: "Reference to the secret containing the service account token for the connector.",
Type: schema.TypeString,
Computed: true,
},
},
},
},
"openid_connect": {
Description: "OpenID configuration for the connector.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"master_url": {
Description: "The URL of the Kubernetes cluster.",
Type: schema.TypeString,
Computed: true,
},
"issuer_url": {
Description: "The URL of the OpenID Connect issuer.",
Type: schema.TypeString,
Computed: true,
},
"username": {
Description: "Username for the connector.",
Type: schema.TypeString,
Computed: true,
},
"username_ref": {
Description: "Reference to the secret containing the username for the connector.",
Type: schema.TypeString,
Computed: true,
},
"client_id_ref": {
Description: "Reference to the secret containing the client ID for the connector.",
Type: schema.TypeString,
Computed: true,
},
"password_ref": {
Description: "Reference to the secret containing the password for the connector.",
Type: schema.TypeString,
Computed: true,
},
"secret_ref": {
Description: "Reference to the secret containing the client secret for the connector.",
Type: schema.TypeString,
Computed: true,
},
"scopes": {
Description: "Scopes to request for the connector.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{Type: schema.TypeString},
},
},
},
},
"client_key_cert": {
Description: "Client key and certificate config for the connector.",
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"master_url": {
Description: "The URL of the Kubernetes cluster.",
Type: schema.TypeString,
Computed: true,
},
"ca_cert_ref": {
Description: "Reference to the secret containing the CA certificate for the connector.",
Type: schema.TypeString,
Computed: true,
},
"client_cert_ref": {
Description: "Reference to the secret containing the client certificate for the connector.",
Type: schema.TypeString,
Computed: true,
},
"client_key_ref": {
Description: "Reference to the secret containing the client key for the connector.",
Type: schema.TypeString,
Computed: true,
},
"client_key_passphrase_ref": {
Description: "Reference to the secret containing the client key passphrase for the connector.",
Type: schema.TypeString,
Computed: true,
},
"client_key_algorithm": {
Description: fmt.Sprintf("The algorithm used to generate the client key for the connector. Valid values are %s", strings.Join(nextgen.ClientKeyAlgorithmsSlice, ", ")),
Type: schema.TypeString,
Computed: true,
},
},
},
},
},
}
helpers.SetMultiLevelDatasourceSchema(resource.Schema)
return resource
}