github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/getElasticIp.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 ec2 5 6 import ( 7 "context" 8 "reflect" 9 10 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 11 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 12 ) 13 14 // `ec2.Eip` provides details about a specific Elastic IP. 15 // 16 // ## Example Usage 17 // 18 // ### Search By Allocation ID (VPC only) 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/sdk/v3/go/pulumi" 28 // 29 // ) 30 // 31 // func main() { 32 // pulumi.Run(func(ctx *pulumi.Context) error { 33 // _, err := ec2.GetElasticIp(ctx, &ec2.GetElasticIpArgs{ 34 // Id: pulumi.StringRef("eipalloc-12345678"), 35 // }, nil) 36 // if err != nil { 37 // return err 38 // } 39 // return nil 40 // }) 41 // } 42 // 43 // ``` 44 // <!--End PulumiCodeChooser --> 45 // 46 // ### Search By Filters (EC2-Classic or VPC) 47 // 48 // <!--Start PulumiCodeChooser --> 49 // ```go 50 // package main 51 // 52 // import ( 53 // 54 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 55 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 56 // 57 // ) 58 // 59 // func main() { 60 // pulumi.Run(func(ctx *pulumi.Context) error { 61 // _, err := ec2.GetElasticIp(ctx, &ec2.GetElasticIpArgs{ 62 // Filters: []ec2.GetElasticIpFilter{ 63 // { 64 // Name: "tag:Name", 65 // Values: []string{ 66 // "exampleNameTagValue", 67 // }, 68 // }, 69 // }, 70 // }, nil) 71 // if err != nil { 72 // return err 73 // } 74 // return nil 75 // }) 76 // } 77 // 78 // ``` 79 // <!--End PulumiCodeChooser --> 80 // 81 // ### Search By Public IP (EC2-Classic or VPC) 82 // 83 // <!--Start PulumiCodeChooser --> 84 // ```go 85 // package main 86 // 87 // import ( 88 // 89 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 90 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 91 // 92 // ) 93 // 94 // func main() { 95 // pulumi.Run(func(ctx *pulumi.Context) error { 96 // _, err := ec2.GetElasticIp(ctx, &ec2.GetElasticIpArgs{ 97 // PublicIp: pulumi.StringRef("1.2.3.4"), 98 // }, nil) 99 // if err != nil { 100 // return err 101 // } 102 // return nil 103 // }) 104 // } 105 // 106 // ``` 107 // <!--End PulumiCodeChooser --> 108 // 109 // ### Search By Tags (EC2-Classic or VPC) 110 // 111 // <!--Start PulumiCodeChooser --> 112 // ```go 113 // package main 114 // 115 // import ( 116 // 117 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 118 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 119 // 120 // ) 121 // 122 // func main() { 123 // pulumi.Run(func(ctx *pulumi.Context) error { 124 // _, err := ec2.GetElasticIp(ctx, &ec2.GetElasticIpArgs{ 125 // Tags: map[string]interface{}{ 126 // "Name": "exampleNameTagValue", 127 // }, 128 // }, nil) 129 // if err != nil { 130 // return err 131 // } 132 // return nil 133 // }) 134 // } 135 // 136 // ``` 137 // <!--End PulumiCodeChooser --> 138 func GetElasticIp(ctx *pulumi.Context, args *GetElasticIpArgs, opts ...pulumi.InvokeOption) (*GetElasticIpResult, error) { 139 opts = internal.PkgInvokeDefaultOpts(opts) 140 var rv GetElasticIpResult 141 err := ctx.Invoke("aws:ec2/getElasticIp:getElasticIp", args, &rv, opts...) 142 if err != nil { 143 return nil, err 144 } 145 return &rv, nil 146 } 147 148 // A collection of arguments for invoking getElasticIp. 149 type GetElasticIpArgs struct { 150 // One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out the [EC2 API Reference](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeAddresses.html). 151 Filters []GetElasticIpFilter `pulumi:"filters"` 152 // Allocation ID of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set `id`, only set `publicIp` 153 Id *string `pulumi:"id"` 154 // Public IP of the specific EIP to retrieve. 155 PublicIp *string `pulumi:"publicIp"` 156 // Map of tags, each pair of which must exactly match a pair on the desired Elastic IP 157 Tags map[string]string `pulumi:"tags"` 158 } 159 160 // A collection of values returned by getElasticIp. 161 type GetElasticIpResult struct { 162 // ID representing the association of the address with an instance in a VPC. 163 AssociationId string `pulumi:"associationId"` 164 // Carrier IP address. 165 CarrierIp string `pulumi:"carrierIp"` 166 // Customer Owned IP. 167 CustomerOwnedIp string `pulumi:"customerOwnedIp"` 168 // The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out [Customer-owned IP addresses guide](https://docs.aws.amazon.com/outposts/latest/userguide/outposts-networking-components.html#ip-addressing) 169 CustomerOwnedIpv4Pool string `pulumi:"customerOwnedIpv4Pool"` 170 // Whether the address is for use in EC2-Classic (standard) or in a VPC (vpc). 171 Domain string `pulumi:"domain"` 172 Filters []GetElasticIpFilter `pulumi:"filters"` 173 // If VPC Elastic IP, the allocation identifier. If EC2-Classic Elastic IP, the public IP address. 174 Id string `pulumi:"id"` 175 // ID of the instance that the address is associated with (if any). 176 InstanceId string `pulumi:"instanceId"` 177 // The ID of the network interface. 178 NetworkInterfaceId string `pulumi:"networkInterfaceId"` 179 // The ID of the AWS account that owns the network interface. 180 NetworkInterfaceOwnerId string `pulumi:"networkInterfaceOwnerId"` 181 // Private DNS associated with the Elastic IP address. 182 PrivateDns string `pulumi:"privateDns"` 183 // Private IP address associated with the Elastic IP address. 184 PrivateIp string `pulumi:"privateIp"` 185 // The DNS pointer (PTR) record for the IP address. 186 PtrRecord string `pulumi:"ptrRecord"` 187 // Public DNS associated with the Elastic IP address. 188 PublicDns string `pulumi:"publicDns"` 189 // Public IP address of Elastic IP. 190 PublicIp string `pulumi:"publicIp"` 191 // ID of an address pool. 192 PublicIpv4Pool string `pulumi:"publicIpv4Pool"` 193 // Key-value map of tags associated with Elastic IP. 194 Tags map[string]string `pulumi:"tags"` 195 } 196 197 func GetElasticIpOutput(ctx *pulumi.Context, args GetElasticIpOutputArgs, opts ...pulumi.InvokeOption) GetElasticIpResultOutput { 198 return pulumi.ToOutputWithContext(context.Background(), args). 199 ApplyT(func(v interface{}) (GetElasticIpResult, error) { 200 args := v.(GetElasticIpArgs) 201 r, err := GetElasticIp(ctx, &args, opts...) 202 var s GetElasticIpResult 203 if r != nil { 204 s = *r 205 } 206 return s, err 207 }).(GetElasticIpResultOutput) 208 } 209 210 // A collection of arguments for invoking getElasticIp. 211 type GetElasticIpOutputArgs struct { 212 // One or more name/value pairs to use as filters. There are several valid keys, for a full reference, check out the [EC2 API Reference](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeAddresses.html). 213 Filters GetElasticIpFilterArrayInput `pulumi:"filters"` 214 // Allocation ID of the specific VPC EIP to retrieve. If a classic EIP is required, do NOT set `id`, only set `publicIp` 215 Id pulumi.StringPtrInput `pulumi:"id"` 216 // Public IP of the specific EIP to retrieve. 217 PublicIp pulumi.StringPtrInput `pulumi:"publicIp"` 218 // Map of tags, each pair of which must exactly match a pair on the desired Elastic IP 219 Tags pulumi.StringMapInput `pulumi:"tags"` 220 } 221 222 func (GetElasticIpOutputArgs) ElementType() reflect.Type { 223 return reflect.TypeOf((*GetElasticIpArgs)(nil)).Elem() 224 } 225 226 // A collection of values returned by getElasticIp. 227 type GetElasticIpResultOutput struct{ *pulumi.OutputState } 228 229 func (GetElasticIpResultOutput) ElementType() reflect.Type { 230 return reflect.TypeOf((*GetElasticIpResult)(nil)).Elem() 231 } 232 233 func (o GetElasticIpResultOutput) ToGetElasticIpResultOutput() GetElasticIpResultOutput { 234 return o 235 } 236 237 func (o GetElasticIpResultOutput) ToGetElasticIpResultOutputWithContext(ctx context.Context) GetElasticIpResultOutput { 238 return o 239 } 240 241 // ID representing the association of the address with an instance in a VPC. 242 func (o GetElasticIpResultOutput) AssociationId() pulumi.StringOutput { 243 return o.ApplyT(func(v GetElasticIpResult) string { return v.AssociationId }).(pulumi.StringOutput) 244 } 245 246 // Carrier IP address. 247 func (o GetElasticIpResultOutput) CarrierIp() pulumi.StringOutput { 248 return o.ApplyT(func(v GetElasticIpResult) string { return v.CarrierIp }).(pulumi.StringOutput) 249 } 250 251 // Customer Owned IP. 252 func (o GetElasticIpResultOutput) CustomerOwnedIp() pulumi.StringOutput { 253 return o.ApplyT(func(v GetElasticIpResult) string { return v.CustomerOwnedIp }).(pulumi.StringOutput) 254 } 255 256 // The ID of a Customer Owned IP Pool. For more on customer owned IP addressed check out [Customer-owned IP addresses guide](https://docs.aws.amazon.com/outposts/latest/userguide/outposts-networking-components.html#ip-addressing) 257 func (o GetElasticIpResultOutput) CustomerOwnedIpv4Pool() pulumi.StringOutput { 258 return o.ApplyT(func(v GetElasticIpResult) string { return v.CustomerOwnedIpv4Pool }).(pulumi.StringOutput) 259 } 260 261 // Whether the address is for use in EC2-Classic (standard) or in a VPC (vpc). 262 func (o GetElasticIpResultOutput) Domain() pulumi.StringOutput { 263 return o.ApplyT(func(v GetElasticIpResult) string { return v.Domain }).(pulumi.StringOutput) 264 } 265 266 func (o GetElasticIpResultOutput) Filters() GetElasticIpFilterArrayOutput { 267 return o.ApplyT(func(v GetElasticIpResult) []GetElasticIpFilter { return v.Filters }).(GetElasticIpFilterArrayOutput) 268 } 269 270 // If VPC Elastic IP, the allocation identifier. If EC2-Classic Elastic IP, the public IP address. 271 func (o GetElasticIpResultOutput) Id() pulumi.StringOutput { 272 return o.ApplyT(func(v GetElasticIpResult) string { return v.Id }).(pulumi.StringOutput) 273 } 274 275 // ID of the instance that the address is associated with (if any). 276 func (o GetElasticIpResultOutput) InstanceId() pulumi.StringOutput { 277 return o.ApplyT(func(v GetElasticIpResult) string { return v.InstanceId }).(pulumi.StringOutput) 278 } 279 280 // The ID of the network interface. 281 func (o GetElasticIpResultOutput) NetworkInterfaceId() pulumi.StringOutput { 282 return o.ApplyT(func(v GetElasticIpResult) string { return v.NetworkInterfaceId }).(pulumi.StringOutput) 283 } 284 285 // The ID of the AWS account that owns the network interface. 286 func (o GetElasticIpResultOutput) NetworkInterfaceOwnerId() pulumi.StringOutput { 287 return o.ApplyT(func(v GetElasticIpResult) string { return v.NetworkInterfaceOwnerId }).(pulumi.StringOutput) 288 } 289 290 // Private DNS associated with the Elastic IP address. 291 func (o GetElasticIpResultOutput) PrivateDns() pulumi.StringOutput { 292 return o.ApplyT(func(v GetElasticIpResult) string { return v.PrivateDns }).(pulumi.StringOutput) 293 } 294 295 // Private IP address associated with the Elastic IP address. 296 func (o GetElasticIpResultOutput) PrivateIp() pulumi.StringOutput { 297 return o.ApplyT(func(v GetElasticIpResult) string { return v.PrivateIp }).(pulumi.StringOutput) 298 } 299 300 // The DNS pointer (PTR) record for the IP address. 301 func (o GetElasticIpResultOutput) PtrRecord() pulumi.StringOutput { 302 return o.ApplyT(func(v GetElasticIpResult) string { return v.PtrRecord }).(pulumi.StringOutput) 303 } 304 305 // Public DNS associated with the Elastic IP address. 306 func (o GetElasticIpResultOutput) PublicDns() pulumi.StringOutput { 307 return o.ApplyT(func(v GetElasticIpResult) string { return v.PublicDns }).(pulumi.StringOutput) 308 } 309 310 // Public IP address of Elastic IP. 311 func (o GetElasticIpResultOutput) PublicIp() pulumi.StringOutput { 312 return o.ApplyT(func(v GetElasticIpResult) string { return v.PublicIp }).(pulumi.StringOutput) 313 } 314 315 // ID of an address pool. 316 func (o GetElasticIpResultOutput) PublicIpv4Pool() pulumi.StringOutput { 317 return o.ApplyT(func(v GetElasticIpResult) string { return v.PublicIpv4Pool }).(pulumi.StringOutput) 318 } 319 320 // Key-value map of tags associated with Elastic IP. 321 func (o GetElasticIpResultOutput) Tags() pulumi.StringMapOutput { 322 return o.ApplyT(func(v GetElasticIpResult) map[string]string { return v.Tags }).(pulumi.StringMapOutput) 323 } 324 325 func init() { 326 pulumi.RegisterOutputType(GetElasticIpResultOutput{}) 327 }