forked from gravitational/teleport-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
protoc-gen-terraform-teleport.yaml
339 lines (299 loc) · 10.3 KB
/
protoc-gen-terraform-teleport.yaml
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
---
target_package_name: "tfschema"
default_package_name: "github.com/gravitational/teleport/api/types"
duration_custom_type: Duration
use_state_for_unknown_by_default: true
# Top-level type names to export
types:
- "AppV3"
- "AuthPreferenceV2"
- "ClusterNetworkingConfigV2"
- "DatabaseV3"
- "GithubConnectorV3"
- "OIDCConnectorV3"
- "ProvisionTokenV2"
- "RoleV5"
- "SAMLConnectorV2"
- "SessionRecordingConfigV2"
- "TrustedClusterV2"
- "UserV2"
# id field is required for integration tests. It is not used by provider.
# We have to add it manually (might be removed in the future versions).
injected_fields:
AppV3:
-
name: id
type: github.com/hashicorp/terraform-plugin-framework/types.StringType
computed: true
plan_modifiers:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
AuthPreferenceV2:
-
name: id
type: github.com/hashicorp/terraform-plugin-framework/types.StringType
computed: true
plan_modifiers:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
ClusterNetworkingConfigV2:
-
name: id
type: github.com/hashicorp/terraform-plugin-framework/types.StringType
computed: true
plan_modifiers:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
DatabaseV3:
-
name: id
type: github.com/hashicorp/terraform-plugin-framework/types.StringType
computed: true
plan_modifiers:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
GithubConnectorV3:
-
name: id
type: github.com/hashicorp/terraform-plugin-framework/types.StringType
computed: true
plan_modifiers:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
OIDCConnectorV3:
-
name: id
type: github.com/hashicorp/terraform-plugin-framework/types.StringType
computed: true
plan_modifiers:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
ProvisionTokenV2:
-
name: id
type: github.com/hashicorp/terraform-plugin-framework/types.StringType
computed: true
plan_modifiers:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
RoleV5:
-
name: id
type: github.com/hashicorp/terraform-plugin-framework/types.StringType
computed: true
plan_modifiers:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
SAMLConnectorV2:
-
name: id
type: github.com/hashicorp/terraform-plugin-framework/types.StringType
computed: true
plan_modifiers:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
SessionRecordingConfigV2:
-
name: id
type: github.com/hashicorp/terraform-plugin-framework/types.StringType
computed: true
plan_modifiers:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
TrustedClusterV2:
-
name: id
type: github.com/hashicorp/terraform-plugin-framework/types.StringType
computed: true
plan_modifiers:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
UserV2:
-
name: id
type: github.com/hashicorp/terraform-plugin-framework/types.StringType
computed: true
plan_modifiers:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
# These fields will be excluded
exclude_fields:
# Metadata (we id resources by name on our side)
- "Metadata.ID"
# AuthPreference
- "AuthPreferenceV2.Metadata.Name" # It's a signleton resource
# NetworkingConfig
- "ClusterNetworkingConfigV2.Metadata.Name" # It's a signleton resource
# Status
- "DatabaseV3.Status"
# Role
- "RoleV5.Spec.Allow.Namespaces" # These fields are not settable via API
- "RoleV5.Spec.Deny.Namespaces"
# SessionRecordingConfig
- "SessionRecordingConfigV2.Metadata.Name" # It's a signleton resource
# User
- "UserSpecV2.LocalAuth" # We do not need to set user auth data
- "UserSpecV2.Expires" # Those fields are Teleport side meta, we do not need to change them via Terraform
- "UserSpecV2.CreatedBy"
- "UserSpecV2.Status"
# These fields will be marked as Computed: true
computed_fields:
# Metadata
- "Metadata.Namespace"
# App
- "AppV3.Metadata.Labels"
- "AppV3.Kind"
- "AppV3.Version"
# Auth preference
- "AuthPreferenceV2.Spec.SecondFactor"
- "AuthPreferenceV2.Spec.Type"
- "AuthPreferenceV2.Spec.LockingMode"
- "AuthPreferenceV2.Metadata.Namespace"
- "AuthPreferenceV2.Metadata.Labels"
- "AuthPreferenceV2.Kind"
- "AuthPreferenceV2.Version"
# Cluster networking
- "ClusterNetworkingConfigV2.Spec.KeepAliveCountMax"
- "ClusterNetworkingConfigV2.Spec.KeepAliveInterval"
- "ClusterNetworkingConfigV2.Kind"
- "ClusterNetworkingConfigV2.Version"
# Database
- "DatabaseV3.Kind"
- "DatabaseV3.Version"
# Github connector
- "GithubConnectorV3.Kind"
- "GithubConnectorV3.Version"
# Provision token
- "ProvisionTokenV2.Spec.AWSIIDTTL"
- "ProvisionTokenV2.Kind"
- "ProvisionTokenV2.Metadata.Name"
- "ProvisionTokenV2.Version"
# OIDC connector
- "OIDCConnectorV3.Kind"
- "OIDCConnectorV3.Version"
# Role
- "RoleV5.Spec.Options.MaxSessionTTL"
- "RoleV5.Spec.Options.CertificateFormat"
- "RoleV5.Spec.Options.BPF"
- "RoleV5.Kind"
- "RoleV5.Version"
# SAML connector
- "SAMLConnectorV2.Spec.Audience"
- "SAMLConnectorV2.Spec.Issuer"
- "SAMLConnectorV2.Spec.ServiceProviderIssuer"
- "SAMLConnectorV2.Spec.SSO"
- "SAMLConnectorV2.Spec.SigningKeyPair"
- "SAMLConnectorV2.Spec.SigningKeyPair.PrivateKey"
- "SAMLConnectorV2.Spec.SigningKeyPair.Cert"
- "SAMLConnectorV2.Spec.EncryprionKeyPair"
- "SAMLConnectorV2.Spec.EncryptionKeyPair.PrivateKey"
- "SAMLConnectorV2.Spec.EncryptionKeyPair.Cert"
- "SAMLConnectorV2.Kind"
- "SAMLConnectorV2.Version"
# Session recording
- "SessionRecordingConfigV2.Spec.Mode"
- "SessionRecordingConfigV2.Kind"
- "SessionRecordingConfigV2.Version"
# Trusted cluster
- "TrustedClusterV2.Kind"
- "TrustedClusterV2.Version"
# User
- "UserV2.Kind"
- "UserV2.Version"
# These fields will be marked as Required: true
required_fields:
# App
- "AppV3.Metadata.Name"
# Auth preference
- "AuthPreferenceV2.Spec"
- "AuthPreferenceV2.Metadata.Name"
# Database
- "DatabaseV3.Spec.Protocol"
- "DatabaseV3.Spec.URI"
- "DatabaseV3.Metadata.Name"
# Github connector
- "GithubConnectorV3.Spec"
- "GithubConnectorV3.Spec.ClientID"
- "GithubConnectorV3.Spec.ClientSecret"
- "GithubConnectorV3.Spec.TeamsToLogins"
- "GithubConnectorV3.Spec.TeamsToLogins.Team"
- "GithubConnectorV3.Spec.TeamsToLogins.Logins"
- "GithubConnectorV3.Metadata.Name"
# OIDC connector
- "OIDCConnectorV3.Spec"
- "OIDCConnectorV3.Metadata.Name"
# Provision token
- "ProvisionTokenV2.Spec"
- "ProvisionTokenV2.Spec.Options"
- "ProvisionTokenV2.Spec.Roles"
- "ProvisionTokenV2.Metadata.Expires"
# Role
- "RoleV5.Metadata.Name"
# SAML connector
- "SAMLConnectorV2.Spec"
- "SAMLConnectorV2.Spec.AssertionConsumerService"
- "SAMLConnectorV2.Spec.AttributesToRoles"
- "SAMLConnectorV2.Metadata.Name"
# Trusted cluster
- "TrustedClusterV2.Metadata.Name"
- "TrustedClusterV2.Spec"
# User
- "UserV2.Metadata.Name"
# These fields must be marked as sensitive
sensitive_fields:
- "ProvisionTokenV2.Metadata.Name"
- "SAMLConnectorV2.Spec.Cert"
- "SAMLConnectorV2.Spec.SigningKeyPair.PrivateKey"
- "SAMLConnectorV2.Spec.EncryptionKeyPair.PrivateKey"
- "SAMLConnectorV2.Spec.EntityDescriptor"
- "GithubConnectorV3.Spec.ClientSecret"
- "OIDCConnectorV3.Spec.ClientSecret"
- "OIDCConnectorV3.Spec.GoogleServiceAccount"
# These suffixes for custom methods called when field has custom_type flag. By default they might be weird.
suffixes:
"BoolOption": "BoolOption" # This is listed here for convenience. Just to have all custom method names in a single place.
"Labels": "Labels"
"github.com/gravitational/teleport/api/types/wrappers.Traits": "Traits"
"github.com/gravitational/teleport/api/types/wrappers.Strings": "Strings"
plan_modifiers:
# Force to recreate resource if it's name changes
Metadata.Name:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.RequiresReplace()"
ProvisionTokenV2.Metadata.Name:
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.RequiresReplace()"
- "github.com/hashicorp/terraform-plugin-framework/tfsdk.UseStateForUnknown()"
validators:
# Expires must be in the future
Metadata.Expires:
- MustTimeBeInFuture()
AppV3.Version:
- UseVersionBetween(3,3)
AuthPreferenceV2.Version:
- UseVersionBetween(2,2)
AuthPreferenceV2.Metadata.Labels:
- UseMapKeysPresentValidator("teleport.dev/origin")
ClusterNetworkingConfigV2.Version:
- UseVersionBetween(2,2)
ClusterNetworkingConfigV2.Metadata.Labels:
- UseMapKeysPresentValidator("teleport.dev/origin")
DatabaseV3.Version:
- UseVersionBetween(3,3)
DatabaseV3.Metadata.Labels:
- UseMapKeysPresentValidator("teleport.dev/origin")
GithubConnectorV3.Version:
- UseVersionBetween(3,3)
OIDCConnectorV3.Version:
- UseVersionBetween(3,3)
ProvisionTokenV2.Version:
- UseVersionBetween(2,2)
RoleV5.Version:
- UseVersionBetween(3,5)
SAMLConnectorV2.Version:
- UseVersionBetween(2,2)
SAMLConnectorV2.Spec:
- UseAnyOfValidator("entity_descriptor", "entity_descriptor_url")
SessionRecordingConfigV2.Version:
- UseVersionBetween(2,2)
SessionRecordingConfigV2.Metadata.Labels:
- UseMapKeysPresentValidator("teleport.dev/origin")
UserV2.Version:
- UseVersionBetween(2,2)
time_type:
type: "TimeType"
value_type: "TimeValue"
cast_to_type: "time.Time"
cast_from_type: "time.Time"
type_constructor: UseRFC3339Time()
duration_type:
type: "DurationType"
value_type: "DurationValue"
cast_to_type: "time.Duration"
cast_from_type: "time.Duration"