github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2transitgateway/peeringAttachment.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 ec2transitgateway 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 // Manages an EC2 Transit Gateway Peering Attachment. 16 // For examples of custom route table association and propagation, see the [EC2 Transit Gateway Networking Examples Guide](https://docs.aws.amazon.com/vpc/latest/tgw/TGW_Scenarios.html). 17 // 18 // ## Example Usage 19 // 20 // <!--Start PulumiCodeChooser --> 21 // ```go 22 // package main 23 // 24 // import ( 25 // 26 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws" 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway" 28 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 29 // 30 // ) 31 // 32 // func main() { 33 // pulumi.Run(func(ctx *pulumi.Context) error { 34 // peer, err := aws.GetRegion(ctx, nil, nil) 35 // if err != nil { 36 // return err 37 // } 38 // local, err := ec2transitgateway.NewTransitGateway(ctx, "local", &ec2transitgateway.TransitGatewayArgs{ 39 // Tags: pulumi.StringMap{ 40 // "Name": pulumi.String("Local TGW"), 41 // }, 42 // }) 43 // if err != nil { 44 // return err 45 // } 46 // peerTransitGateway, err := ec2transitgateway.NewTransitGateway(ctx, "peer", &ec2transitgateway.TransitGatewayArgs{ 47 // Tags: pulumi.StringMap{ 48 // "Name": pulumi.String("Peer TGW"), 49 // }, 50 // }) 51 // if err != nil { 52 // return err 53 // } 54 // _, err = ec2transitgateway.NewPeeringAttachment(ctx, "example", &ec2transitgateway.PeeringAttachmentArgs{ 55 // PeerAccountId: peerTransitGateway.OwnerId, 56 // PeerRegion: pulumi.String(peer.Name), 57 // PeerTransitGatewayId: peerTransitGateway.ID(), 58 // TransitGatewayId: local.ID(), 59 // Tags: pulumi.StringMap{ 60 // "Name": pulumi.String("TGW Peering Requestor"), 61 // }, 62 // }) 63 // if err != nil { 64 // return err 65 // } 66 // return nil 67 // }) 68 // } 69 // 70 // ``` 71 // <!--End PulumiCodeChooser --> 72 // 73 // ## Import 74 // 75 // Using `pulumi import`, import `aws_ec2_transit_gateway_peering_attachment` using the EC2 Transit Gateway Attachment identifier. For example: 76 // 77 // ```sh 78 // $ pulumi import aws:ec2transitgateway/peeringAttachment:PeeringAttachment example tgw-attach-12345678 79 // ``` 80 type PeeringAttachment struct { 81 pulumi.CustomResourceState 82 83 // Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the AWS provider is currently connected to. 84 PeerAccountId pulumi.StringOutput `pulumi:"peerAccountId"` 85 // Region of EC2 Transit Gateway to peer with. 86 PeerRegion pulumi.StringOutput `pulumi:"peerRegion"` 87 // Identifier of EC2 Transit Gateway to peer with. 88 PeerTransitGatewayId pulumi.StringOutput `pulumi:"peerTransitGatewayId"` 89 State pulumi.StringOutput `pulumi:"state"` 90 // Key-value tags for the EC2 Transit Gateway Peering Attachment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 91 Tags pulumi.StringMapOutput `pulumi:"tags"` 92 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 93 // 94 // Deprecated: Please use `tags` instead. 95 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 96 // Identifier of EC2 Transit Gateway. 97 TransitGatewayId pulumi.StringOutput `pulumi:"transitGatewayId"` 98 } 99 100 // NewPeeringAttachment registers a new resource with the given unique name, arguments, and options. 101 func NewPeeringAttachment(ctx *pulumi.Context, 102 name string, args *PeeringAttachmentArgs, opts ...pulumi.ResourceOption) (*PeeringAttachment, error) { 103 if args == nil { 104 return nil, errors.New("missing one or more required arguments") 105 } 106 107 if args.PeerRegion == nil { 108 return nil, errors.New("invalid value for required argument 'PeerRegion'") 109 } 110 if args.PeerTransitGatewayId == nil { 111 return nil, errors.New("invalid value for required argument 'PeerTransitGatewayId'") 112 } 113 if args.TransitGatewayId == nil { 114 return nil, errors.New("invalid value for required argument 'TransitGatewayId'") 115 } 116 opts = internal.PkgResourceDefaultOpts(opts) 117 var resource PeeringAttachment 118 err := ctx.RegisterResource("aws:ec2transitgateway/peeringAttachment:PeeringAttachment", name, args, &resource, opts...) 119 if err != nil { 120 return nil, err 121 } 122 return &resource, nil 123 } 124 125 // GetPeeringAttachment gets an existing PeeringAttachment resource's state with the given name, ID, and optional 126 // state properties that are used to uniquely qualify the lookup (nil if not required). 127 func GetPeeringAttachment(ctx *pulumi.Context, 128 name string, id pulumi.IDInput, state *PeeringAttachmentState, opts ...pulumi.ResourceOption) (*PeeringAttachment, error) { 129 var resource PeeringAttachment 130 err := ctx.ReadResource("aws:ec2transitgateway/peeringAttachment:PeeringAttachment", name, id, state, &resource, opts...) 131 if err != nil { 132 return nil, err 133 } 134 return &resource, nil 135 } 136 137 // Input properties used for looking up and filtering PeeringAttachment resources. 138 type peeringAttachmentState struct { 139 // Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the AWS provider is currently connected to. 140 PeerAccountId *string `pulumi:"peerAccountId"` 141 // Region of EC2 Transit Gateway to peer with. 142 PeerRegion *string `pulumi:"peerRegion"` 143 // Identifier of EC2 Transit Gateway to peer with. 144 PeerTransitGatewayId *string `pulumi:"peerTransitGatewayId"` 145 State *string `pulumi:"state"` 146 // Key-value tags for the EC2 Transit Gateway Peering Attachment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 147 Tags map[string]string `pulumi:"tags"` 148 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 149 // 150 // Deprecated: Please use `tags` instead. 151 TagsAll map[string]string `pulumi:"tagsAll"` 152 // Identifier of EC2 Transit Gateway. 153 TransitGatewayId *string `pulumi:"transitGatewayId"` 154 } 155 156 type PeeringAttachmentState struct { 157 // Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the AWS provider is currently connected to. 158 PeerAccountId pulumi.StringPtrInput 159 // Region of EC2 Transit Gateway to peer with. 160 PeerRegion pulumi.StringPtrInput 161 // Identifier of EC2 Transit Gateway to peer with. 162 PeerTransitGatewayId pulumi.StringPtrInput 163 State pulumi.StringPtrInput 164 // Key-value tags for the EC2 Transit Gateway Peering Attachment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 165 Tags pulumi.StringMapInput 166 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 167 // 168 // Deprecated: Please use `tags` instead. 169 TagsAll pulumi.StringMapInput 170 // Identifier of EC2 Transit Gateway. 171 TransitGatewayId pulumi.StringPtrInput 172 } 173 174 func (PeeringAttachmentState) ElementType() reflect.Type { 175 return reflect.TypeOf((*peeringAttachmentState)(nil)).Elem() 176 } 177 178 type peeringAttachmentArgs struct { 179 // Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the AWS provider is currently connected to. 180 PeerAccountId *string `pulumi:"peerAccountId"` 181 // Region of EC2 Transit Gateway to peer with. 182 PeerRegion string `pulumi:"peerRegion"` 183 // Identifier of EC2 Transit Gateway to peer with. 184 PeerTransitGatewayId string `pulumi:"peerTransitGatewayId"` 185 // Key-value tags for the EC2 Transit Gateway Peering Attachment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 186 Tags map[string]string `pulumi:"tags"` 187 // Identifier of EC2 Transit Gateway. 188 TransitGatewayId string `pulumi:"transitGatewayId"` 189 } 190 191 // The set of arguments for constructing a PeeringAttachment resource. 192 type PeeringAttachmentArgs struct { 193 // Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the AWS provider is currently connected to. 194 PeerAccountId pulumi.StringPtrInput 195 // Region of EC2 Transit Gateway to peer with. 196 PeerRegion pulumi.StringInput 197 // Identifier of EC2 Transit Gateway to peer with. 198 PeerTransitGatewayId pulumi.StringInput 199 // Key-value tags for the EC2 Transit Gateway Peering Attachment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 200 Tags pulumi.StringMapInput 201 // Identifier of EC2 Transit Gateway. 202 TransitGatewayId pulumi.StringInput 203 } 204 205 func (PeeringAttachmentArgs) ElementType() reflect.Type { 206 return reflect.TypeOf((*peeringAttachmentArgs)(nil)).Elem() 207 } 208 209 type PeeringAttachmentInput interface { 210 pulumi.Input 211 212 ToPeeringAttachmentOutput() PeeringAttachmentOutput 213 ToPeeringAttachmentOutputWithContext(ctx context.Context) PeeringAttachmentOutput 214 } 215 216 func (*PeeringAttachment) ElementType() reflect.Type { 217 return reflect.TypeOf((**PeeringAttachment)(nil)).Elem() 218 } 219 220 func (i *PeeringAttachment) ToPeeringAttachmentOutput() PeeringAttachmentOutput { 221 return i.ToPeeringAttachmentOutputWithContext(context.Background()) 222 } 223 224 func (i *PeeringAttachment) ToPeeringAttachmentOutputWithContext(ctx context.Context) PeeringAttachmentOutput { 225 return pulumi.ToOutputWithContext(ctx, i).(PeeringAttachmentOutput) 226 } 227 228 // PeeringAttachmentArrayInput is an input type that accepts PeeringAttachmentArray and PeeringAttachmentArrayOutput values. 229 // You can construct a concrete instance of `PeeringAttachmentArrayInput` via: 230 // 231 // PeeringAttachmentArray{ PeeringAttachmentArgs{...} } 232 type PeeringAttachmentArrayInput interface { 233 pulumi.Input 234 235 ToPeeringAttachmentArrayOutput() PeeringAttachmentArrayOutput 236 ToPeeringAttachmentArrayOutputWithContext(context.Context) PeeringAttachmentArrayOutput 237 } 238 239 type PeeringAttachmentArray []PeeringAttachmentInput 240 241 func (PeeringAttachmentArray) ElementType() reflect.Type { 242 return reflect.TypeOf((*[]*PeeringAttachment)(nil)).Elem() 243 } 244 245 func (i PeeringAttachmentArray) ToPeeringAttachmentArrayOutput() PeeringAttachmentArrayOutput { 246 return i.ToPeeringAttachmentArrayOutputWithContext(context.Background()) 247 } 248 249 func (i PeeringAttachmentArray) ToPeeringAttachmentArrayOutputWithContext(ctx context.Context) PeeringAttachmentArrayOutput { 250 return pulumi.ToOutputWithContext(ctx, i).(PeeringAttachmentArrayOutput) 251 } 252 253 // PeeringAttachmentMapInput is an input type that accepts PeeringAttachmentMap and PeeringAttachmentMapOutput values. 254 // You can construct a concrete instance of `PeeringAttachmentMapInput` via: 255 // 256 // PeeringAttachmentMap{ "key": PeeringAttachmentArgs{...} } 257 type PeeringAttachmentMapInput interface { 258 pulumi.Input 259 260 ToPeeringAttachmentMapOutput() PeeringAttachmentMapOutput 261 ToPeeringAttachmentMapOutputWithContext(context.Context) PeeringAttachmentMapOutput 262 } 263 264 type PeeringAttachmentMap map[string]PeeringAttachmentInput 265 266 func (PeeringAttachmentMap) ElementType() reflect.Type { 267 return reflect.TypeOf((*map[string]*PeeringAttachment)(nil)).Elem() 268 } 269 270 func (i PeeringAttachmentMap) ToPeeringAttachmentMapOutput() PeeringAttachmentMapOutput { 271 return i.ToPeeringAttachmentMapOutputWithContext(context.Background()) 272 } 273 274 func (i PeeringAttachmentMap) ToPeeringAttachmentMapOutputWithContext(ctx context.Context) PeeringAttachmentMapOutput { 275 return pulumi.ToOutputWithContext(ctx, i).(PeeringAttachmentMapOutput) 276 } 277 278 type PeeringAttachmentOutput struct{ *pulumi.OutputState } 279 280 func (PeeringAttachmentOutput) ElementType() reflect.Type { 281 return reflect.TypeOf((**PeeringAttachment)(nil)).Elem() 282 } 283 284 func (o PeeringAttachmentOutput) ToPeeringAttachmentOutput() PeeringAttachmentOutput { 285 return o 286 } 287 288 func (o PeeringAttachmentOutput) ToPeeringAttachmentOutputWithContext(ctx context.Context) PeeringAttachmentOutput { 289 return o 290 } 291 292 // Account ID of EC2 Transit Gateway to peer with. Defaults to the account ID the AWS provider is currently connected to. 293 func (o PeeringAttachmentOutput) PeerAccountId() pulumi.StringOutput { 294 return o.ApplyT(func(v *PeeringAttachment) pulumi.StringOutput { return v.PeerAccountId }).(pulumi.StringOutput) 295 } 296 297 // Region of EC2 Transit Gateway to peer with. 298 func (o PeeringAttachmentOutput) PeerRegion() pulumi.StringOutput { 299 return o.ApplyT(func(v *PeeringAttachment) pulumi.StringOutput { return v.PeerRegion }).(pulumi.StringOutput) 300 } 301 302 // Identifier of EC2 Transit Gateway to peer with. 303 func (o PeeringAttachmentOutput) PeerTransitGatewayId() pulumi.StringOutput { 304 return o.ApplyT(func(v *PeeringAttachment) pulumi.StringOutput { return v.PeerTransitGatewayId }).(pulumi.StringOutput) 305 } 306 307 func (o PeeringAttachmentOutput) State() pulumi.StringOutput { 308 return o.ApplyT(func(v *PeeringAttachment) pulumi.StringOutput { return v.State }).(pulumi.StringOutput) 309 } 310 311 // Key-value tags for the EC2 Transit Gateway Peering Attachment. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 312 func (o PeeringAttachmentOutput) Tags() pulumi.StringMapOutput { 313 return o.ApplyT(func(v *PeeringAttachment) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 314 } 315 316 // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 317 // 318 // Deprecated: Please use `tags` instead. 319 func (o PeeringAttachmentOutput) TagsAll() pulumi.StringMapOutput { 320 return o.ApplyT(func(v *PeeringAttachment) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 321 } 322 323 // Identifier of EC2 Transit Gateway. 324 func (o PeeringAttachmentOutput) TransitGatewayId() pulumi.StringOutput { 325 return o.ApplyT(func(v *PeeringAttachment) pulumi.StringOutput { return v.TransitGatewayId }).(pulumi.StringOutput) 326 } 327 328 type PeeringAttachmentArrayOutput struct{ *pulumi.OutputState } 329 330 func (PeeringAttachmentArrayOutput) ElementType() reflect.Type { 331 return reflect.TypeOf((*[]*PeeringAttachment)(nil)).Elem() 332 } 333 334 func (o PeeringAttachmentArrayOutput) ToPeeringAttachmentArrayOutput() PeeringAttachmentArrayOutput { 335 return o 336 } 337 338 func (o PeeringAttachmentArrayOutput) ToPeeringAttachmentArrayOutputWithContext(ctx context.Context) PeeringAttachmentArrayOutput { 339 return o 340 } 341 342 func (o PeeringAttachmentArrayOutput) Index(i pulumi.IntInput) PeeringAttachmentOutput { 343 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PeeringAttachment { 344 return vs[0].([]*PeeringAttachment)[vs[1].(int)] 345 }).(PeeringAttachmentOutput) 346 } 347 348 type PeeringAttachmentMapOutput struct{ *pulumi.OutputState } 349 350 func (PeeringAttachmentMapOutput) ElementType() reflect.Type { 351 return reflect.TypeOf((*map[string]*PeeringAttachment)(nil)).Elem() 352 } 353 354 func (o PeeringAttachmentMapOutput) ToPeeringAttachmentMapOutput() PeeringAttachmentMapOutput { 355 return o 356 } 357 358 func (o PeeringAttachmentMapOutput) ToPeeringAttachmentMapOutputWithContext(ctx context.Context) PeeringAttachmentMapOutput { 359 return o 360 } 361 362 func (o PeeringAttachmentMapOutput) MapIndex(k pulumi.StringInput) PeeringAttachmentOutput { 363 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PeeringAttachment { 364 return vs[0].(map[string]*PeeringAttachment)[vs[1].(string)] 365 }).(PeeringAttachmentOutput) 366 } 367 368 func init() { 369 pulumi.RegisterInputType(reflect.TypeOf((*PeeringAttachmentInput)(nil)).Elem(), &PeeringAttachment{}) 370 pulumi.RegisterInputType(reflect.TypeOf((*PeeringAttachmentArrayInput)(nil)).Elem(), PeeringAttachmentArray{}) 371 pulumi.RegisterInputType(reflect.TypeOf((*PeeringAttachmentMapInput)(nil)).Elem(), PeeringAttachmentMap{}) 372 pulumi.RegisterOutputType(PeeringAttachmentOutput{}) 373 pulumi.RegisterOutputType(PeeringAttachmentArrayOutput{}) 374 pulumi.RegisterOutputType(PeeringAttachmentMapOutput{}) 375 }