github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/networkmanager/customerGatewayAssociation.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 networkmanager 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 // Associates a customer gateway with a device and optionally, with a link. 16 // If you specify a link, it must be associated with the specified device. 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/ec2" 27 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2transitgateway" 28 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/networkmanager" 29 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 30 // 31 // ) 32 // 33 // func main() { 34 // pulumi.Run(func(ctx *pulumi.Context) error { 35 // example, err := networkmanager.NewGlobalNetwork(ctx, "example", &networkmanager.GlobalNetworkArgs{ 36 // Description: pulumi.String("example"), 37 // }) 38 // if err != nil { 39 // return err 40 // } 41 // exampleSite, err := networkmanager.NewSite(ctx, "example", &networkmanager.SiteArgs{ 42 // GlobalNetworkId: example.ID(), 43 // }) 44 // if err != nil { 45 // return err 46 // } 47 // exampleDevice, err := networkmanager.NewDevice(ctx, "example", &networkmanager.DeviceArgs{ 48 // GlobalNetworkId: example.ID(), 49 // SiteId: exampleSite.ID(), 50 // }) 51 // if err != nil { 52 // return err 53 // } 54 // exampleCustomerGateway, err := ec2.NewCustomerGateway(ctx, "example", &ec2.CustomerGatewayArgs{ 55 // BgpAsn: pulumi.String("65000"), 56 // IpAddress: pulumi.String("172.83.124.10"), 57 // Type: pulumi.String("ipsec.1"), 58 // }) 59 // if err != nil { 60 // return err 61 // } 62 // exampleTransitGateway, err := ec2transitgateway.NewTransitGateway(ctx, "example", nil) 63 // if err != nil { 64 // return err 65 // } 66 // exampleVpnConnection, err := ec2.NewVpnConnection(ctx, "example", &ec2.VpnConnectionArgs{ 67 // CustomerGatewayId: exampleCustomerGateway.ID(), 68 // TransitGatewayId: exampleTransitGateway.ID(), 69 // Type: exampleCustomerGateway.Type, 70 // StaticRoutesOnly: pulumi.Bool(true), 71 // }) 72 // if err != nil { 73 // return err 74 // } 75 // exampleTransitGatewayRegistration, err := networkmanager.NewTransitGatewayRegistration(ctx, "example", &networkmanager.TransitGatewayRegistrationArgs{ 76 // GlobalNetworkId: example.ID(), 77 // TransitGatewayArn: exampleTransitGateway.Arn, 78 // }, pulumi.DependsOn([]pulumi.Resource{ 79 // exampleVpnConnection, 80 // })) 81 // if err != nil { 82 // return err 83 // } 84 // _, err = networkmanager.NewCustomerGatewayAssociation(ctx, "example", &networkmanager.CustomerGatewayAssociationArgs{ 85 // GlobalNetworkId: example.ID(), 86 // CustomerGatewayArn: exampleCustomerGateway.Arn, 87 // DeviceId: exampleDevice.ID(), 88 // }, pulumi.DependsOn([]pulumi.Resource{ 89 // exampleTransitGatewayRegistration, 90 // })) 91 // if err != nil { 92 // return err 93 // } 94 // return nil 95 // }) 96 // } 97 // 98 // ``` 99 // <!--End PulumiCodeChooser --> 100 // 101 // ## Import 102 // 103 // Using `pulumi import`, import `aws_networkmanager_customer_gateway_association` using the global network ID and customer gateway ARN. For example: 104 // 105 // ```sh 106 // $ pulumi import aws:networkmanager/customerGatewayAssociation:CustomerGatewayAssociation example global-network-0d47f6t230mz46dy4,arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-123abc05e04123abc 107 // ``` 108 type CustomerGatewayAssociation struct { 109 pulumi.CustomResourceState 110 111 // The Amazon Resource Name (ARN) of the customer gateway. 112 CustomerGatewayArn pulumi.StringOutput `pulumi:"customerGatewayArn"` 113 // The ID of the device. 114 DeviceId pulumi.StringOutput `pulumi:"deviceId"` 115 // The ID of the global network. 116 GlobalNetworkId pulumi.StringOutput `pulumi:"globalNetworkId"` 117 // The ID of the link. 118 LinkId pulumi.StringPtrOutput `pulumi:"linkId"` 119 } 120 121 // NewCustomerGatewayAssociation registers a new resource with the given unique name, arguments, and options. 122 func NewCustomerGatewayAssociation(ctx *pulumi.Context, 123 name string, args *CustomerGatewayAssociationArgs, opts ...pulumi.ResourceOption) (*CustomerGatewayAssociation, error) { 124 if args == nil { 125 return nil, errors.New("missing one or more required arguments") 126 } 127 128 if args.CustomerGatewayArn == nil { 129 return nil, errors.New("invalid value for required argument 'CustomerGatewayArn'") 130 } 131 if args.DeviceId == nil { 132 return nil, errors.New("invalid value for required argument 'DeviceId'") 133 } 134 if args.GlobalNetworkId == nil { 135 return nil, errors.New("invalid value for required argument 'GlobalNetworkId'") 136 } 137 opts = internal.PkgResourceDefaultOpts(opts) 138 var resource CustomerGatewayAssociation 139 err := ctx.RegisterResource("aws:networkmanager/customerGatewayAssociation:CustomerGatewayAssociation", name, args, &resource, opts...) 140 if err != nil { 141 return nil, err 142 } 143 return &resource, nil 144 } 145 146 // GetCustomerGatewayAssociation gets an existing CustomerGatewayAssociation resource's state with the given name, ID, and optional 147 // state properties that are used to uniquely qualify the lookup (nil if not required). 148 func GetCustomerGatewayAssociation(ctx *pulumi.Context, 149 name string, id pulumi.IDInput, state *CustomerGatewayAssociationState, opts ...pulumi.ResourceOption) (*CustomerGatewayAssociation, error) { 150 var resource CustomerGatewayAssociation 151 err := ctx.ReadResource("aws:networkmanager/customerGatewayAssociation:CustomerGatewayAssociation", name, id, state, &resource, opts...) 152 if err != nil { 153 return nil, err 154 } 155 return &resource, nil 156 } 157 158 // Input properties used for looking up and filtering CustomerGatewayAssociation resources. 159 type customerGatewayAssociationState struct { 160 // The Amazon Resource Name (ARN) of the customer gateway. 161 CustomerGatewayArn *string `pulumi:"customerGatewayArn"` 162 // The ID of the device. 163 DeviceId *string `pulumi:"deviceId"` 164 // The ID of the global network. 165 GlobalNetworkId *string `pulumi:"globalNetworkId"` 166 // The ID of the link. 167 LinkId *string `pulumi:"linkId"` 168 } 169 170 type CustomerGatewayAssociationState struct { 171 // The Amazon Resource Name (ARN) of the customer gateway. 172 CustomerGatewayArn pulumi.StringPtrInput 173 // The ID of the device. 174 DeviceId pulumi.StringPtrInput 175 // The ID of the global network. 176 GlobalNetworkId pulumi.StringPtrInput 177 // The ID of the link. 178 LinkId pulumi.StringPtrInput 179 } 180 181 func (CustomerGatewayAssociationState) ElementType() reflect.Type { 182 return reflect.TypeOf((*customerGatewayAssociationState)(nil)).Elem() 183 } 184 185 type customerGatewayAssociationArgs struct { 186 // The Amazon Resource Name (ARN) of the customer gateway. 187 CustomerGatewayArn string `pulumi:"customerGatewayArn"` 188 // The ID of the device. 189 DeviceId string `pulumi:"deviceId"` 190 // The ID of the global network. 191 GlobalNetworkId string `pulumi:"globalNetworkId"` 192 // The ID of the link. 193 LinkId *string `pulumi:"linkId"` 194 } 195 196 // The set of arguments for constructing a CustomerGatewayAssociation resource. 197 type CustomerGatewayAssociationArgs struct { 198 // The Amazon Resource Name (ARN) of the customer gateway. 199 CustomerGatewayArn pulumi.StringInput 200 // The ID of the device. 201 DeviceId pulumi.StringInput 202 // The ID of the global network. 203 GlobalNetworkId pulumi.StringInput 204 // The ID of the link. 205 LinkId pulumi.StringPtrInput 206 } 207 208 func (CustomerGatewayAssociationArgs) ElementType() reflect.Type { 209 return reflect.TypeOf((*customerGatewayAssociationArgs)(nil)).Elem() 210 } 211 212 type CustomerGatewayAssociationInput interface { 213 pulumi.Input 214 215 ToCustomerGatewayAssociationOutput() CustomerGatewayAssociationOutput 216 ToCustomerGatewayAssociationOutputWithContext(ctx context.Context) CustomerGatewayAssociationOutput 217 } 218 219 func (*CustomerGatewayAssociation) ElementType() reflect.Type { 220 return reflect.TypeOf((**CustomerGatewayAssociation)(nil)).Elem() 221 } 222 223 func (i *CustomerGatewayAssociation) ToCustomerGatewayAssociationOutput() CustomerGatewayAssociationOutput { 224 return i.ToCustomerGatewayAssociationOutputWithContext(context.Background()) 225 } 226 227 func (i *CustomerGatewayAssociation) ToCustomerGatewayAssociationOutputWithContext(ctx context.Context) CustomerGatewayAssociationOutput { 228 return pulumi.ToOutputWithContext(ctx, i).(CustomerGatewayAssociationOutput) 229 } 230 231 // CustomerGatewayAssociationArrayInput is an input type that accepts CustomerGatewayAssociationArray and CustomerGatewayAssociationArrayOutput values. 232 // You can construct a concrete instance of `CustomerGatewayAssociationArrayInput` via: 233 // 234 // CustomerGatewayAssociationArray{ CustomerGatewayAssociationArgs{...} } 235 type CustomerGatewayAssociationArrayInput interface { 236 pulumi.Input 237 238 ToCustomerGatewayAssociationArrayOutput() CustomerGatewayAssociationArrayOutput 239 ToCustomerGatewayAssociationArrayOutputWithContext(context.Context) CustomerGatewayAssociationArrayOutput 240 } 241 242 type CustomerGatewayAssociationArray []CustomerGatewayAssociationInput 243 244 func (CustomerGatewayAssociationArray) ElementType() reflect.Type { 245 return reflect.TypeOf((*[]*CustomerGatewayAssociation)(nil)).Elem() 246 } 247 248 func (i CustomerGatewayAssociationArray) ToCustomerGatewayAssociationArrayOutput() CustomerGatewayAssociationArrayOutput { 249 return i.ToCustomerGatewayAssociationArrayOutputWithContext(context.Background()) 250 } 251 252 func (i CustomerGatewayAssociationArray) ToCustomerGatewayAssociationArrayOutputWithContext(ctx context.Context) CustomerGatewayAssociationArrayOutput { 253 return pulumi.ToOutputWithContext(ctx, i).(CustomerGatewayAssociationArrayOutput) 254 } 255 256 // CustomerGatewayAssociationMapInput is an input type that accepts CustomerGatewayAssociationMap and CustomerGatewayAssociationMapOutput values. 257 // You can construct a concrete instance of `CustomerGatewayAssociationMapInput` via: 258 // 259 // CustomerGatewayAssociationMap{ "key": CustomerGatewayAssociationArgs{...} } 260 type CustomerGatewayAssociationMapInput interface { 261 pulumi.Input 262 263 ToCustomerGatewayAssociationMapOutput() CustomerGatewayAssociationMapOutput 264 ToCustomerGatewayAssociationMapOutputWithContext(context.Context) CustomerGatewayAssociationMapOutput 265 } 266 267 type CustomerGatewayAssociationMap map[string]CustomerGatewayAssociationInput 268 269 func (CustomerGatewayAssociationMap) ElementType() reflect.Type { 270 return reflect.TypeOf((*map[string]*CustomerGatewayAssociation)(nil)).Elem() 271 } 272 273 func (i CustomerGatewayAssociationMap) ToCustomerGatewayAssociationMapOutput() CustomerGatewayAssociationMapOutput { 274 return i.ToCustomerGatewayAssociationMapOutputWithContext(context.Background()) 275 } 276 277 func (i CustomerGatewayAssociationMap) ToCustomerGatewayAssociationMapOutputWithContext(ctx context.Context) CustomerGatewayAssociationMapOutput { 278 return pulumi.ToOutputWithContext(ctx, i).(CustomerGatewayAssociationMapOutput) 279 } 280 281 type CustomerGatewayAssociationOutput struct{ *pulumi.OutputState } 282 283 func (CustomerGatewayAssociationOutput) ElementType() reflect.Type { 284 return reflect.TypeOf((**CustomerGatewayAssociation)(nil)).Elem() 285 } 286 287 func (o CustomerGatewayAssociationOutput) ToCustomerGatewayAssociationOutput() CustomerGatewayAssociationOutput { 288 return o 289 } 290 291 func (o CustomerGatewayAssociationOutput) ToCustomerGatewayAssociationOutputWithContext(ctx context.Context) CustomerGatewayAssociationOutput { 292 return o 293 } 294 295 // The Amazon Resource Name (ARN) of the customer gateway. 296 func (o CustomerGatewayAssociationOutput) CustomerGatewayArn() pulumi.StringOutput { 297 return o.ApplyT(func(v *CustomerGatewayAssociation) pulumi.StringOutput { return v.CustomerGatewayArn }).(pulumi.StringOutput) 298 } 299 300 // The ID of the device. 301 func (o CustomerGatewayAssociationOutput) DeviceId() pulumi.StringOutput { 302 return o.ApplyT(func(v *CustomerGatewayAssociation) pulumi.StringOutput { return v.DeviceId }).(pulumi.StringOutput) 303 } 304 305 // The ID of the global network. 306 func (o CustomerGatewayAssociationOutput) GlobalNetworkId() pulumi.StringOutput { 307 return o.ApplyT(func(v *CustomerGatewayAssociation) pulumi.StringOutput { return v.GlobalNetworkId }).(pulumi.StringOutput) 308 } 309 310 // The ID of the link. 311 func (o CustomerGatewayAssociationOutput) LinkId() pulumi.StringPtrOutput { 312 return o.ApplyT(func(v *CustomerGatewayAssociation) pulumi.StringPtrOutput { return v.LinkId }).(pulumi.StringPtrOutput) 313 } 314 315 type CustomerGatewayAssociationArrayOutput struct{ *pulumi.OutputState } 316 317 func (CustomerGatewayAssociationArrayOutput) ElementType() reflect.Type { 318 return reflect.TypeOf((*[]*CustomerGatewayAssociation)(nil)).Elem() 319 } 320 321 func (o CustomerGatewayAssociationArrayOutput) ToCustomerGatewayAssociationArrayOutput() CustomerGatewayAssociationArrayOutput { 322 return o 323 } 324 325 func (o CustomerGatewayAssociationArrayOutput) ToCustomerGatewayAssociationArrayOutputWithContext(ctx context.Context) CustomerGatewayAssociationArrayOutput { 326 return o 327 } 328 329 func (o CustomerGatewayAssociationArrayOutput) Index(i pulumi.IntInput) CustomerGatewayAssociationOutput { 330 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CustomerGatewayAssociation { 331 return vs[0].([]*CustomerGatewayAssociation)[vs[1].(int)] 332 }).(CustomerGatewayAssociationOutput) 333 } 334 335 type CustomerGatewayAssociationMapOutput struct{ *pulumi.OutputState } 336 337 func (CustomerGatewayAssociationMapOutput) ElementType() reflect.Type { 338 return reflect.TypeOf((*map[string]*CustomerGatewayAssociation)(nil)).Elem() 339 } 340 341 func (o CustomerGatewayAssociationMapOutput) ToCustomerGatewayAssociationMapOutput() CustomerGatewayAssociationMapOutput { 342 return o 343 } 344 345 func (o CustomerGatewayAssociationMapOutput) ToCustomerGatewayAssociationMapOutputWithContext(ctx context.Context) CustomerGatewayAssociationMapOutput { 346 return o 347 } 348 349 func (o CustomerGatewayAssociationMapOutput) MapIndex(k pulumi.StringInput) CustomerGatewayAssociationOutput { 350 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CustomerGatewayAssociation { 351 return vs[0].(map[string]*CustomerGatewayAssociation)[vs[1].(string)] 352 }).(CustomerGatewayAssociationOutput) 353 } 354 355 func init() { 356 pulumi.RegisterInputType(reflect.TypeOf((*CustomerGatewayAssociationInput)(nil)).Elem(), &CustomerGatewayAssociation{}) 357 pulumi.RegisterInputType(reflect.TypeOf((*CustomerGatewayAssociationArrayInput)(nil)).Elem(), CustomerGatewayAssociationArray{}) 358 pulumi.RegisterInputType(reflect.TypeOf((*CustomerGatewayAssociationMapInput)(nil)).Elem(), CustomerGatewayAssociationMap{}) 359 pulumi.RegisterOutputType(CustomerGatewayAssociationOutput{}) 360 pulumi.RegisterOutputType(CustomerGatewayAssociationArrayOutput{}) 361 pulumi.RegisterOutputType(CustomerGatewayAssociationMapOutput{}) 362 }