/
greTunnel.go
422 lines (365 loc) · 16.5 KB
/
greTunnel.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
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
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package cloudflare
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a resource, that manages GRE tunnels for Magic Transit.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := cloudflare.NewGreTunnel(ctx, "example", &cloudflare.GreTunnelArgs{
// AccountId: pulumi.String("f037e56e89293a057740de681ac9abbe"),
// CloudflareGreEndpoint: pulumi.String("203.0.113.2"),
// CustomerGreEndpoint: pulumi.String("203.0.113.1"),
// Description: pulumi.String("Tunnel for ISP X"),
// HealthCheckEnabled: pulumi.Bool(true),
// HealthCheckTarget: pulumi.String("203.0.113.1"),
// HealthCheckType: pulumi.String("reply"),
// InterfaceAddress: pulumi.String("192.0.2.0/31"),
// Mtu: pulumi.Int(1476),
// Name: pulumi.String("GRE_1"),
// Ttl: pulumi.Int(64),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// ```sh
// $ pulumi import cloudflare:index/greTunnel:GreTunnel example <account_id>/<tunnel_id>
// ```
type GreTunnel struct {
pulumi.CustomResourceState
// The account identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
AccountId pulumi.StringPtrOutput `pulumi:"accountId"`
// The IP address assigned to the Cloudflare side of the GRE tunnel.
CloudflareGreEndpoint pulumi.StringOutput `pulumi:"cloudflareGreEndpoint"`
// The IP address assigned to the customer side of the GRE tunnel.
CustomerGreEndpoint pulumi.StringOutput `pulumi:"customerGreEndpoint"`
// Description of the GRE tunnel intent.
Description pulumi.StringPtrOutput `pulumi:"description"`
// Specifies if ICMP tunnel health checks are enabled.
HealthCheckEnabled pulumi.BoolOutput `pulumi:"healthCheckEnabled"`
// The IP address of the customer endpoint that will receive tunnel health checks.
HealthCheckTarget pulumi.StringOutput `pulumi:"healthCheckTarget"`
// Specifies the ICMP echo type for the health check. Available values: `request`, `reply`.
HealthCheckType pulumi.StringOutput `pulumi:"healthCheckType"`
// 31-bit prefix (/31 in CIDR notation) supporting 2 hosts, one for each side of the tunnel.
InterfaceAddress pulumi.StringOutput `pulumi:"interfaceAddress"`
// Maximum Transmission Unit (MTU) in bytes for the GRE tunnel.
Mtu pulumi.IntOutput `pulumi:"mtu"`
// Name of the GRE tunnel.
Name pulumi.StringOutput `pulumi:"name"`
// Time To Live (TTL) in number of hops of the GRE tunnel.
Ttl pulumi.IntOutput `pulumi:"ttl"`
}
// NewGreTunnel registers a new resource with the given unique name, arguments, and options.
func NewGreTunnel(ctx *pulumi.Context,
name string, args *GreTunnelArgs, opts ...pulumi.ResourceOption) (*GreTunnel, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.CloudflareGreEndpoint == nil {
return nil, errors.New("invalid value for required argument 'CloudflareGreEndpoint'")
}
if args.CustomerGreEndpoint == nil {
return nil, errors.New("invalid value for required argument 'CustomerGreEndpoint'")
}
if args.InterfaceAddress == nil {
return nil, errors.New("invalid value for required argument 'InterfaceAddress'")
}
if args.Name == nil {
return nil, errors.New("invalid value for required argument 'Name'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource GreTunnel
err := ctx.RegisterResource("cloudflare:index/greTunnel:GreTunnel", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetGreTunnel gets an existing GreTunnel resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetGreTunnel(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *GreTunnelState, opts ...pulumi.ResourceOption) (*GreTunnel, error) {
var resource GreTunnel
err := ctx.ReadResource("cloudflare:index/greTunnel:GreTunnel", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering GreTunnel resources.
type greTunnelState struct {
// The account identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
AccountId *string `pulumi:"accountId"`
// The IP address assigned to the Cloudflare side of the GRE tunnel.
CloudflareGreEndpoint *string `pulumi:"cloudflareGreEndpoint"`
// The IP address assigned to the customer side of the GRE tunnel.
CustomerGreEndpoint *string `pulumi:"customerGreEndpoint"`
// Description of the GRE tunnel intent.
Description *string `pulumi:"description"`
// Specifies if ICMP tunnel health checks are enabled.
HealthCheckEnabled *bool `pulumi:"healthCheckEnabled"`
// The IP address of the customer endpoint that will receive tunnel health checks.
HealthCheckTarget *string `pulumi:"healthCheckTarget"`
// Specifies the ICMP echo type for the health check. Available values: `request`, `reply`.
HealthCheckType *string `pulumi:"healthCheckType"`
// 31-bit prefix (/31 in CIDR notation) supporting 2 hosts, one for each side of the tunnel.
InterfaceAddress *string `pulumi:"interfaceAddress"`
// Maximum Transmission Unit (MTU) in bytes for the GRE tunnel.
Mtu *int `pulumi:"mtu"`
// Name of the GRE tunnel.
Name *string `pulumi:"name"`
// Time To Live (TTL) in number of hops of the GRE tunnel.
Ttl *int `pulumi:"ttl"`
}
type GreTunnelState struct {
// The account identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
AccountId pulumi.StringPtrInput
// The IP address assigned to the Cloudflare side of the GRE tunnel.
CloudflareGreEndpoint pulumi.StringPtrInput
// The IP address assigned to the customer side of the GRE tunnel.
CustomerGreEndpoint pulumi.StringPtrInput
// Description of the GRE tunnel intent.
Description pulumi.StringPtrInput
// Specifies if ICMP tunnel health checks are enabled.
HealthCheckEnabled pulumi.BoolPtrInput
// The IP address of the customer endpoint that will receive tunnel health checks.
HealthCheckTarget pulumi.StringPtrInput
// Specifies the ICMP echo type for the health check. Available values: `request`, `reply`.
HealthCheckType pulumi.StringPtrInput
// 31-bit prefix (/31 in CIDR notation) supporting 2 hosts, one for each side of the tunnel.
InterfaceAddress pulumi.StringPtrInput
// Maximum Transmission Unit (MTU) in bytes for the GRE tunnel.
Mtu pulumi.IntPtrInput
// Name of the GRE tunnel.
Name pulumi.StringPtrInput
// Time To Live (TTL) in number of hops of the GRE tunnel.
Ttl pulumi.IntPtrInput
}
func (GreTunnelState) ElementType() reflect.Type {
return reflect.TypeOf((*greTunnelState)(nil)).Elem()
}
type greTunnelArgs struct {
// The account identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
AccountId *string `pulumi:"accountId"`
// The IP address assigned to the Cloudflare side of the GRE tunnel.
CloudflareGreEndpoint string `pulumi:"cloudflareGreEndpoint"`
// The IP address assigned to the customer side of the GRE tunnel.
CustomerGreEndpoint string `pulumi:"customerGreEndpoint"`
// Description of the GRE tunnel intent.
Description *string `pulumi:"description"`
// Specifies if ICMP tunnel health checks are enabled.
HealthCheckEnabled *bool `pulumi:"healthCheckEnabled"`
// The IP address of the customer endpoint that will receive tunnel health checks.
HealthCheckTarget *string `pulumi:"healthCheckTarget"`
// Specifies the ICMP echo type for the health check. Available values: `request`, `reply`.
HealthCheckType *string `pulumi:"healthCheckType"`
// 31-bit prefix (/31 in CIDR notation) supporting 2 hosts, one for each side of the tunnel.
InterfaceAddress string `pulumi:"interfaceAddress"`
// Maximum Transmission Unit (MTU) in bytes for the GRE tunnel.
Mtu *int `pulumi:"mtu"`
// Name of the GRE tunnel.
Name string `pulumi:"name"`
// Time To Live (TTL) in number of hops of the GRE tunnel.
Ttl *int `pulumi:"ttl"`
}
// The set of arguments for constructing a GreTunnel resource.
type GreTunnelArgs struct {
// The account identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
AccountId pulumi.StringPtrInput
// The IP address assigned to the Cloudflare side of the GRE tunnel.
CloudflareGreEndpoint pulumi.StringInput
// The IP address assigned to the customer side of the GRE tunnel.
CustomerGreEndpoint pulumi.StringInput
// Description of the GRE tunnel intent.
Description pulumi.StringPtrInput
// Specifies if ICMP tunnel health checks are enabled.
HealthCheckEnabled pulumi.BoolPtrInput
// The IP address of the customer endpoint that will receive tunnel health checks.
HealthCheckTarget pulumi.StringPtrInput
// Specifies the ICMP echo type for the health check. Available values: `request`, `reply`.
HealthCheckType pulumi.StringPtrInput
// 31-bit prefix (/31 in CIDR notation) supporting 2 hosts, one for each side of the tunnel.
InterfaceAddress pulumi.StringInput
// Maximum Transmission Unit (MTU) in bytes for the GRE tunnel.
Mtu pulumi.IntPtrInput
// Name of the GRE tunnel.
Name pulumi.StringInput
// Time To Live (TTL) in number of hops of the GRE tunnel.
Ttl pulumi.IntPtrInput
}
func (GreTunnelArgs) ElementType() reflect.Type {
return reflect.TypeOf((*greTunnelArgs)(nil)).Elem()
}
type GreTunnelInput interface {
pulumi.Input
ToGreTunnelOutput() GreTunnelOutput
ToGreTunnelOutputWithContext(ctx context.Context) GreTunnelOutput
}
func (*GreTunnel) ElementType() reflect.Type {
return reflect.TypeOf((**GreTunnel)(nil)).Elem()
}
func (i *GreTunnel) ToGreTunnelOutput() GreTunnelOutput {
return i.ToGreTunnelOutputWithContext(context.Background())
}
func (i *GreTunnel) ToGreTunnelOutputWithContext(ctx context.Context) GreTunnelOutput {
return pulumi.ToOutputWithContext(ctx, i).(GreTunnelOutput)
}
// GreTunnelArrayInput is an input type that accepts GreTunnelArray and GreTunnelArrayOutput values.
// You can construct a concrete instance of `GreTunnelArrayInput` via:
//
// GreTunnelArray{ GreTunnelArgs{...} }
type GreTunnelArrayInput interface {
pulumi.Input
ToGreTunnelArrayOutput() GreTunnelArrayOutput
ToGreTunnelArrayOutputWithContext(context.Context) GreTunnelArrayOutput
}
type GreTunnelArray []GreTunnelInput
func (GreTunnelArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*GreTunnel)(nil)).Elem()
}
func (i GreTunnelArray) ToGreTunnelArrayOutput() GreTunnelArrayOutput {
return i.ToGreTunnelArrayOutputWithContext(context.Background())
}
func (i GreTunnelArray) ToGreTunnelArrayOutputWithContext(ctx context.Context) GreTunnelArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(GreTunnelArrayOutput)
}
// GreTunnelMapInput is an input type that accepts GreTunnelMap and GreTunnelMapOutput values.
// You can construct a concrete instance of `GreTunnelMapInput` via:
//
// GreTunnelMap{ "key": GreTunnelArgs{...} }
type GreTunnelMapInput interface {
pulumi.Input
ToGreTunnelMapOutput() GreTunnelMapOutput
ToGreTunnelMapOutputWithContext(context.Context) GreTunnelMapOutput
}
type GreTunnelMap map[string]GreTunnelInput
func (GreTunnelMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*GreTunnel)(nil)).Elem()
}
func (i GreTunnelMap) ToGreTunnelMapOutput() GreTunnelMapOutput {
return i.ToGreTunnelMapOutputWithContext(context.Background())
}
func (i GreTunnelMap) ToGreTunnelMapOutputWithContext(ctx context.Context) GreTunnelMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(GreTunnelMapOutput)
}
type GreTunnelOutput struct{ *pulumi.OutputState }
func (GreTunnelOutput) ElementType() reflect.Type {
return reflect.TypeOf((**GreTunnel)(nil)).Elem()
}
func (o GreTunnelOutput) ToGreTunnelOutput() GreTunnelOutput {
return o
}
func (o GreTunnelOutput) ToGreTunnelOutputWithContext(ctx context.Context) GreTunnelOutput {
return o
}
// The account identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
func (o GreTunnelOutput) AccountId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *GreTunnel) pulumi.StringPtrOutput { return v.AccountId }).(pulumi.StringPtrOutput)
}
// The IP address assigned to the Cloudflare side of the GRE tunnel.
func (o GreTunnelOutput) CloudflareGreEndpoint() pulumi.StringOutput {
return o.ApplyT(func(v *GreTunnel) pulumi.StringOutput { return v.CloudflareGreEndpoint }).(pulumi.StringOutput)
}
// The IP address assigned to the customer side of the GRE tunnel.
func (o GreTunnelOutput) CustomerGreEndpoint() pulumi.StringOutput {
return o.ApplyT(func(v *GreTunnel) pulumi.StringOutput { return v.CustomerGreEndpoint }).(pulumi.StringOutput)
}
// Description of the GRE tunnel intent.
func (o GreTunnelOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *GreTunnel) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// Specifies if ICMP tunnel health checks are enabled.
func (o GreTunnelOutput) HealthCheckEnabled() pulumi.BoolOutput {
return o.ApplyT(func(v *GreTunnel) pulumi.BoolOutput { return v.HealthCheckEnabled }).(pulumi.BoolOutput)
}
// The IP address of the customer endpoint that will receive tunnel health checks.
func (o GreTunnelOutput) HealthCheckTarget() pulumi.StringOutput {
return o.ApplyT(func(v *GreTunnel) pulumi.StringOutput { return v.HealthCheckTarget }).(pulumi.StringOutput)
}
// Specifies the ICMP echo type for the health check. Available values: `request`, `reply`.
func (o GreTunnelOutput) HealthCheckType() pulumi.StringOutput {
return o.ApplyT(func(v *GreTunnel) pulumi.StringOutput { return v.HealthCheckType }).(pulumi.StringOutput)
}
// 31-bit prefix (/31 in CIDR notation) supporting 2 hosts, one for each side of the tunnel.
func (o GreTunnelOutput) InterfaceAddress() pulumi.StringOutput {
return o.ApplyT(func(v *GreTunnel) pulumi.StringOutput { return v.InterfaceAddress }).(pulumi.StringOutput)
}
// Maximum Transmission Unit (MTU) in bytes for the GRE tunnel.
func (o GreTunnelOutput) Mtu() pulumi.IntOutput {
return o.ApplyT(func(v *GreTunnel) pulumi.IntOutput { return v.Mtu }).(pulumi.IntOutput)
}
// Name of the GRE tunnel.
func (o GreTunnelOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *GreTunnel) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Time To Live (TTL) in number of hops of the GRE tunnel.
func (o GreTunnelOutput) Ttl() pulumi.IntOutput {
return o.ApplyT(func(v *GreTunnel) pulumi.IntOutput { return v.Ttl }).(pulumi.IntOutput)
}
type GreTunnelArrayOutput struct{ *pulumi.OutputState }
func (GreTunnelArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*GreTunnel)(nil)).Elem()
}
func (o GreTunnelArrayOutput) ToGreTunnelArrayOutput() GreTunnelArrayOutput {
return o
}
func (o GreTunnelArrayOutput) ToGreTunnelArrayOutputWithContext(ctx context.Context) GreTunnelArrayOutput {
return o
}
func (o GreTunnelArrayOutput) Index(i pulumi.IntInput) GreTunnelOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *GreTunnel {
return vs[0].([]*GreTunnel)[vs[1].(int)]
}).(GreTunnelOutput)
}
type GreTunnelMapOutput struct{ *pulumi.OutputState }
func (GreTunnelMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*GreTunnel)(nil)).Elem()
}
func (o GreTunnelMapOutput) ToGreTunnelMapOutput() GreTunnelMapOutput {
return o
}
func (o GreTunnelMapOutput) ToGreTunnelMapOutputWithContext(ctx context.Context) GreTunnelMapOutput {
return o
}
func (o GreTunnelMapOutput) MapIndex(k pulumi.StringInput) GreTunnelOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *GreTunnel {
return vs[0].(map[string]*GreTunnel)[vs[1].(string)]
}).(GreTunnelOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*GreTunnelInput)(nil)).Elem(), &GreTunnel{})
pulumi.RegisterInputType(reflect.TypeOf((*GreTunnelArrayInput)(nil)).Elem(), GreTunnelArray{})
pulumi.RegisterInputType(reflect.TypeOf((*GreTunnelMapInput)(nil)).Elem(), GreTunnelMap{})
pulumi.RegisterOutputType(GreTunnelOutput{})
pulumi.RegisterOutputType(GreTunnelArrayOutput{})
pulumi.RegisterOutputType(GreTunnelMapOutput{})
}