diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 1423c2a..9df5424 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -9,6 +9,15 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 - - uses: actions/setup-python@v6 - - uses: pre-commit/action@v3.0.1 \ No newline at end of file + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v3 + with: + terraform_version: 1.9.8 + + - uses: pre-commit/action@v3.0.1 diff --git a/README.md b/README.md index f8896bd..dffc6ba 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ To use this module, include it in your Terraform configuration file and provide ```hcl module "private-subnets" { - source = "https://github.com/opszero/terraform-aws-subnet.git" + source = "git::https://github.com/opszero/terraform-aws-subnets.git?ref=v1.0.0" name = "app" environment = "test" nat_gateway_enabled = true @@ -31,16 +31,15 @@ module "private-subnets" { cidr_block = module.vpc.vpc_cidr_block ipv6_cidr_block = module.vpc.ipv6_cidr_block ipv4_private_cidrs = ["10.0.3.0/24"] - public_subnet_ids = ["subnet-07962e9e61ad3bcd3"] - enable_ipv6 = true + public_subnet_ids = ["subnet-01ef5b61799cc9943", "subnet-0542749d02b264baa"] + enable_ipv6 = false } ``` - # Example: public-private-subnet-single-nat-gateway ```hcl module "subnets" { - source = "https://github.com/opszero/terraform-aws-subnet.git" + source = "git::https://github.com/opszero/terraform-aws-subnets.git?ref=v1.0.0" name = "app" environment = "test" nat_gateway_enabled = true @@ -55,16 +54,15 @@ module "subnets" { } ``` - # Example: public-private ```hcl module "subnets" { - source = "https://github.com/opszero/terraform-aws-subnet.git" + source = "git::https://github.com/opszero/terraform-aws-subnets.git?ref=v1.0.0" name = "app" environment = "test" nat_gateway_enabled = true - availability_zones = ["us-east-1a", "us-east-1b"] + availability_zones = ["eu-west-1a", "eu-west-1b"] vpc_id = module.vpc.vpc_id type = "public-private" igw_id = module.vpc.igw_id @@ -78,7 +76,7 @@ module "subnets" { ```hcl module "subnet" { - source = "https://github.com/opszero/terraform-aws-subnet.git" + source = "git::https://github.com/opszero/terraform-aws-subnets.git?ref=v1.0.0" name = "app" environment = "test" availability_zones = ["eu-west-1a", "eu-west-1b", ] @@ -91,12 +89,11 @@ module "subnet" { } ``` - # Example: database-subnet ```hcl module "subnet" { - source = "https://github.com/opszero/terraform-aws-subnet.git" + source = "git::https://github.com/opszero/terraform-aws-subnets.git?ref=v1.0.0" name = "app" environment = "test" availability_zones = ["eu-west-1a", "eu-west-1b", "eu-west-1c"] @@ -113,7 +110,7 @@ You can customize the input variables according to your specific requirements. ```hcl module "subnet" { - source = "https://github.com/opszero/terraform-aws-subnet.git" + source = "git::https://github.com/opszero/terraform-aws-subnets.git?ref=v1.0.0" name = "app" environment = "test" availability_zones = ["eu-west-1a", "eu-west-1b", ] @@ -124,17 +121,18 @@ module "subnet" { cidr_block = module.vpc.vpc_cidr_block ipv6_cidr_block = module.vpc.ipv6_cidr_block igw_id = module.vpc.igw_id + enable_ipv6 = true } ``` ## Examples -For detailed examples on how to use this module, please refer to the [Examples](https://github.com/opszero/terraform-aws-subnet/tree/master/_example) directory within this repository. +For detailed examples on how to use this module, please refer to the [Examples](https://github.com/opszero/terraform-aws-subnets/tree/master/_example) directory within this repository. ## Author Your Name Replace **MIT** and **opszero** with the appropriate license and your information. Feel free to expand this README with additional details or usage instructions as needed for your specific use case. ## License -This project is licensed under the **MIT** License - see the [LICENSE](https://github.com/opszero/terraform-aws-subnet/blob/master/LICENSE) file for details. +This project is licensed under the **MIT** License - see the [LICENSE](https://github.com/opszero/terraform-aws-subnets/blob/master/LICENSE) file for details. @@ -150,9 +148,9 @@ This project is licensed under the **MIT** License - see the [LICENSE](https://g | [availability\_zones](#input\_availability\_zones) | List of Availability Zones (e.g. `['us-east-1a', 'us-east-1b', 'us-east-1c']`). | `list(string)` | `[]` | no | | [cidr\_block](#input\_cidr\_block) | Base CIDR block which is divided into subnet CIDR blocks (e.g. `10.0.0.0/16`). | `string` | `null` | no | | [customer\_owned\_ipv4\_pool](#input\_customer\_owned\_ipv4\_pool) | The customer-owned IPv4 address pool for the subnet | `string` | `""` | no | -| [database\_inbound\_acl\_rules](#input\_database\_inbound\_acl\_rules) | database subnets inbound network ACLs | `list(map(string))` |
[| no | +| [database\_inbound\_acl\_rules](#input\_database\_inbound\_acl\_rules) | database subnets inbound network ACLs | `list(map(string))` |
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
[| no | | [database\_ipv6\_cidrs](#input\_database\_ipv6\_cidrs) | database Subnet CIDR blocks (e.g. `2a05:d018:832:ca02::/64`). | `list(any)` | `[]` | no | -| [database\_outbound\_acl\_rules](#input\_database\_outbound\_acl\_rules) | database subnets outbound network ACLs | `list(map(string))` |
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
[| no | +| [database\_outbound\_acl\_rules](#input\_database\_outbound\_acl\_rules) | database subnets outbound network ACLs | `list(map(string))` |
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
[| no | | [database\_subnet\_assign\_ipv6\_address\_on\_creation](#input\_database\_subnet\_assign\_ipv6\_address\_on\_creation) | Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. | `bool` | `false` | no | | [database\_subnet\_enable\_dns64](#input\_database\_subnet\_enable\_dns64) | Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. Default: `true` | `bool` | `false` | no | | [database\_subnet\_enable\_resource\_name\_dns\_a\_record\_on\_launch](#input\_database\_subnet\_enable\_resource\_name\_dns\_a\_record\_on\_launch) | Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false` | `bool` | `false` | no | @@ -200,18 +198,18 @@ This project is licensed under the **MIT** License - see the [LICENSE](https://g | [nat\_gateway\_destination\_cidr\_block](#input\_nat\_gateway\_destination\_cidr\_block) | The CIDR block for the NAT gateway route. | `string` | `"0.0.0.0/0"` | no | | [nat\_gateway\_enabled](#input\_nat\_gateway\_enabled) | Flag to enable/disable NAT Gateways creation in public subnets. | `bool` | `false` | no | | [outpost\_arn](#input\_outpost\_arn) | The ARN of the Outpost to create the subnet in | `string` | `""` | no | -| [private\_inbound\_acl\_rules](#input\_private\_inbound\_acl\_rules) | Private subnets inbound network ACLs | `list(map(string))` |
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
[| no | +| [private\_inbound\_acl\_rules](#input\_private\_inbound\_acl\_rules) | Private subnets inbound network ACLs | `list(map(string))` |
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
[| no | | [private\_ipv6\_cidrs](#input\_private\_ipv6\_cidrs) | Private Subnet CIDR blocks (e.g. `2a05:d018:832:ca02::/64`). | `list(any)` | `[]` | no | -| [private\_outbound\_acl\_rules](#input\_private\_outbound\_acl\_rules) | Private subnets outbound network ACLs | `list(map(string))` |
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
[| no | +| [private\_outbound\_acl\_rules](#input\_private\_outbound\_acl\_rules) | Private subnets outbound network ACLs | `list(map(string))` |
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
[| no | | [private\_subnet\_assign\_ipv6\_address\_on\_creation](#input\_private\_subnet\_assign\_ipv6\_address\_on\_creation) | Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. | `bool` | `false` | no | | [private\_subnet\_enable\_dns64](#input\_private\_subnet\_enable\_dns64) | Indicates whether DNS queries made to the Amazon-provided DNS Resolver in this subnet should return synthetic IPv6 addresses for IPv4-only destinations. Default: `true` | `bool` | `false` | no | | [private\_subnet\_enable\_resource\_name\_dns\_a\_record\_on\_launch](#input\_private\_subnet\_enable\_resource\_name\_dns\_a\_record\_on\_launch) | Indicates whether to respond to DNS queries for instance hostnames with DNS A records. Default: `false` | `bool` | `false` | no | | [private\_subnet\_enable\_resource\_name\_dns\_aaaa\_record\_on\_launch](#input\_private\_subnet\_enable\_resource\_name\_dns\_aaaa\_record\_on\_launch) | Indicates whether to respond to DNS queries for instance hostnames with DNS AAAA records. Default: `true` | `bool` | `false` | no | | [private\_subnet\_ipv6\_native](#input\_private\_subnet\_ipv6\_native) | Indicates whether to create an IPv6-only private subnet. Default: `false` | `bool` | `false` | no | | [private\_subnet\_private\_dns\_hostname\_type\_on\_launch](#input\_private\_subnet\_private\_dns\_hostname\_type\_on\_launch) | The type of hostnames to assign to instances in the subnet at launch. For IPv6-only subnets, an instance DNS name must be based on the instance ID. For dual-stack and IPv4-only subnets, you can specify whether DNS names use the instance IPv4 address or the instance ID. Valid values: `ip-name`, `resource-name` | `string` | `null` | no | -| [public\_inbound\_acl\_rules](#input\_public\_inbound\_acl\_rules) | Public subnets inbound network ACLs | `list(map(string))` |
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
[| no | +| [public\_inbound\_acl\_rules](#input\_public\_inbound\_acl\_rules) | Public subnets inbound network ACLs | `list(map(string))` |
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
[| no | | [public\_ipv6\_cidrs](#input\_public\_ipv6\_cidrs) | Public Subnet CIDR blocks (e.g. `2a05:d018:832:ca02::/64`). | `list(any)` | `[]` | no | -| [public\_outbound\_acl\_rules](#input\_public\_outbound\_acl\_rules) | Public subnets outbound network ACLs | `list(map(string))` |
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
[| no | +| [public\_outbound\_acl\_rules](#input\_public\_outbound\_acl\_rules) | Public subnets outbound network ACLs | `list(map(string))` |
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
[| no | | [public\_rt\_ipv4\_destination\_cidr](#input\_public\_rt\_ipv4\_destination\_cidr) | The destination ipv4 CIDR block. | `string` | `"0.0.0.0/0"` | no | | [public\_rt\_ipv6\_destination\_cidr](#input\_public\_rt\_ipv6\_destination\_cidr) | The destination ipv6 CIDR block. | `string` | `"::/0"` | no | | [public\_subnet\_assign\_ipv6\_address\_on\_creation](#input\_public\_subnet\_assign\_ipv6\_address\_on\_creation) | Specify true to indicate that network interfaces created in the specified subnet should be assigned an IPv6 address. | `bool` | `false` | no | @@ -222,7 +220,7 @@ This project is licensed under the **MIT** License - see the [LICENSE](https://g | [public\_subnet\_ipv6\_native](#input\_public\_subnet\_ipv6\_native) | Indicates whether to create an IPv6-only public subnet. Default: `false` | `bool` | `false` | no | | [public\_subnet\_private\_dns\_hostname\_type\_on\_launch](#input\_public\_subnet\_private\_dns\_hostname\_type\_on\_launch) | The type of private DNS hostname to assign to instances in this subnet at launch. Must be either 'ip-name' or 'resource-name'. | `string` | `"ip-name"` | no | | [single\_nat\_gateway](#input\_single\_nat\_gateway) | Enable for only single NAT Gateway in one Availability Zone | `bool` | `false` | no | -| [tags](#input\_tags) | Global tags to apply to resources. | `map(string)` |
{
"cidr_block": "0.0.0.0/0",
"from_port": 0,
"protocol": "-1",
"rule_action": "allow",
"rule_number": 100,
"to_port": 0
}
]
{| no | +| [tags](#input\_tags) | Global tags to apply to resources. | `map(string)` |
"Environment": "production",
"ManagedBy": "Terraform",
"Name": "my-resource-name"
}
{| no | | [transit\_gateway\_id](#input\_transit\_gateway\_id) | Transit Gateway ID to attach to. | `string` | `null` | no | | [type](#input\_type) | Type of subnets to create (`private` or `public`). | `string` | `""` | no | | [vpc\_id](#input\_vpc\_id) | The VPC ID where the public and private subnets will be created. | `string` | n/a | yes | diff --git a/example/database-subnet/example.tf b/example/database-subnet/example.tf index 53c9c5f..98f3029 100644 --- a/example/database-subnet/example.tf +++ b/example/database-subnet/example.tf @@ -6,7 +6,7 @@ provider "aws" { ## Vpc Module call. ##====================================================================== module "vpc" { - source = "https://github.com/opszero/terraform-aws-subnet.git" + source = "git::https://github.com/opszero/terraform-aws-vpc.git?ref=v1.0.1" name = "test" cidr_block = "10.0.0.0/16" } diff --git a/example/private-subnet/example.tf b/example/private-subnet/example.tf index a1adb98..441f91e 100644 --- a/example/private-subnet/example.tf +++ b/example/private-subnet/example.tf @@ -6,7 +6,7 @@ provider "aws" { ## Vpc Module call. ##=========================================================================== module "vpc" { - source = "https://github.com/opszero/terraform-aws-subnet.git" + source = "git::https://github.com/opszero/terraform-aws-vpc.git?ref=v1.0.1" name = "test" cidr_block = "10.0.0.0/16" } diff --git a/example/public-private-database-subnet/example.tf b/example/public-private-database-subnet/example.tf index 0b47540..45ecf39 100644 --- a/example/public-private-database-subnet/example.tf +++ b/example/public-private-database-subnet/example.tf @@ -7,7 +7,7 @@ provider "aws" { ## Vpc Module call. ##============================================================================= module "vpc" { - source = "https://github.com/opszero/terraform-aws-subnet.git" + source = "git::https://github.com/opszero/terraform-aws-vpc.git?ref=v1.0.1" name = "test" cidr_block = "10.0.0.0/16" } diff --git a/example/public-private-subnet-single-nat-gateway/example.tf b/example/public-private-subnet-single-nat-gateway/example.tf index b5e010d..635f431 100644 --- a/example/public-private-subnet-single-nat-gateway/example.tf +++ b/example/public-private-subnet-single-nat-gateway/example.tf @@ -6,7 +6,7 @@ provider "aws" { ## Vpc Module call. ##============================================================================ module "vpc" { - source = "https://github.com/opszero/terraform-aws-subnet.git" + source = "git::https://github.com/opszero/terraform-aws-vpc.git?ref=v1.0.1" name = "test" cidr_block = "10.0.0.0/16" } diff --git a/example/public-private/example.tf b/example/public-private/example.tf index 718d86a..7e5be71 100644 --- a/example/public-private/example.tf +++ b/example/public-private/example.tf @@ -6,7 +6,7 @@ provider "aws" { ## Vpc Module call. ##============================================================================ module "vpc" { - source = "https://github.com/opszero/terraform-aws-subnet.git" + source = "git::https://github.com/opszero/terraform-aws-vpc.git?ref=v1.0.1" name = "test" cidr_block = "10.0.0.0/16" } diff --git a/example/public-subnet/example.tf b/example/public-subnet/example.tf index 5fa42bb..ba9bb7f 100644 --- a/example/public-subnet/example.tf +++ b/example/public-subnet/example.tf @@ -6,7 +6,7 @@ provider "aws" { ## Vpc Module call. ##======================================================================= module "vpc" { - source = "https://github.com/opszero/terraform-aws-subnet.git" + source = "git::https://github.com/opszero/terraform-aws-vpc.git?ref=v1.0.1" name = "test" cidr_block = "10.0.0.0/16" }
"Environment": "production",
"ManagedBy": "Terraform",
"Name": "my-resource-name"
}