github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/autoscaling/trafficSourceAttachment.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package autoscaling 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Attaches a traffic source to an Auto Scaling group. 16 // 17 // > **NOTE on Auto Scaling Groups, Attachments and Traffic Source Attachments:** Pulumi provides standalone Attachment (for attaching Classic Load Balancers and Application Load Balancer, Gateway Load Balancer, or Network Load Balancer target groups) and Traffic Source Attachment (for attaching Load Balancers and VPC Lattice target groups) resources and an Auto Scaling Group resource with `loadBalancers`, `targetGroupArns` and `trafficSource` attributes. Do not use the same traffic source in more than one of these resources. Doing so will cause a conflict of attachments. A `lifecycle` configuration block can be used to suppress differences if necessary. 18 // 19 // ## Example Usage 20 // 21 // ### Basic Usage 22 // 23 // <!--Start PulumiCodeChooser --> 24 // ```go 25 // package main 26 // 27 // import ( 28 // 29 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/autoscaling" 30 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 31 // 32 // ) 33 // 34 // func main() { 35 // pulumi.Run(func(ctx *pulumi.Context) error { 36 // _, err := autoscaling.NewTrafficSourceAttachment(ctx, "example", &autoscaling.TrafficSourceAttachmentArgs{ 37 // AutoscalingGroupName: pulumi.Any(exampleAwsAutoscalingGroup.Id), 38 // TrafficSource: &autoscaling.TrafficSourceAttachmentTrafficSourceArgs{ 39 // Identifier: pulumi.Any(exampleAwsLbTargetGroup.Arn), 40 // Type: pulumi.String("elbv2"), 41 // }, 42 // }) 43 // if err != nil { 44 // return err 45 // } 46 // return nil 47 // }) 48 // } 49 // 50 // ``` 51 // <!--End PulumiCodeChooser --> 52 type TrafficSourceAttachment struct { 53 pulumi.CustomResourceState 54 55 // The name of the Auto Scaling group. 56 AutoscalingGroupName pulumi.StringOutput `pulumi:"autoscalingGroupName"` 57 // The unique identifiers of a traffic sources. 58 TrafficSource TrafficSourceAttachmentTrafficSourcePtrOutput `pulumi:"trafficSource"` 59 } 60 61 // NewTrafficSourceAttachment registers a new resource with the given unique name, arguments, and options. 62 func NewTrafficSourceAttachment(ctx *pulumi.Context, 63 name string, args *TrafficSourceAttachmentArgs, opts ...pulumi.ResourceOption) (*TrafficSourceAttachment, error) { 64 if args == nil { 65 return nil, errors.New("missing one or more required arguments") 66 } 67 68 if args.AutoscalingGroupName == nil { 69 return nil, errors.New("invalid value for required argument 'AutoscalingGroupName'") 70 } 71 opts = internal.PkgResourceDefaultOpts(opts) 72 var resource TrafficSourceAttachment 73 err := ctx.RegisterResource("aws:autoscaling/trafficSourceAttachment:TrafficSourceAttachment", name, args, &resource, opts...) 74 if err != nil { 75 return nil, err 76 } 77 return &resource, nil 78 } 79 80 // GetTrafficSourceAttachment gets an existing TrafficSourceAttachment resource's state with the given name, ID, and optional 81 // state properties that are used to uniquely qualify the lookup (nil if not required). 82 func GetTrafficSourceAttachment(ctx *pulumi.Context, 83 name string, id pulumi.IDInput, state *TrafficSourceAttachmentState, opts ...pulumi.ResourceOption) (*TrafficSourceAttachment, error) { 84 var resource TrafficSourceAttachment 85 err := ctx.ReadResource("aws:autoscaling/trafficSourceAttachment:TrafficSourceAttachment", name, id, state, &resource, opts...) 86 if err != nil { 87 return nil, err 88 } 89 return &resource, nil 90 } 91 92 // Input properties used for looking up and filtering TrafficSourceAttachment resources. 93 type trafficSourceAttachmentState struct { 94 // The name of the Auto Scaling group. 95 AutoscalingGroupName *string `pulumi:"autoscalingGroupName"` 96 // The unique identifiers of a traffic sources. 97 TrafficSource *TrafficSourceAttachmentTrafficSource `pulumi:"trafficSource"` 98 } 99 100 type TrafficSourceAttachmentState struct { 101 // The name of the Auto Scaling group. 102 AutoscalingGroupName pulumi.StringPtrInput 103 // The unique identifiers of a traffic sources. 104 TrafficSource TrafficSourceAttachmentTrafficSourcePtrInput 105 } 106 107 func (TrafficSourceAttachmentState) ElementType() reflect.Type { 108 return reflect.TypeOf((*trafficSourceAttachmentState)(nil)).Elem() 109 } 110 111 type trafficSourceAttachmentArgs struct { 112 // The name of the Auto Scaling group. 113 AutoscalingGroupName string `pulumi:"autoscalingGroupName"` 114 // The unique identifiers of a traffic sources. 115 TrafficSource *TrafficSourceAttachmentTrafficSource `pulumi:"trafficSource"` 116 } 117 118 // The set of arguments for constructing a TrafficSourceAttachment resource. 119 type TrafficSourceAttachmentArgs struct { 120 // The name of the Auto Scaling group. 121 AutoscalingGroupName pulumi.StringInput 122 // The unique identifiers of a traffic sources. 123 TrafficSource TrafficSourceAttachmentTrafficSourcePtrInput 124 } 125 126 func (TrafficSourceAttachmentArgs) ElementType() reflect.Type { 127 return reflect.TypeOf((*trafficSourceAttachmentArgs)(nil)).Elem() 128 } 129 130 type TrafficSourceAttachmentInput interface { 131 pulumi.Input 132 133 ToTrafficSourceAttachmentOutput() TrafficSourceAttachmentOutput 134 ToTrafficSourceAttachmentOutputWithContext(ctx context.Context) TrafficSourceAttachmentOutput 135 } 136 137 func (*TrafficSourceAttachment) ElementType() reflect.Type { 138 return reflect.TypeOf((**TrafficSourceAttachment)(nil)).Elem() 139 } 140 141 func (i *TrafficSourceAttachment) ToTrafficSourceAttachmentOutput() TrafficSourceAttachmentOutput { 142 return i.ToTrafficSourceAttachmentOutputWithContext(context.Background()) 143 } 144 145 func (i *TrafficSourceAttachment) ToTrafficSourceAttachmentOutputWithContext(ctx context.Context) TrafficSourceAttachmentOutput { 146 return pulumi.ToOutputWithContext(ctx, i).(TrafficSourceAttachmentOutput) 147 } 148 149 // TrafficSourceAttachmentArrayInput is an input type that accepts TrafficSourceAttachmentArray and TrafficSourceAttachmentArrayOutput values. 150 // You can construct a concrete instance of `TrafficSourceAttachmentArrayInput` via: 151 // 152 // TrafficSourceAttachmentArray{ TrafficSourceAttachmentArgs{...} } 153 type TrafficSourceAttachmentArrayInput interface { 154 pulumi.Input 155 156 ToTrafficSourceAttachmentArrayOutput() TrafficSourceAttachmentArrayOutput 157 ToTrafficSourceAttachmentArrayOutputWithContext(context.Context) TrafficSourceAttachmentArrayOutput 158 } 159 160 type TrafficSourceAttachmentArray []TrafficSourceAttachmentInput 161 162 func (TrafficSourceAttachmentArray) ElementType() reflect.Type { 163 return reflect.TypeOf((*[]*TrafficSourceAttachment)(nil)).Elem() 164 } 165 166 func (i TrafficSourceAttachmentArray) ToTrafficSourceAttachmentArrayOutput() TrafficSourceAttachmentArrayOutput { 167 return i.ToTrafficSourceAttachmentArrayOutputWithContext(context.Background()) 168 } 169 170 func (i TrafficSourceAttachmentArray) ToTrafficSourceAttachmentArrayOutputWithContext(ctx context.Context) TrafficSourceAttachmentArrayOutput { 171 return pulumi.ToOutputWithContext(ctx, i).(TrafficSourceAttachmentArrayOutput) 172 } 173 174 // TrafficSourceAttachmentMapInput is an input type that accepts TrafficSourceAttachmentMap and TrafficSourceAttachmentMapOutput values. 175 // You can construct a concrete instance of `TrafficSourceAttachmentMapInput` via: 176 // 177 // TrafficSourceAttachmentMap{ "key": TrafficSourceAttachmentArgs{...} } 178 type TrafficSourceAttachmentMapInput interface { 179 pulumi.Input 180 181 ToTrafficSourceAttachmentMapOutput() TrafficSourceAttachmentMapOutput 182 ToTrafficSourceAttachmentMapOutputWithContext(context.Context) TrafficSourceAttachmentMapOutput 183 } 184 185 type TrafficSourceAttachmentMap map[string]TrafficSourceAttachmentInput 186 187 func (TrafficSourceAttachmentMap) ElementType() reflect.Type { 188 return reflect.TypeOf((*map[string]*TrafficSourceAttachment)(nil)).Elem() 189 } 190 191 func (i TrafficSourceAttachmentMap) ToTrafficSourceAttachmentMapOutput() TrafficSourceAttachmentMapOutput { 192 return i.ToTrafficSourceAttachmentMapOutputWithContext(context.Background()) 193 } 194 195 func (i TrafficSourceAttachmentMap) ToTrafficSourceAttachmentMapOutputWithContext(ctx context.Context) TrafficSourceAttachmentMapOutput { 196 return pulumi.ToOutputWithContext(ctx, i).(TrafficSourceAttachmentMapOutput) 197 } 198 199 type TrafficSourceAttachmentOutput struct{ *pulumi.OutputState } 200 201 func (TrafficSourceAttachmentOutput) ElementType() reflect.Type { 202 return reflect.TypeOf((**TrafficSourceAttachment)(nil)).Elem() 203 } 204 205 func (o TrafficSourceAttachmentOutput) ToTrafficSourceAttachmentOutput() TrafficSourceAttachmentOutput { 206 return o 207 } 208 209 func (o TrafficSourceAttachmentOutput) ToTrafficSourceAttachmentOutputWithContext(ctx context.Context) TrafficSourceAttachmentOutput { 210 return o 211 } 212 213 // The name of the Auto Scaling group. 214 func (o TrafficSourceAttachmentOutput) AutoscalingGroupName() pulumi.StringOutput { 215 return o.ApplyT(func(v *TrafficSourceAttachment) pulumi.StringOutput { return v.AutoscalingGroupName }).(pulumi.StringOutput) 216 } 217 218 // The unique identifiers of a traffic sources. 219 func (o TrafficSourceAttachmentOutput) TrafficSource() TrafficSourceAttachmentTrafficSourcePtrOutput { 220 return o.ApplyT(func(v *TrafficSourceAttachment) TrafficSourceAttachmentTrafficSourcePtrOutput { return v.TrafficSource }).(TrafficSourceAttachmentTrafficSourcePtrOutput) 221 } 222 223 type TrafficSourceAttachmentArrayOutput struct{ *pulumi.OutputState } 224 225 func (TrafficSourceAttachmentArrayOutput) ElementType() reflect.Type { 226 return reflect.TypeOf((*[]*TrafficSourceAttachment)(nil)).Elem() 227 } 228 229 func (o TrafficSourceAttachmentArrayOutput) ToTrafficSourceAttachmentArrayOutput() TrafficSourceAttachmentArrayOutput { 230 return o 231 } 232 233 func (o TrafficSourceAttachmentArrayOutput) ToTrafficSourceAttachmentArrayOutputWithContext(ctx context.Context) TrafficSourceAttachmentArrayOutput { 234 return o 235 } 236 237 func (o TrafficSourceAttachmentArrayOutput) Index(i pulumi.IntInput) TrafficSourceAttachmentOutput { 238 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *TrafficSourceAttachment { 239 return vs[0].([]*TrafficSourceAttachment)[vs[1].(int)] 240 }).(TrafficSourceAttachmentOutput) 241 } 242 243 type TrafficSourceAttachmentMapOutput struct{ *pulumi.OutputState } 244 245 func (TrafficSourceAttachmentMapOutput) ElementType() reflect.Type { 246 return reflect.TypeOf((*map[string]*TrafficSourceAttachment)(nil)).Elem() 247 } 248 249 func (o TrafficSourceAttachmentMapOutput) ToTrafficSourceAttachmentMapOutput() TrafficSourceAttachmentMapOutput { 250 return o 251 } 252 253 func (o TrafficSourceAttachmentMapOutput) ToTrafficSourceAttachmentMapOutputWithContext(ctx context.Context) TrafficSourceAttachmentMapOutput { 254 return o 255 } 256 257 func (o TrafficSourceAttachmentMapOutput) MapIndex(k pulumi.StringInput) TrafficSourceAttachmentOutput { 258 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *TrafficSourceAttachment { 259 return vs[0].(map[string]*TrafficSourceAttachment)[vs[1].(string)] 260 }).(TrafficSourceAttachmentOutput) 261 } 262 263 func init() { 264 pulumi.RegisterInputType(reflect.TypeOf((*TrafficSourceAttachmentInput)(nil)).Elem(), &TrafficSourceAttachment{}) 265 pulumi.RegisterInputType(reflect.TypeOf((*TrafficSourceAttachmentArrayInput)(nil)).Elem(), TrafficSourceAttachmentArray{}) 266 pulumi.RegisterInputType(reflect.TypeOf((*TrafficSourceAttachmentMapInput)(nil)).Elem(), TrafficSourceAttachmentMap{}) 267 pulumi.RegisterOutputType(TrafficSourceAttachmentOutput{}) 268 pulumi.RegisterOutputType(TrafficSourceAttachmentArrayOutput{}) 269 pulumi.RegisterOutputType(TrafficSourceAttachmentMapOutput{}) 270 }