A simple module that creates subnets for you.
Make sure you have a VPC and know what region you are in.
Apply below module:
module "aws-subnet" {
source = "./aws-subnet"
subnet_cidr_block = var.subnet_cidr_block
vpc_id = aws_vpc.main.id
subnet_name = var.subnet_name
aws_region = var.aws_region
aws_role_arn = var.aws_role_arn
subnet_tags = var.subnet_tags
}
aws_role_arn
is optional and can be set to null (or omitted)
- We automatically add the tag
CreatedBy = "terraform-aws-subnet"
to all subnets. As of now, this can't be turned off.
Name | Version |
---|---|
terraform | ~> 1.0 |
aws | >= 5.0 |
Name | Version |
---|---|
aws | >= 5.0 |
Name | Source | Version |
---|---|---|
aws-subnet | ./aws-subnet | n/a |
Name | Type |
---|---|
aws_vpc.main | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
aws_region | AWS Region | any |
null |
no |
aws_role_arn | AWS Role ARN | any |
null |
no |
subnet_az | availability zone | string |
null |
no |
subnet_cidr_block | CIDR block for subnet | string |
null |
no |
subnet_name | Name for subnet | string |
null |
no |
subnet_tags | Tags | map(any) |
{ |
no |
vpc_cidr | CIDR block for VPC | string |
"10.0.0.0/16" |
no |
vpc_id | VPC ID | any |
null |
no |
Name | Description |
---|---|
vpc_id | n/a |