generated from pulumi/pulumi-component-provider-go-boilerplate
/
applicationLoadBalancer.go
310 lines (263 loc) · 16 KB
/
applicationLoadBalancer.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
// Code generated by Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package lb
import (
"context"
"reflect"
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/lb"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/zchase/pulumi-awsx-go/sdk/go/awsx-go"
)
// Provides an Application Load Balancer resource with listeners, default target group and default security group.
type ApplicationLoadBalancer struct {
pulumi.ResourceState
// Default security group, if auto-created
DefaultSecurityGroup ec2.SecurityGroupOutput `pulumi:"defaultSecurityGroup"`
// Default target group, if auto-created
DefaultTargetGroup lb.TargetGroupOutput `pulumi:"defaultTargetGroup"`
// Listeners created as part of this load balancer
Listeners lb.ListenerArrayOutput `pulumi:"listeners"`
// Underlying Load Balancer resource
LoadBalancer lb.LoadBalancerOutput `pulumi:"loadBalancer"`
// Id of the VPC in which this load balancer is operating
VpcId pulumi.StringPtrOutput `pulumi:"vpcId"`
}
// NewApplicationLoadBalancer registers a new resource with the given unique name, arguments, and options.
func NewApplicationLoadBalancer(ctx *pulumi.Context,
name string, args *ApplicationLoadBalancerArgs, opts ...pulumi.ResourceOption) (*ApplicationLoadBalancer, error) {
if args == nil {
args = &ApplicationLoadBalancerArgs{}
}
if args.DefaultSecurityGroup != nil {
args.DefaultSecurityGroup = args.DefaultSecurityGroup.Defaults()
}
var resource ApplicationLoadBalancer
err := ctx.RegisterRemoteComponentResource("awsx-go:lb:ApplicationLoadBalancer", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
type applicationLoadBalancerArgs struct {
// An Access Logs block. Access Logs documented below.
AccessLogs *lb.LoadBalancerAccessLogs `pulumi:"accessLogs"`
// The ID of the customer owned ipv4 pool to use for this load balancer.
CustomerOwnedIpv4Pool *string `pulumi:"customerOwnedIpv4Pool"`
// Options for creating a default security group if [securityGroups] not specified.
DefaultSecurityGroup *awsxgo.DefaultSecurityGroup `pulumi:"defaultSecurityGroup"`
// Options creating a default target group.
DefaultTargetGroup *TargetGroup `pulumi:"defaultTargetGroup"`
// Determines how the load balancer handles requests that might pose a security risk to an application due to HTTP desync. Valid values are `monitor`, `defensive` (default), `strictest`.
DesyncMitigationMode *string `pulumi:"desyncMitigationMode"`
// Indicates whether HTTP headers with header fields that are not valid are removed by the load balancer (true) or routed to targets (false). The default is false. Elastic Load Balancing requires that message header names contain only alphanumeric characters and hyphens. Only valid for Load Balancers of type `application`.
DropInvalidHeaderFields *bool `pulumi:"dropInvalidHeaderFields"`
// If true, deletion of the load balancer will be disabled via
// the AWS API. This will prevent this provider from deleting the load balancer. Defaults to `false`.
EnableDeletionProtection *bool `pulumi:"enableDeletionProtection"`
// Indicates whether HTTP/2 is enabled in `application` load balancers. Defaults to `true`.
EnableHttp2 *bool `pulumi:"enableHttp2"`
// Indicates whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to AWS WAF. Defaults to `false`.
EnableWafFailOpen *bool `pulumi:"enableWafFailOpen"`
// The time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type `application`. Default: 60.
IdleTimeout *int `pulumi:"idleTimeout"`
// If true, the LB will be internal.
Internal *bool `pulumi:"internal"`
// The type of IP addresses used by the subnets for your load balancer. The possible values are `ipv4` and `dualstack`
IpAddressType *string `pulumi:"ipAddressType"`
// A listener to create. Only one of [listener] and [listeners] can be specified.
Listener *Listener `pulumi:"listener"`
// List of listeners to create. Only one of [listener] and [listeners] can be specified.
Listeners []Listener `pulumi:"listeners"`
// The name of the LB. This name must be unique within your AWS account, can have a maximum of 32 characters,
// must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen. If not specified,
// this provider will autogenerate a name beginning with `tf-lb`.
Name *string `pulumi:"name"`
// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
NamePrefix *string `pulumi:"namePrefix"`
// A list of security group IDs to assign to the LB. Only valid for Load Balancers of type `application`.
SecurityGroups []string `pulumi:"securityGroups"`
// A list of subnet IDs to attach to the LB. Subnets
// cannot be updated for Load Balancers of type `network`. Changing this value
// for load balancers of type `network` will force a recreation of the resource.
SubnetIds []string `pulumi:"subnetIds"`
// A subnet mapping block as documented below.
SubnetMappings []lb.LoadBalancerSubnetMapping `pulumi:"subnetMappings"`
// A list of subnets to attach to the LB. Only one of [subnets], [subnetIds] or [subnetMappings] can be specified
Subnets []*ec2.Subnet `pulumi:"subnets"`
// A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
}
// The set of arguments for constructing a ApplicationLoadBalancer resource.
type ApplicationLoadBalancerArgs struct {
// An Access Logs block. Access Logs documented below.
AccessLogs lb.LoadBalancerAccessLogsPtrInput
// The ID of the customer owned ipv4 pool to use for this load balancer.
CustomerOwnedIpv4Pool pulumi.StringPtrInput
// Options for creating a default security group if [securityGroups] not specified.
DefaultSecurityGroup *awsxgo.DefaultSecurityGroupArgs
// Options creating a default target group.
DefaultTargetGroup *TargetGroupArgs
// Determines how the load balancer handles requests that might pose a security risk to an application due to HTTP desync. Valid values are `monitor`, `defensive` (default), `strictest`.
DesyncMitigationMode pulumi.StringPtrInput
// Indicates whether HTTP headers with header fields that are not valid are removed by the load balancer (true) or routed to targets (false). The default is false. Elastic Load Balancing requires that message header names contain only alphanumeric characters and hyphens. Only valid for Load Balancers of type `application`.
DropInvalidHeaderFields pulumi.BoolPtrInput
// If true, deletion of the load balancer will be disabled via
// the AWS API. This will prevent this provider from deleting the load balancer. Defaults to `false`.
EnableDeletionProtection pulumi.BoolPtrInput
// Indicates whether HTTP/2 is enabled in `application` load balancers. Defaults to `true`.
EnableHttp2 pulumi.BoolPtrInput
// Indicates whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to AWS WAF. Defaults to `false`.
EnableWafFailOpen pulumi.BoolPtrInput
// The time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type `application`. Default: 60.
IdleTimeout pulumi.IntPtrInput
// If true, the LB will be internal.
Internal pulumi.BoolPtrInput
// The type of IP addresses used by the subnets for your load balancer. The possible values are `ipv4` and `dualstack`
IpAddressType pulumi.StringPtrInput
// A listener to create. Only one of [listener] and [listeners] can be specified.
Listener *ListenerArgs
// List of listeners to create. Only one of [listener] and [listeners] can be specified.
Listeners []ListenerArgs
// The name of the LB. This name must be unique within your AWS account, can have a maximum of 32 characters,
// must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen. If not specified,
// this provider will autogenerate a name beginning with `tf-lb`.
Name pulumi.StringPtrInput
// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
NamePrefix pulumi.StringPtrInput
// A list of security group IDs to assign to the LB. Only valid for Load Balancers of type `application`.
SecurityGroups pulumi.StringArrayInput
// A list of subnet IDs to attach to the LB. Subnets
// cannot be updated for Load Balancers of type `network`. Changing this value
// for load balancers of type `network` will force a recreation of the resource.
SubnetIds pulumi.StringArrayInput
// A subnet mapping block as documented below.
SubnetMappings lb.LoadBalancerSubnetMappingArrayInput
// A list of subnets to attach to the LB. Only one of [subnets], [subnetIds] or [subnetMappings] can be specified
Subnets ec2.SubnetArrayInput
// A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
}
func (ApplicationLoadBalancerArgs) ElementType() reflect.Type {
return reflect.TypeOf((*applicationLoadBalancerArgs)(nil)).Elem()
}
type ApplicationLoadBalancerInput interface {
pulumi.Input
ToApplicationLoadBalancerOutput() ApplicationLoadBalancerOutput
ToApplicationLoadBalancerOutputWithContext(ctx context.Context) ApplicationLoadBalancerOutput
}
func (*ApplicationLoadBalancer) ElementType() reflect.Type {
return reflect.TypeOf((**ApplicationLoadBalancer)(nil)).Elem()
}
func (i *ApplicationLoadBalancer) ToApplicationLoadBalancerOutput() ApplicationLoadBalancerOutput {
return i.ToApplicationLoadBalancerOutputWithContext(context.Background())
}
func (i *ApplicationLoadBalancer) ToApplicationLoadBalancerOutputWithContext(ctx context.Context) ApplicationLoadBalancerOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApplicationLoadBalancerOutput)
}
// ApplicationLoadBalancerArrayInput is an input type that accepts ApplicationLoadBalancerArray and ApplicationLoadBalancerArrayOutput values.
// You can construct a concrete instance of `ApplicationLoadBalancerArrayInput` via:
//
// ApplicationLoadBalancerArray{ ApplicationLoadBalancerArgs{...} }
type ApplicationLoadBalancerArrayInput interface {
pulumi.Input
ToApplicationLoadBalancerArrayOutput() ApplicationLoadBalancerArrayOutput
ToApplicationLoadBalancerArrayOutputWithContext(context.Context) ApplicationLoadBalancerArrayOutput
}
type ApplicationLoadBalancerArray []ApplicationLoadBalancerInput
func (ApplicationLoadBalancerArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ApplicationLoadBalancer)(nil)).Elem()
}
func (i ApplicationLoadBalancerArray) ToApplicationLoadBalancerArrayOutput() ApplicationLoadBalancerArrayOutput {
return i.ToApplicationLoadBalancerArrayOutputWithContext(context.Background())
}
func (i ApplicationLoadBalancerArray) ToApplicationLoadBalancerArrayOutputWithContext(ctx context.Context) ApplicationLoadBalancerArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApplicationLoadBalancerArrayOutput)
}
// ApplicationLoadBalancerMapInput is an input type that accepts ApplicationLoadBalancerMap and ApplicationLoadBalancerMapOutput values.
// You can construct a concrete instance of `ApplicationLoadBalancerMapInput` via:
//
// ApplicationLoadBalancerMap{ "key": ApplicationLoadBalancerArgs{...} }
type ApplicationLoadBalancerMapInput interface {
pulumi.Input
ToApplicationLoadBalancerMapOutput() ApplicationLoadBalancerMapOutput
ToApplicationLoadBalancerMapOutputWithContext(context.Context) ApplicationLoadBalancerMapOutput
}
type ApplicationLoadBalancerMap map[string]ApplicationLoadBalancerInput
func (ApplicationLoadBalancerMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ApplicationLoadBalancer)(nil)).Elem()
}
func (i ApplicationLoadBalancerMap) ToApplicationLoadBalancerMapOutput() ApplicationLoadBalancerMapOutput {
return i.ToApplicationLoadBalancerMapOutputWithContext(context.Background())
}
func (i ApplicationLoadBalancerMap) ToApplicationLoadBalancerMapOutputWithContext(ctx context.Context) ApplicationLoadBalancerMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApplicationLoadBalancerMapOutput)
}
type ApplicationLoadBalancerOutput struct{ *pulumi.OutputState }
func (ApplicationLoadBalancerOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ApplicationLoadBalancer)(nil)).Elem()
}
func (o ApplicationLoadBalancerOutput) ToApplicationLoadBalancerOutput() ApplicationLoadBalancerOutput {
return o
}
func (o ApplicationLoadBalancerOutput) ToApplicationLoadBalancerOutputWithContext(ctx context.Context) ApplicationLoadBalancerOutput {
return o
}
// Default security group, if auto-created
func (o ApplicationLoadBalancerOutput) DefaultSecurityGroup() ec2.SecurityGroupOutput {
return o.ApplyT(func(v *ApplicationLoadBalancer) ec2.SecurityGroupOutput { return v.DefaultSecurityGroup }).(ec2.SecurityGroupOutput)
}
// Default target group, if auto-created
func (o ApplicationLoadBalancerOutput) DefaultTargetGroup() lb.TargetGroupOutput {
return o.ApplyT(func(v *ApplicationLoadBalancer) lb.TargetGroupOutput { return v.DefaultTargetGroup }).(lb.TargetGroupOutput)
}
// Listeners created as part of this load balancer
func (o ApplicationLoadBalancerOutput) Listeners() lb.ListenerArrayOutput {
return o.ApplyT(func(v *ApplicationLoadBalancer) lb.ListenerArrayOutput { return v.Listeners }).(lb.ListenerArrayOutput)
}
// Underlying Load Balancer resource
func (o ApplicationLoadBalancerOutput) LoadBalancer() lb.LoadBalancerOutput {
return o.ApplyT(func(v *ApplicationLoadBalancer) lb.LoadBalancerOutput { return v.LoadBalancer }).(lb.LoadBalancerOutput)
}
// Id of the VPC in which this load balancer is operating
func (o ApplicationLoadBalancerOutput) VpcId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ApplicationLoadBalancer) pulumi.StringPtrOutput { return v.VpcId }).(pulumi.StringPtrOutput)
}
type ApplicationLoadBalancerArrayOutput struct{ *pulumi.OutputState }
func (ApplicationLoadBalancerArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ApplicationLoadBalancer)(nil)).Elem()
}
func (o ApplicationLoadBalancerArrayOutput) ToApplicationLoadBalancerArrayOutput() ApplicationLoadBalancerArrayOutput {
return o
}
func (o ApplicationLoadBalancerArrayOutput) ToApplicationLoadBalancerArrayOutputWithContext(ctx context.Context) ApplicationLoadBalancerArrayOutput {
return o
}
func (o ApplicationLoadBalancerArrayOutput) Index(i pulumi.IntInput) ApplicationLoadBalancerOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ApplicationLoadBalancer {
return vs[0].([]*ApplicationLoadBalancer)[vs[1].(int)]
}).(ApplicationLoadBalancerOutput)
}
type ApplicationLoadBalancerMapOutput struct{ *pulumi.OutputState }
func (ApplicationLoadBalancerMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ApplicationLoadBalancer)(nil)).Elem()
}
func (o ApplicationLoadBalancerMapOutput) ToApplicationLoadBalancerMapOutput() ApplicationLoadBalancerMapOutput {
return o
}
func (o ApplicationLoadBalancerMapOutput) ToApplicationLoadBalancerMapOutputWithContext(ctx context.Context) ApplicationLoadBalancerMapOutput {
return o
}
func (o ApplicationLoadBalancerMapOutput) MapIndex(k pulumi.StringInput) ApplicationLoadBalancerOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ApplicationLoadBalancer {
return vs[0].(map[string]*ApplicationLoadBalancer)[vs[1].(string)]
}).(ApplicationLoadBalancerOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ApplicationLoadBalancerInput)(nil)).Elem(), &ApplicationLoadBalancer{})
pulumi.RegisterInputType(reflect.TypeOf((*ApplicationLoadBalancerArrayInput)(nil)).Elem(), ApplicationLoadBalancerArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ApplicationLoadBalancerMapInput)(nil)).Elem(), ApplicationLoadBalancerMap{})
pulumi.RegisterOutputType(ApplicationLoadBalancerOutput{})
pulumi.RegisterOutputType(ApplicationLoadBalancerArrayOutput{})
pulumi.RegisterOutputType(ApplicationLoadBalancerMapOutput{})
}