github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/managedPrefixList.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 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides a managed prefix list resource. 16 // 17 // > **NOTE on Managed Prefix Lists and Managed Prefix List Entries:** The provider 18 // currently provides both a standalone Managed Prefix List Entry resource (a single entry), 19 // and a Managed Prefix List resource with entries defined in-line. At this time you 20 // cannot use a Managed Prefix List with in-line rules in conjunction with any Managed 21 // Prefix List Entry resources. Doing so will cause a conflict of entries and will overwrite entries. 22 // 23 // > **NOTE on `maxEntries`:** When you reference a Prefix List in a resource, 24 // the maximum number of entries for the prefix lists counts as the same number of rules 25 // or entries for the resource. For example, if you create a prefix list with a maximum 26 // of 20 entries and you reference that prefix list in a security group rule, this counts 27 // as 20 rules for the security group. 28 // 29 // ## Example Usage 30 // 31 // # Basic usage 32 // 33 // <!--Start PulumiCodeChooser --> 34 // ```go 35 // package main 36 // 37 // import ( 38 // 39 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 40 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 41 // 42 // ) 43 // 44 // func main() { 45 // pulumi.Run(func(ctx *pulumi.Context) error { 46 // _, err := ec2.NewManagedPrefixList(ctx, "example", &ec2.ManagedPrefixListArgs{ 47 // Name: pulumi.String("All VPC CIDR-s"), 48 // AddressFamily: pulumi.String("IPv4"), 49 // MaxEntries: pulumi.Int(5), 50 // Entries: ec2.ManagedPrefixListEntryTypeArray{ 51 // &ec2.ManagedPrefixListEntryTypeArgs{ 52 // Cidr: pulumi.Any(exampleAwsVpc.CidrBlock), 53 // Description: pulumi.String("Primary"), 54 // }, 55 // &ec2.ManagedPrefixListEntryTypeArgs{ 56 // Cidr: pulumi.Any(exampleAwsVpcIpv4CidrBlockAssociation.CidrBlock), 57 // Description: pulumi.String("Secondary"), 58 // }, 59 // }, 60 // Tags: pulumi.StringMap{ 61 // "Env": pulumi.String("live"), 62 // }, 63 // }) 64 // if err != nil { 65 // return err 66 // } 67 // return nil 68 // }) 69 // } 70 // 71 // ``` 72 // <!--End PulumiCodeChooser --> 73 // 74 // ## Import 75 // 76 // Using `pulumi import`, import Prefix Lists using the `id`. For example: 77 // 78 // ```sh 79 // $ pulumi import aws:ec2/managedPrefixList:ManagedPrefixList default pl-0570a1d2d725c16be 80 // ``` 81 type ManagedPrefixList struct { 82 pulumi.CustomResourceState 83 84 // Address family (`IPv4` or `IPv6`) of this prefix list. 85 AddressFamily pulumi.StringOutput `pulumi:"addressFamily"` 86 // ARN of the prefix list. 87 Arn pulumi.StringOutput `pulumi:"arn"` 88 // Configuration block for prefix list entry. Detailed below. Different entries may have overlapping CIDR blocks, but a particular CIDR should not be duplicated. 89 Entries ManagedPrefixListEntryTypeArrayOutput `pulumi:"entries"` 90 // Maximum number of entries that this prefix list can contain. 91 MaxEntries pulumi.IntOutput `pulumi:"maxEntries"` 92 // Name of this resource. The name must not start with `com.amazonaws`. 93 Name pulumi.StringOutput `pulumi:"name"` 94 // ID of the AWS account that owns this prefix list. 95 OwnerId pulumi.StringOutput `pulumi:"ownerId"` 96 // Map of tags to assign to this resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 97 Tags pulumi.StringMapOutput `pulumi:"tags"` 98 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 99 // 100 // Deprecated: Please use `tags` instead. 101 TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"` 102 // Latest version of this prefix list. 103 Version pulumi.IntOutput `pulumi:"version"` 104 } 105 106 // NewManagedPrefixList registers a new resource with the given unique name, arguments, and options. 107 func NewManagedPrefixList(ctx *pulumi.Context, 108 name string, args *ManagedPrefixListArgs, opts ...pulumi.ResourceOption) (*ManagedPrefixList, error) { 109 if args == nil { 110 return nil, errors.New("missing one or more required arguments") 111 } 112 113 if args.AddressFamily == nil { 114 return nil, errors.New("invalid value for required argument 'AddressFamily'") 115 } 116 if args.MaxEntries == nil { 117 return nil, errors.New("invalid value for required argument 'MaxEntries'") 118 } 119 opts = internal.PkgResourceDefaultOpts(opts) 120 var resource ManagedPrefixList 121 err := ctx.RegisterResource("aws:ec2/managedPrefixList:ManagedPrefixList", name, args, &resource, opts...) 122 if err != nil { 123 return nil, err 124 } 125 return &resource, nil 126 } 127 128 // GetManagedPrefixList gets an existing ManagedPrefixList resource's state with the given name, ID, and optional 129 // state properties that are used to uniquely qualify the lookup (nil if not required). 130 func GetManagedPrefixList(ctx *pulumi.Context, 131 name string, id pulumi.IDInput, state *ManagedPrefixListState, opts ...pulumi.ResourceOption) (*ManagedPrefixList, error) { 132 var resource ManagedPrefixList 133 err := ctx.ReadResource("aws:ec2/managedPrefixList:ManagedPrefixList", name, id, state, &resource, opts...) 134 if err != nil { 135 return nil, err 136 } 137 return &resource, nil 138 } 139 140 // Input properties used for looking up and filtering ManagedPrefixList resources. 141 type managedPrefixListState struct { 142 // Address family (`IPv4` or `IPv6`) of this prefix list. 143 AddressFamily *string `pulumi:"addressFamily"` 144 // ARN of the prefix list. 145 Arn *string `pulumi:"arn"` 146 // Configuration block for prefix list entry. Detailed below. Different entries may have overlapping CIDR blocks, but a particular CIDR should not be duplicated. 147 Entries []ManagedPrefixListEntryType `pulumi:"entries"` 148 // Maximum number of entries that this prefix list can contain. 149 MaxEntries *int `pulumi:"maxEntries"` 150 // Name of this resource. The name must not start with `com.amazonaws`. 151 Name *string `pulumi:"name"` 152 // ID of the AWS account that owns this prefix list. 153 OwnerId *string `pulumi:"ownerId"` 154 // Map of tags to assign to this resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 155 Tags map[string]string `pulumi:"tags"` 156 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 157 // 158 // Deprecated: Please use `tags` instead. 159 TagsAll map[string]string `pulumi:"tagsAll"` 160 // Latest version of this prefix list. 161 Version *int `pulumi:"version"` 162 } 163 164 type ManagedPrefixListState struct { 165 // Address family (`IPv4` or `IPv6`) of this prefix list. 166 AddressFamily pulumi.StringPtrInput 167 // ARN of the prefix list. 168 Arn pulumi.StringPtrInput 169 // Configuration block for prefix list entry. Detailed below. Different entries may have overlapping CIDR blocks, but a particular CIDR should not be duplicated. 170 Entries ManagedPrefixListEntryTypeArrayInput 171 // Maximum number of entries that this prefix list can contain. 172 MaxEntries pulumi.IntPtrInput 173 // Name of this resource. The name must not start with `com.amazonaws`. 174 Name pulumi.StringPtrInput 175 // ID of the AWS account that owns this prefix list. 176 OwnerId pulumi.StringPtrInput 177 // Map of tags to assign to this resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 178 Tags pulumi.StringMapInput 179 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 180 // 181 // Deprecated: Please use `tags` instead. 182 TagsAll pulumi.StringMapInput 183 // Latest version of this prefix list. 184 Version pulumi.IntPtrInput 185 } 186 187 func (ManagedPrefixListState) ElementType() reflect.Type { 188 return reflect.TypeOf((*managedPrefixListState)(nil)).Elem() 189 } 190 191 type managedPrefixListArgs struct { 192 // Address family (`IPv4` or `IPv6`) of this prefix list. 193 AddressFamily string `pulumi:"addressFamily"` 194 // Configuration block for prefix list entry. Detailed below. Different entries may have overlapping CIDR blocks, but a particular CIDR should not be duplicated. 195 Entries []ManagedPrefixListEntryType `pulumi:"entries"` 196 // Maximum number of entries that this prefix list can contain. 197 MaxEntries int `pulumi:"maxEntries"` 198 // Name of this resource. The name must not start with `com.amazonaws`. 199 Name *string `pulumi:"name"` 200 // Map of tags to assign to this resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 201 Tags map[string]string `pulumi:"tags"` 202 } 203 204 // The set of arguments for constructing a ManagedPrefixList resource. 205 type ManagedPrefixListArgs struct { 206 // Address family (`IPv4` or `IPv6`) of this prefix list. 207 AddressFamily pulumi.StringInput 208 // Configuration block for prefix list entry. Detailed below. Different entries may have overlapping CIDR blocks, but a particular CIDR should not be duplicated. 209 Entries ManagedPrefixListEntryTypeArrayInput 210 // Maximum number of entries that this prefix list can contain. 211 MaxEntries pulumi.IntInput 212 // Name of this resource. The name must not start with `com.amazonaws`. 213 Name pulumi.StringPtrInput 214 // Map of tags to assign to this resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 215 Tags pulumi.StringMapInput 216 } 217 218 func (ManagedPrefixListArgs) ElementType() reflect.Type { 219 return reflect.TypeOf((*managedPrefixListArgs)(nil)).Elem() 220 } 221 222 type ManagedPrefixListInput interface { 223 pulumi.Input 224 225 ToManagedPrefixListOutput() ManagedPrefixListOutput 226 ToManagedPrefixListOutputWithContext(ctx context.Context) ManagedPrefixListOutput 227 } 228 229 func (*ManagedPrefixList) ElementType() reflect.Type { 230 return reflect.TypeOf((**ManagedPrefixList)(nil)).Elem() 231 } 232 233 func (i *ManagedPrefixList) ToManagedPrefixListOutput() ManagedPrefixListOutput { 234 return i.ToManagedPrefixListOutputWithContext(context.Background()) 235 } 236 237 func (i *ManagedPrefixList) ToManagedPrefixListOutputWithContext(ctx context.Context) ManagedPrefixListOutput { 238 return pulumi.ToOutputWithContext(ctx, i).(ManagedPrefixListOutput) 239 } 240 241 // ManagedPrefixListArrayInput is an input type that accepts ManagedPrefixListArray and ManagedPrefixListArrayOutput values. 242 // You can construct a concrete instance of `ManagedPrefixListArrayInput` via: 243 // 244 // ManagedPrefixListArray{ ManagedPrefixListArgs{...} } 245 type ManagedPrefixListArrayInput interface { 246 pulumi.Input 247 248 ToManagedPrefixListArrayOutput() ManagedPrefixListArrayOutput 249 ToManagedPrefixListArrayOutputWithContext(context.Context) ManagedPrefixListArrayOutput 250 } 251 252 type ManagedPrefixListArray []ManagedPrefixListInput 253 254 func (ManagedPrefixListArray) ElementType() reflect.Type { 255 return reflect.TypeOf((*[]*ManagedPrefixList)(nil)).Elem() 256 } 257 258 func (i ManagedPrefixListArray) ToManagedPrefixListArrayOutput() ManagedPrefixListArrayOutput { 259 return i.ToManagedPrefixListArrayOutputWithContext(context.Background()) 260 } 261 262 func (i ManagedPrefixListArray) ToManagedPrefixListArrayOutputWithContext(ctx context.Context) ManagedPrefixListArrayOutput { 263 return pulumi.ToOutputWithContext(ctx, i).(ManagedPrefixListArrayOutput) 264 } 265 266 // ManagedPrefixListMapInput is an input type that accepts ManagedPrefixListMap and ManagedPrefixListMapOutput values. 267 // You can construct a concrete instance of `ManagedPrefixListMapInput` via: 268 // 269 // ManagedPrefixListMap{ "key": ManagedPrefixListArgs{...} } 270 type ManagedPrefixListMapInput interface { 271 pulumi.Input 272 273 ToManagedPrefixListMapOutput() ManagedPrefixListMapOutput 274 ToManagedPrefixListMapOutputWithContext(context.Context) ManagedPrefixListMapOutput 275 } 276 277 type ManagedPrefixListMap map[string]ManagedPrefixListInput 278 279 func (ManagedPrefixListMap) ElementType() reflect.Type { 280 return reflect.TypeOf((*map[string]*ManagedPrefixList)(nil)).Elem() 281 } 282 283 func (i ManagedPrefixListMap) ToManagedPrefixListMapOutput() ManagedPrefixListMapOutput { 284 return i.ToManagedPrefixListMapOutputWithContext(context.Background()) 285 } 286 287 func (i ManagedPrefixListMap) ToManagedPrefixListMapOutputWithContext(ctx context.Context) ManagedPrefixListMapOutput { 288 return pulumi.ToOutputWithContext(ctx, i).(ManagedPrefixListMapOutput) 289 } 290 291 type ManagedPrefixListOutput struct{ *pulumi.OutputState } 292 293 func (ManagedPrefixListOutput) ElementType() reflect.Type { 294 return reflect.TypeOf((**ManagedPrefixList)(nil)).Elem() 295 } 296 297 func (o ManagedPrefixListOutput) ToManagedPrefixListOutput() ManagedPrefixListOutput { 298 return o 299 } 300 301 func (o ManagedPrefixListOutput) ToManagedPrefixListOutputWithContext(ctx context.Context) ManagedPrefixListOutput { 302 return o 303 } 304 305 // Address family (`IPv4` or `IPv6`) of this prefix list. 306 func (o ManagedPrefixListOutput) AddressFamily() pulumi.StringOutput { 307 return o.ApplyT(func(v *ManagedPrefixList) pulumi.StringOutput { return v.AddressFamily }).(pulumi.StringOutput) 308 } 309 310 // ARN of the prefix list. 311 func (o ManagedPrefixListOutput) Arn() pulumi.StringOutput { 312 return o.ApplyT(func(v *ManagedPrefixList) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput) 313 } 314 315 // Configuration block for prefix list entry. Detailed below. Different entries may have overlapping CIDR blocks, but a particular CIDR should not be duplicated. 316 func (o ManagedPrefixListOutput) Entries() ManagedPrefixListEntryTypeArrayOutput { 317 return o.ApplyT(func(v *ManagedPrefixList) ManagedPrefixListEntryTypeArrayOutput { return v.Entries }).(ManagedPrefixListEntryTypeArrayOutput) 318 } 319 320 // Maximum number of entries that this prefix list can contain. 321 func (o ManagedPrefixListOutput) MaxEntries() pulumi.IntOutput { 322 return o.ApplyT(func(v *ManagedPrefixList) pulumi.IntOutput { return v.MaxEntries }).(pulumi.IntOutput) 323 } 324 325 // Name of this resource. The name must not start with `com.amazonaws`. 326 func (o ManagedPrefixListOutput) Name() pulumi.StringOutput { 327 return o.ApplyT(func(v *ManagedPrefixList) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput) 328 } 329 330 // ID of the AWS account that owns this prefix list. 331 func (o ManagedPrefixListOutput) OwnerId() pulumi.StringOutput { 332 return o.ApplyT(func(v *ManagedPrefixList) pulumi.StringOutput { return v.OwnerId }).(pulumi.StringOutput) 333 } 334 335 // Map of tags to assign to this resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. 336 func (o ManagedPrefixListOutput) Tags() pulumi.StringMapOutput { 337 return o.ApplyT(func(v *ManagedPrefixList) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput) 338 } 339 340 // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. 341 // 342 // Deprecated: Please use `tags` instead. 343 func (o ManagedPrefixListOutput) TagsAll() pulumi.StringMapOutput { 344 return o.ApplyT(func(v *ManagedPrefixList) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput) 345 } 346 347 // Latest version of this prefix list. 348 func (o ManagedPrefixListOutput) Version() pulumi.IntOutput { 349 return o.ApplyT(func(v *ManagedPrefixList) pulumi.IntOutput { return v.Version }).(pulumi.IntOutput) 350 } 351 352 type ManagedPrefixListArrayOutput struct{ *pulumi.OutputState } 353 354 func (ManagedPrefixListArrayOutput) ElementType() reflect.Type { 355 return reflect.TypeOf((*[]*ManagedPrefixList)(nil)).Elem() 356 } 357 358 func (o ManagedPrefixListArrayOutput) ToManagedPrefixListArrayOutput() ManagedPrefixListArrayOutput { 359 return o 360 } 361 362 func (o ManagedPrefixListArrayOutput) ToManagedPrefixListArrayOutputWithContext(ctx context.Context) ManagedPrefixListArrayOutput { 363 return o 364 } 365 366 func (o ManagedPrefixListArrayOutput) Index(i pulumi.IntInput) ManagedPrefixListOutput { 367 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ManagedPrefixList { 368 return vs[0].([]*ManagedPrefixList)[vs[1].(int)] 369 }).(ManagedPrefixListOutput) 370 } 371 372 type ManagedPrefixListMapOutput struct{ *pulumi.OutputState } 373 374 func (ManagedPrefixListMapOutput) ElementType() reflect.Type { 375 return reflect.TypeOf((*map[string]*ManagedPrefixList)(nil)).Elem() 376 } 377 378 func (o ManagedPrefixListMapOutput) ToManagedPrefixListMapOutput() ManagedPrefixListMapOutput { 379 return o 380 } 381 382 func (o ManagedPrefixListMapOutput) ToManagedPrefixListMapOutputWithContext(ctx context.Context) ManagedPrefixListMapOutput { 383 return o 384 } 385 386 func (o ManagedPrefixListMapOutput) MapIndex(k pulumi.StringInput) ManagedPrefixListOutput { 387 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ManagedPrefixList { 388 return vs[0].(map[string]*ManagedPrefixList)[vs[1].(string)] 389 }).(ManagedPrefixListOutput) 390 } 391 392 func init() { 393 pulumi.RegisterInputType(reflect.TypeOf((*ManagedPrefixListInput)(nil)).Elem(), &ManagedPrefixList{}) 394 pulumi.RegisterInputType(reflect.TypeOf((*ManagedPrefixListArrayInput)(nil)).Elem(), ManagedPrefixListArray{}) 395 pulumi.RegisterInputType(reflect.TypeOf((*ManagedPrefixListMapInput)(nil)).Elem(), ManagedPrefixListMap{}) 396 pulumi.RegisterOutputType(ManagedPrefixListOutput{}) 397 pulumi.RegisterOutputType(ManagedPrefixListArrayOutput{}) 398 pulumi.RegisterOutputType(ManagedPrefixListMapOutput{}) 399 }