Skip to content

feat: Move to using for_each for resource blocks #326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
107 changes: 2 additions & 105 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.29 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.63 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.29 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.63 |

## Modules

Expand Down
149 changes: 4 additions & 145 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ module "complete_sg" {
# Open for all CIDRs defined in ingress_cidr_blocks
ingress_rules = ["https-443-tcp"]

# Use computed value here (eg, `${module...}`). Plain string is not a real use-case for this argument.
computed_ingress_rules = ["ssh-tcp"]
number_of_computed_ingress_rules = 1

# Open to CIDRs blocks (rule or from_port+to_port+protocol+description)
ingress_with_cidr_blocks = [
{
Expand All @@ -94,45 +90,6 @@ module "complete_sg" {
},
]

computed_ingress_with_cidr_blocks = [
{
rule = "postgresql-tcp"
cidr_blocks = "3.3.3.3/32,${module.vpc.vpc_cidr_block}"
},
{
from_port = 15
to_port = 25
protocol = 6
description = "Service name with vpc cidr"
cidr_blocks = module.vpc.vpc_cidr_block
},
]

number_of_computed_ingress_with_cidr_blocks = 2

# Open to IPV6 CIDR blocks (rule or from_port+to_port+protocol+description)
ingress_with_ipv6_cidr_blocks = [
{
from_port = 300
to_port = 400
protocol = "tcp"
description = "Service ports (ipv6)"
ipv6_cidr_blocks = "2001:db8::/64"
},
]

computed_ingress_with_ipv6_cidr_blocks = [
{
from_port = 350
to_port = 450
protocol = "tcp"
description = "Service ports (ipv6). VPC ID = ${module.vpc.vpc_id}"
ipv6_cidr_blocks = "2001:db8::/64"
},
]

number_of_computed_ingress_with_ipv6_cidr_blocks = 1

# Open for security group id (rule or from_port+to_port+protocol+description)
ingress_with_source_security_group_id = [
{
Expand All @@ -148,22 +105,6 @@ module "complete_sg" {
},
]

computed_ingress_with_source_security_group_id = [
{
rule = "postgresql-tcp"
source_security_group_id = module.main_sg.security_group_id
},
{
from_port = 23
to_port = 23
protocol = 6
description = "Service name"
source_security_group_id = module.main_sg.security_group_id
},
]

number_of_computed_ingress_with_source_security_group_id = 2

# Open for self (rule or from_port+to_port+protocol+description)
ingress_with_self = [
{
Expand All @@ -184,18 +125,6 @@ module "complete_sg" {
},
]

computed_ingress_with_self = [
{
from_port = 32
to_port = 43
protocol = 6
description = "Service name. VPC ID: ${module.vpc.vpc_id}"
self = true
},
]

number_of_computed_ingress_with_self = 1

# Default CIDR blocks, which will be used for all egress rules in this module. Typically these are CIDR blocks of the VPC.
# If this is not specified then no CIDR blocks will be used.
egress_cidr_blocks = ["10.10.0.0/16"]
Expand All @@ -207,9 +136,6 @@ module "complete_sg" {
# Open for all CIDRs defined in egress_cidr_blocks
egress_rules = ["http-80-tcp"]

computed_egress_rules = ["ssh-tcp"]
number_of_computed_egress_rules = 1

# Open to CIDRs blocks (rule or from_port+to_port+protocol+description)
egress_with_cidr_blocks = [
{
Expand All @@ -229,38 +155,6 @@ module "complete_sg" {
},
]

computed_egress_with_cidr_blocks = [
{
rule = "https-443-tcp"
cidr_blocks = module.vpc.vpc_cidr_block
},
]

number_of_computed_egress_with_cidr_blocks = 1

# Open to IPV6 CIDR blocks (rule or from_port+to_port+protocol+description)
egress_with_ipv6_cidr_blocks = [
{
from_port = 300
to_port = 400
protocol = "tcp"
description = "Service ports (ipv6)"
ipv6_cidr_blocks = "2001:db8::/64"
},
]

computed_egress_with_ipv6_cidr_blocks = [
{
from_port = 55
to_port = 66
protocol = "tcp"
description = "Service ports (ipv6). VPC ID: ${module.vpc.vpc_id}"
ipv6_cidr_blocks = "2001:db8::/64"
},
]

number_of_computed_egress_with_ipv6_cidr_blocks = 1

# Open for security group id (rule or from_port+to_port+protocol+description)
egress_with_source_security_group_id = [
{
Expand All @@ -276,15 +170,6 @@ module "complete_sg" {
},
]

computed_egress_with_source_security_group_id = [
{
rule = "postgresql-tcp"
source_security_group_id = module.main_sg.security_group_id
},
]

number_of_computed_egress_with_source_security_group_id = 1

# Open for self (rule or from_port+to_port+protocol+description)
egress_with_self = [
{
Expand All @@ -305,14 +190,6 @@ module "complete_sg" {
},
]

computed_egress_with_self = [
{
rule = "https-443-tcp"
},
]

number_of_computed_egress_with_self = 1

create_timeout = "15m"
delete_timeout = "45m"
}
Expand All @@ -328,41 +205,23 @@ module "ipv4_ipv6_example" {
vpc_id = data.aws_vpc.default.id

ingress_with_cidr_blocks = [
{
from_port = 8080
to_port = 8090
protocol = "tcp"
description = "User-service ports (ipv4)"
cidr_blocks = "0.0.0.0/0"
},
]

ingress_with_ipv6_cidr_blocks = [
{
from_port = 8080
to_port = 8090
protocol = "tcp"
description = "User-service ports (ipv6)"
description = "User-service ports"
cidr_blocks = "0.0.0.0/0"
ipv6_cidr_blocks = "2001:db8::/64"
},
]

egress_with_cidr_blocks = [
{
from_port = 8090
to_port = 8100
protocol = "tcp"
description = "User-service ports (ipv4)"
cidr_blocks = "0.0.0.0/0"
},
]

egress_with_ipv6_cidr_blocks = [
{
from_port = 8090
to_port = 8100
protocol = "tcp"
description = "User-service ports (ipv6)"
description = "User-service ports"
cidr_blocks = "0.0.0.0/0"
ipv6_cidr_blocks = "2001:db8::/64"
},
]
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3.29"
version = ">= 5.63"
}
}
}
59 changes: 0 additions & 59 deletions examples/computed/README.md

This file was deleted.

54 changes: 0 additions & 54 deletions examples/computed/main.tf

This file was deleted.

29 changes: 0 additions & 29 deletions examples/computed/outputs.tf

This file was deleted.

Loading
Loading