Skip to content

hiro1202/terraform-aws-network

Repository files navigation

terraform-aws-network

VPC・サブネット・Internet Gateway・NAT Gateway を作成する Terraform モジュール。

Usage

プライベートサブネットのみ

module "network" {
  source = "git::https://github.com/hiro1202/terraform-aws-network.git"

  name            = "my-app"
  vpc_cidr        = "10.0.0.0/16"
  private_subnets = ["10.0.1.0/24", "10.0.2.0/24"]
}

パブリック・プライベート構成(NAT Gateway あり)

module "network" {
  source = "git::https://github.com/hiro1202/terraform-aws-network.git"

  name            = "my-app"
  vpc_cidr        = "10.0.0.0/16"
  private_subnets = ["10.0.1.0/24", "10.0.2.0/24"]
  public_subnets  = ["10.0.101.0/24", "10.0.102.0/24"]

  create_internet_gateway = true
  create_nat_gateway      = true
}

Development

Command Description
make init terraform init -backend=false を実行
make fmt terraform fmt -recursive -diff を実行
make validate make init 後に terraform validate を実行
make test make init 後に terraform test を実行
make tflint tflint --init && tflint --recursive を実行
make checkov checkov -d . を実行
make ci すべてのチェックを実行(fmt / validate / test / tflint / checkov)

Requirements

Name Version
terraform >= 1.0
aws >= 6.31.0

Providers

Name Version
aws 6.30.0

Resources

Name Type
aws_eip.nat resource
aws_internet_gateway.this resource
aws_nat_gateway.this resource
aws_route.private_nat resource
aws_route.public_internet resource
aws_route_table.private resource
aws_route_table.public resource
aws_route_table_association.private resource
aws_route_table_association.public resource
aws_subnet.private resource
aws_subnet.public resource
aws_vpc.this resource

Inputs

Name Description Type Default Required
create_internet_gateway Internet Gatewayを作成する場合はtrue bool false no
create_nat_gateway NAT Gatewayを作成する場合はtrue bool false no
enable_dns_hostnames VPCでDNSホスト名を有効にする場合はtrue bool true no
enable_dns_support VPCでDNSサポートを有効にする場合はtrue bool true no
name すべてのリソースの識別子として使用される名前 string n/a yes
private_subnets プライベートサブネットのCIDRブロックリスト list(string) [] no
public_subnets パブリックサブネットのCIDRブロックリスト list(string) [] no
vpc_cidr VPCのCIDRブロック string "10.0.0.0/16" no

Outputs

Name Description
private_subnet_cidrs プライベートサブネットのCIDRブロックリスト
private_subnet_ids プライベートサブネットのIDリスト
public_subnet_cidrs パブリックサブネットのCIDRブロックリスト
public_subnet_ids パブリックサブネットのIDリスト
vpc_cidr_block VPCのCIDRブロック
vpc_id VPCのID

License

MIT Licensed. See LICENSE for full details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors