Skip to content

Commit ff9164f

Browse files
committed
using prefix list in complete example
1 parent fec9eac commit ff9164f

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

examples/complete/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Note that this example may create resources which cost money. Run `terraform des
4040
| <a name="module_main_sg"></a> [main\_sg](#module\_main\_sg) | ../../ | n/a |
4141
| <a name="module_only_rules"></a> [only\_rules](#module\_only\_rules) | ../../ | n/a |
4242
| <a name="module_prefix_list"></a> [prefix\_list](#module\_prefix\_list) | ../../ | n/a |
43+
| <a name="module_prefix_list_sg"></a> [prefix\_list\_sg](#module\_prefix\_list\_sg) | ../../ | n/a |
4344
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 3.0 |
4445

4546
## Resources
@@ -48,6 +49,7 @@ Note that this example may create resources which cost money. Run `terraform des
4849
|------|------|
4950
| [aws_prefix_list.dynamodb](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/prefix_list) | data source |
5051
| [aws_prefix_list.s3](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/prefix_list) | data source |
52+
| [aws_ec2_managed_prefix_list.prefix_list_sg_example](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ec2_managed_prefix_list) | resource |
5153
| [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group) | data source |
5254
| [aws_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source |
5355

examples/complete/main.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,3 +437,30 @@ module "prefix_list" {
437437
},
438438
]
439439
}
440+
441+
#################################
442+
# Security group using prefix list
443+
#################################
444+
resource "aws_ec2_managed_prefix_list" "prefix_list_sg_example" {
445+
address_family = "IPv4"
446+
max_entries = 1
447+
name = "prefix-list-sg-example"
448+
449+
entry {
450+
cidr = module.vpc.vpc_cidr_block
451+
description = "VPC CIDR"
452+
}
453+
}
454+
455+
module "prefix_list_sg" {
456+
source = "../../"
457+
458+
name = "prefix-list-sg"
459+
description = "Security group using prefix list"
460+
vpc_id = data.aws_vpc.default.id
461+
462+
use_name_prefix = false
463+
464+
ingress_prefix_list_ids = [aws_ec2_managed_prefix_list.prefix_list_sg_example.id]
465+
ingress_rules = ["https-443-tcp"]
466+
}

0 commit comments

Comments
 (0)