generated from pulumi/pulumi-tf-provider-boilerplate
/
listenerAclAttachment.go
440 lines (390 loc) · 20.4 KB
/
listenerAclAttachment.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
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
// 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 alb
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Application Load Balancer (ALB) Listener Acl Attachment resource.
//
// For information about Application Load Balancer (ALB) Listener Acl Attachment and how to use it, see [What is Listener Acl Attachment](https://www.alibabacloud.com/help/en/server-load-balancer/latest/associateaclswithlistener).
//
// > **NOTE:** Available in v1.163.0+.
//
// > **NOTE:** You can associate at most three ACLs with a listener.
//
// > **NOTE:** You can only configure either a whitelist or a blacklist for listener, not at the same time.
//
// ## Example Usage
//
// # Basic Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-alicloud/sdk/go/alicloud/alb"
// "github.com/pulumi/pulumi-alicloud/sdk/go/alicloud/resourcemanager"
// "github.com/pulumi/pulumi-alicloud/sdk/go/alicloud/vpc"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/rhysmdnz/pulumi-alicloud/sdk/go/alicloud/alb"
// "github.com/rhysmdnz/pulumi-alicloud/sdk/go/alicloud/resourcemanager"
// "github.com/rhysmdnz/pulumi-alicloud/sdk/go/alicloud/vpc"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// defaultResourceGroups, err := resourcemanager.GetResourceGroups(ctx, nil, nil)
// if err != nil {
// return err
// }
// defaultAcl, err := alb.NewAcl(ctx, "defaultAcl", &alb.AclArgs{
// AclName: pulumi.String("example_value"),
// ResourceGroupId: pulumi.String(defaultResourceGroups.Groups[0].Id),
// AclEntries: alb.AclAclEntryArray{
// &alb.AclAclEntryArgs{
// Description: pulumi.String("description"),
// Entry: pulumi.String("10.0.0.0/24"),
// },
// },
// })
// if err != nil {
// return err
// }
// defaultZones, err := alb.GetZones(ctx, nil, nil)
// if err != nil {
// return err
// }
// defaultNetworks, err := vpc.GetNetworks(ctx, &vpc.GetNetworksArgs{
// NameRegex: pulumi.StringRef("default-NODELETING"),
// }, nil)
// if err != nil {
// return err
// }
// default1, err := vpc.GetSwitches(ctx, &vpc.GetSwitchesArgs{
// VpcId: pulumi.StringRef(defaultNetworks.Ids[0]),
// ZoneId: pulumi.StringRef(defaultZones.Zones[0].Id),
// }, nil)
// if err != nil {
// return err
// }
// default2, err := vpc.GetSwitches(ctx, &vpc.GetSwitchesArgs{
// VpcId: pulumi.StringRef(defaultNetworks.Ids[0]),
// ZoneId: pulumi.StringRef(defaultZones.Zones[1].Id),
// }, nil)
// if err != nil {
// return err
// }
// defaultLoadBalancer, err := alb.NewLoadBalancer(ctx, "defaultLoadBalancer", &alb.LoadBalancerArgs{
// VpcId: pulumi.String(defaultNetworks.Ids[0]),
// AddressType: pulumi.String("Internet"),
// AddressAllocatedMode: pulumi.String("Fixed"),
// LoadBalancerName: pulumi.String("example_value"),
// LoadBalancerEdition: pulumi.String("Standard"),
// ResourceGroupId: pulumi.String(defaultResourceGroups.Groups[0].Id),
// LoadBalancerBillingConfig: &alb.LoadBalancerLoadBalancerBillingConfigArgs{
// PayType: pulumi.String("PayAsYouGo"),
// },
// Tags: pulumi.AnyMap{
// "Created": pulumi.Any("TF"),
// },
// ZoneMappings: alb.LoadBalancerZoneMappingArray{
// &alb.LoadBalancerZoneMappingArgs{
// VswitchId: pulumi.String(default1.Ids[0]),
// ZoneId: pulumi.String(defaultZones.Zones[0].Id),
// },
// &alb.LoadBalancerZoneMappingArgs{
// VswitchId: pulumi.String(default2.Ids[0]),
// ZoneId: pulumi.String(defaultZones.Zones[1].Id),
// },
// },
// ModificationProtectionConfig: &alb.LoadBalancerModificationProtectionConfigArgs{
// Status: pulumi.String("NonProtection"),
// },
// })
// if err != nil {
// return err
// }
// defaultServerGroup, err := alb.NewServerGroup(ctx, "defaultServerGroup", &alb.ServerGroupArgs{
// Protocol: pulumi.String("HTTP"),
// VpcId: pulumi.String(defaultNetworks.Vpcs[0].Id),
// ServerGroupName: pulumi.String("example_value"),
// ResourceGroupId: pulumi.String(defaultResourceGroups.Groups[0].Id),
// HealthCheckConfig: &alb.ServerGroupHealthCheckConfigArgs{
// HealthCheckEnabled: pulumi.Bool(false),
// },
// StickySessionConfig: &alb.ServerGroupStickySessionConfigArgs{
// StickySessionEnabled: pulumi.Bool(false),
// },
// Tags: pulumi.AnyMap{
// "Created": pulumi.Any("TF"),
// },
// })
// if err != nil {
// return err
// }
// defaultListener, err := alb.NewListener(ctx, "defaultListener", &alb.ListenerArgs{
// LoadBalancerId: defaultLoadBalancer.ID(),
// ListenerProtocol: pulumi.String("HTTP"),
// ListenerPort: pulumi.Int(80),
// ListenerDescription: pulumi.String("example_value"),
// DefaultActions: alb.ListenerDefaultActionArray{
// &alb.ListenerDefaultActionArgs{
// Type: pulumi.String("ForwardGroup"),
// ForwardGroupConfig: &alb.ListenerDefaultActionForwardGroupConfigArgs{
// ServerGroupTuples: alb.ListenerDefaultActionForwardGroupConfigServerGroupTupleArray{
// &alb.ListenerDefaultActionForwardGroupConfigServerGroupTupleArgs{
// ServerGroupId: defaultServerGroup.ID(),
// },
// },
// },
// },
// },
// })
// if err != nil {
// return err
// }
// _, err = alb.NewListenerAclAttachment(ctx, "defaultListenerAclAttachment", &alb.ListenerAclAttachmentArgs{
// AclId: defaultAcl.ID(),
// ListenerId: defaultListener.ID(),
// AclType: pulumi.String("White"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Application Load Balancer (ALB) Listener Acl Attachment can be imported using the id, e.g.
//
// ```sh
//
// $ pulumi import alicloud:alb/listenerAclAttachment:ListenerAclAttachment example <listener_id>:<acl_id>
//
// ```
type ListenerAclAttachment struct {
pulumi.CustomResourceState
// The ID of the Acl.
AclId pulumi.StringOutput `pulumi:"aclId"`
// The type of the ACL. Valid values:
// - White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
// - Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
AclType pulumi.StringOutput `pulumi:"aclType"`
// The ID of the ALB listener.
ListenerId pulumi.StringOutput `pulumi:"listenerId"`
// The status of the Listener Acl Attachment.
Status pulumi.StringOutput `pulumi:"status"`
}
// NewListenerAclAttachment registers a new resource with the given unique name, arguments, and options.
func NewListenerAclAttachment(ctx *pulumi.Context,
name string, args *ListenerAclAttachmentArgs, opts ...pulumi.ResourceOption) (*ListenerAclAttachment, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AclId == nil {
return nil, errors.New("invalid value for required argument 'AclId'")
}
if args.AclType == nil {
return nil, errors.New("invalid value for required argument 'AclType'")
}
if args.ListenerId == nil {
return nil, errors.New("invalid value for required argument 'ListenerId'")
}
opts = pkgResourceDefaultOpts(opts)
var resource ListenerAclAttachment
err := ctx.RegisterResource("alicloud:alb/listenerAclAttachment:ListenerAclAttachment", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetListenerAclAttachment gets an existing ListenerAclAttachment 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 GetListenerAclAttachment(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ListenerAclAttachmentState, opts ...pulumi.ResourceOption) (*ListenerAclAttachment, error) {
var resource ListenerAclAttachment
err := ctx.ReadResource("alicloud:alb/listenerAclAttachment:ListenerAclAttachment", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ListenerAclAttachment resources.
type listenerAclAttachmentState struct {
// The ID of the Acl.
AclId *string `pulumi:"aclId"`
// The type of the ACL. Valid values:
// - White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
// - Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
AclType *string `pulumi:"aclType"`
// The ID of the ALB listener.
ListenerId *string `pulumi:"listenerId"`
// The status of the Listener Acl Attachment.
Status *string `pulumi:"status"`
}
type ListenerAclAttachmentState struct {
// The ID of the Acl.
AclId pulumi.StringPtrInput
// The type of the ACL. Valid values:
// - White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
// - Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
AclType pulumi.StringPtrInput
// The ID of the ALB listener.
ListenerId pulumi.StringPtrInput
// The status of the Listener Acl Attachment.
Status pulumi.StringPtrInput
}
func (ListenerAclAttachmentState) ElementType() reflect.Type {
return reflect.TypeOf((*listenerAclAttachmentState)(nil)).Elem()
}
type listenerAclAttachmentArgs struct {
// The ID of the Acl.
AclId string `pulumi:"aclId"`
// The type of the ACL. Valid values:
// - White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
// - Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
AclType string `pulumi:"aclType"`
// The ID of the ALB listener.
ListenerId string `pulumi:"listenerId"`
}
// The set of arguments for constructing a ListenerAclAttachment resource.
type ListenerAclAttachmentArgs struct {
// The ID of the Acl.
AclId pulumi.StringInput
// The type of the ACL. Valid values:
// - White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
// - Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
AclType pulumi.StringInput
// The ID of the ALB listener.
ListenerId pulumi.StringInput
}
func (ListenerAclAttachmentArgs) ElementType() reflect.Type {
return reflect.TypeOf((*listenerAclAttachmentArgs)(nil)).Elem()
}
type ListenerAclAttachmentInput interface {
pulumi.Input
ToListenerAclAttachmentOutput() ListenerAclAttachmentOutput
ToListenerAclAttachmentOutputWithContext(ctx context.Context) ListenerAclAttachmentOutput
}
func (*ListenerAclAttachment) ElementType() reflect.Type {
return reflect.TypeOf((**ListenerAclAttachment)(nil)).Elem()
}
func (i *ListenerAclAttachment) ToListenerAclAttachmentOutput() ListenerAclAttachmentOutput {
return i.ToListenerAclAttachmentOutputWithContext(context.Background())
}
func (i *ListenerAclAttachment) ToListenerAclAttachmentOutputWithContext(ctx context.Context) ListenerAclAttachmentOutput {
return pulumi.ToOutputWithContext(ctx, i).(ListenerAclAttachmentOutput)
}
// ListenerAclAttachmentArrayInput is an input type that accepts ListenerAclAttachmentArray and ListenerAclAttachmentArrayOutput values.
// You can construct a concrete instance of `ListenerAclAttachmentArrayInput` via:
//
// ListenerAclAttachmentArray{ ListenerAclAttachmentArgs{...} }
type ListenerAclAttachmentArrayInput interface {
pulumi.Input
ToListenerAclAttachmentArrayOutput() ListenerAclAttachmentArrayOutput
ToListenerAclAttachmentArrayOutputWithContext(context.Context) ListenerAclAttachmentArrayOutput
}
type ListenerAclAttachmentArray []ListenerAclAttachmentInput
func (ListenerAclAttachmentArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ListenerAclAttachment)(nil)).Elem()
}
func (i ListenerAclAttachmentArray) ToListenerAclAttachmentArrayOutput() ListenerAclAttachmentArrayOutput {
return i.ToListenerAclAttachmentArrayOutputWithContext(context.Background())
}
func (i ListenerAclAttachmentArray) ToListenerAclAttachmentArrayOutputWithContext(ctx context.Context) ListenerAclAttachmentArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ListenerAclAttachmentArrayOutput)
}
// ListenerAclAttachmentMapInput is an input type that accepts ListenerAclAttachmentMap and ListenerAclAttachmentMapOutput values.
// You can construct a concrete instance of `ListenerAclAttachmentMapInput` via:
//
// ListenerAclAttachmentMap{ "key": ListenerAclAttachmentArgs{...} }
type ListenerAclAttachmentMapInput interface {
pulumi.Input
ToListenerAclAttachmentMapOutput() ListenerAclAttachmentMapOutput
ToListenerAclAttachmentMapOutputWithContext(context.Context) ListenerAclAttachmentMapOutput
}
type ListenerAclAttachmentMap map[string]ListenerAclAttachmentInput
func (ListenerAclAttachmentMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ListenerAclAttachment)(nil)).Elem()
}
func (i ListenerAclAttachmentMap) ToListenerAclAttachmentMapOutput() ListenerAclAttachmentMapOutput {
return i.ToListenerAclAttachmentMapOutputWithContext(context.Background())
}
func (i ListenerAclAttachmentMap) ToListenerAclAttachmentMapOutputWithContext(ctx context.Context) ListenerAclAttachmentMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ListenerAclAttachmentMapOutput)
}
type ListenerAclAttachmentOutput struct{ *pulumi.OutputState }
func (ListenerAclAttachmentOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ListenerAclAttachment)(nil)).Elem()
}
func (o ListenerAclAttachmentOutput) ToListenerAclAttachmentOutput() ListenerAclAttachmentOutput {
return o
}
func (o ListenerAclAttachmentOutput) ToListenerAclAttachmentOutputWithContext(ctx context.Context) ListenerAclAttachmentOutput {
return o
}
// The ID of the Acl.
func (o ListenerAclAttachmentOutput) AclId() pulumi.StringOutput {
return o.ApplyT(func(v *ListenerAclAttachment) pulumi.StringOutput { return v.AclId }).(pulumi.StringOutput)
}
// The type of the ACL. Valid values:
// - White: a whitelist. Only requests from the IP addresses or CIDR blocks in the ACL are forwarded. The whitelist applies to scenarios in which you want to allow only specific IP addresses to access an application. Risks may arise if you specify an ACL as a whitelist. After a whitelist is configured, only IP addresses in the whitelist can access the Application Load Balancer (ALB) listener. If you enable a whitelist but the whitelist does not contain an IP address, the listener forwards all requests.
// - Black: a blacklist. All requests from the IP addresses or CIDR blocks in the ACL are blocked. The blacklist applies to scenarios in which you want to block access from specific IP addresses to an application. If you enable a blacklist but the blacklist does not contain an IP address, the listener forwards all requests.
func (o ListenerAclAttachmentOutput) AclType() pulumi.StringOutput {
return o.ApplyT(func(v *ListenerAclAttachment) pulumi.StringOutput { return v.AclType }).(pulumi.StringOutput)
}
// The ID of the ALB listener.
func (o ListenerAclAttachmentOutput) ListenerId() pulumi.StringOutput {
return o.ApplyT(func(v *ListenerAclAttachment) pulumi.StringOutput { return v.ListenerId }).(pulumi.StringOutput)
}
// The status of the Listener Acl Attachment.
func (o ListenerAclAttachmentOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *ListenerAclAttachment) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
type ListenerAclAttachmentArrayOutput struct{ *pulumi.OutputState }
func (ListenerAclAttachmentArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ListenerAclAttachment)(nil)).Elem()
}
func (o ListenerAclAttachmentArrayOutput) ToListenerAclAttachmentArrayOutput() ListenerAclAttachmentArrayOutput {
return o
}
func (o ListenerAclAttachmentArrayOutput) ToListenerAclAttachmentArrayOutputWithContext(ctx context.Context) ListenerAclAttachmentArrayOutput {
return o
}
func (o ListenerAclAttachmentArrayOutput) Index(i pulumi.IntInput) ListenerAclAttachmentOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ListenerAclAttachment {
return vs[0].([]*ListenerAclAttachment)[vs[1].(int)]
}).(ListenerAclAttachmentOutput)
}
type ListenerAclAttachmentMapOutput struct{ *pulumi.OutputState }
func (ListenerAclAttachmentMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ListenerAclAttachment)(nil)).Elem()
}
func (o ListenerAclAttachmentMapOutput) ToListenerAclAttachmentMapOutput() ListenerAclAttachmentMapOutput {
return o
}
func (o ListenerAclAttachmentMapOutput) ToListenerAclAttachmentMapOutputWithContext(ctx context.Context) ListenerAclAttachmentMapOutput {
return o
}
func (o ListenerAclAttachmentMapOutput) MapIndex(k pulumi.StringInput) ListenerAclAttachmentOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ListenerAclAttachment {
return vs[0].(map[string]*ListenerAclAttachment)[vs[1].(string)]
}).(ListenerAclAttachmentOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ListenerAclAttachmentInput)(nil)).Elem(), &ListenerAclAttachment{})
pulumi.RegisterInputType(reflect.TypeOf((*ListenerAclAttachmentArrayInput)(nil)).Elem(), ListenerAclAttachmentArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ListenerAclAttachmentMapInput)(nil)).Elem(), ListenerAclAttachmentMap{})
pulumi.RegisterOutputType(ListenerAclAttachmentOutput{})
pulumi.RegisterOutputType(ListenerAclAttachmentArrayOutput{})
pulumi.RegisterOutputType(ListenerAclAttachmentMapOutput{})
}