Add group 3 network imports

This commit is contained in:
2026-11-14 18:13:08 +09:00
parent 5a223937cf
commit 4433535637
11 changed files with 964 additions and 0 deletions
+94
View File
@@ -105,3 +105,97 @@ import {
to = module.iam_auth.aws_iam_user_policy.sts_route53
id = "vault-iam-create:sts-route53"
}
import {
to = module.network_public.aws_vpc.protected[0]
id = "vpc-68ee3b0d"
}
import {
for_each = local.network_subnet_ids
to = module.network_public.aws_subnet.protected[each.key]
id = each.value
}
import {
to = module.network_public.aws_internet_gateway.protected[0]
id = "igw-bfe81eda"
}
import {
to = module.network_public.aws_default_route_table.protected[0]
id = "vpc-68ee3b0d"
}
import {
to = module.network_public.aws_route_table.protected[0]
id = "rtb-0cb396364ef535126"
}
import {
for_each = local.network_route_import_ids
to = module.network_public.aws_route.this[each.key]
id = each.value
}
import {
for_each = local.network_route_association_import_ids
to = module.network_public.aws_route_table_association.this[each.key]
id = each.value
}
import {
to = module.network_public.aws_default_network_acl.this
id = "acl-208c5e45"
}
import {
to = module.network_public.aws_vpc_dhcp_options.this
id = "dopt-816972e3"
}
import {
to = module.network_public.aws_vpc_dhcp_options_association.this
id = "vpc-68ee3b0d"
}
import {
to = module.network_public.aws_security_group.web
id = "sg-b5e45ed0"
}
import {
for_each = local.web_ingress_rule_ids
to = module.network_public.aws_vpc_security_group_ingress_rule.web[each.key]
id = each.value
}
import {
to = module.network_public.aws_vpc_security_group_egress_rule.web_all_ipv4
id = "sgr-0f27372c08f83f904"
}
import {
to = module.network_public.aws_instance.web_protected[0]
id = "i-0a2d6193bfd326038"
}
import {
to = module.network_public.aws_flow_log.s3
id = local.vpc_flow_log_ids.s3
}
import {
to = module.network_public.aws_flow_log.cloudwatch
id = local.vpc_flow_log_ids.cloudwatch
}
import {
to = module.network_public.aws_key_pair.amazon
id = "amazon"
}
import {
to = module.network_public.aws_default_security_group.this
id = "sg-d3e15bb6"
}
+258
View File
@@ -10,6 +10,48 @@ locals {
retention_in_days = 14
}
}
network_subnet_ids = {
intra_a = "subnet-08ec1e8aa9b59a741"
dmz = "subnet-0254975b"
intra_d = "subnet-0a6f7342f20992028"
}
network_route_import_ids = {
dmz_private_a = "rtb-881ca2ec_172.20.0.0/24"
dmz_private_b = "rtb-881ca2ec_192.168.0.0/16"
dmz_internet = "rtb-881ca2ec_0.0.0.0/0"
intra_private_a = "rtb-0cb396364ef535126_172.20.0.0/24"
intra_private_b = "rtb-0cb396364ef535126_192.168.0.0/16"
intra_default = "rtb-0cb396364ef535126_0.0.0.0/0"
}
network_route_association_import_ids = {
dmz = "subnet-0254975b/rtb-881ca2ec"
intra_a = "subnet-08ec1e8aa9b59a741/rtb-0cb396364ef535126"
intra_d = "subnet-0a6f7342f20992028/rtb-0cb396364ef535126"
}
web_ingress_rule_ids = {
icmp_private = "sgr-047648c0e31750f8d"
icmp_vyos = "sgr-0c6e27ce7adeebf87"
ssh_vyos = "sgr-004a45983fc47a5d3"
http = "sgr-068d0f27af39e8e1e"
https = "sgr-0e751496addb91413"
http3 = "sgr-0ca29322688fd5b02"
consul_server = "sgr-0fca5bbcb9ee874b0"
consul_lan_tcp = "sgr-0a9ebdc07f7e552fa"
consul_lan_udp = "sgr-0038e075c7bfd5dc5"
ssh_admin = "sgr-092cd72b6bb22d201"
ssh_git = "sgr-0f8d953855c7315f4"
wireguard = "sgr-0d85fe840d3fc1172"
prometheus = "sgr-074e62f626b5ffd11"
}
vpc_flow_log_ids = {
s3 = "fl-078c5e5e029ddbf59"
cloudwatch = "fl-04b92a3f869a9f322"
}
}
module "audit_logging_encryption" {
@@ -56,3 +98,219 @@ module "iam_auth" {
vault_kms_resource_arns = module.audit_logging_encryption.vault_kms_resource_arns
}
module "network_public" {
source = "../../modules/network_public"
region = var.region
name_prefix = var.name_prefix
protect_from_destroy = true
vpc = {
cidr_block = "10.0.0.0/16"
enable_dns_support = true
enable_dns_hostnames = true
tags = {
Name = "NW"
Env = "homelab"
}
}
subnets = {
intra_a = {
cidr_block = "10.0.110.0/24"
availability_zone = "ap-northeast-1a"
tags = {
Name = "NW-Intra-az4"
Env = "homelab"
}
}
dmz = {
cidr_block = "10.0.1.0/24"
availability_zone = "ap-northeast-1c"
tags = {
Name = "NW-DMZ-az1c"
}
}
intra_d = {
cidr_block = "10.0.120.0/24"
availability_zone = "ap-northeast-1d"
tags = {
Name = "NW-Intra-az2"
}
}
}
route_table_tags = {
dmz = { Name = "ACT-DMZ" }
intra = { Name = "ACT-Intra" }
}
internet_gateway_tags = {
Env = "homelab"
}
route_destinations = {
private_network_a = "172.20.0.0/24"
private_network_b = "192.168.0.0/16"
default_ipv4 = "0.0.0.0/0"
}
vyos_network_interface_id = "eni-066a00f06de027688"
vyos_security_group_id = "sg-827947e5"
dhcp_options = {
domain_name = "ap-northeast-1.compute.internal"
domain_name_servers = ["AmazonProvidedDNS"]
}
ssh_security_group = {
name = "SSH Enabled"
description = "launch-wizard-1 created 2015-03-18T23:05:30.230+09:00"
}
ssh_ingress_rules = {
icmp_private = {
description = "ICMP"
ip_protocol = "icmp"
cidr_ipv4 = "10.100.0.0/16"
}
icmp_vyos = {
description = "ICMP"
ip_protocol = "icmp"
use_vyos_security_group = true
}
ssh_vyos = {
description = "SSH"
ip_protocol = "tcp"
from_port = 22
to_port = 22
use_vyos_security_group = true
}
http = {
description = "HTTP"
ip_protocol = "tcp"
from_port = 80
to_port = 80
cidr_ipv4 = "0.0.0.0/0"
}
https = {
description = "HTTPs"
ip_protocol = "tcp"
from_port = 443
to_port = 443
cidr_ipv4 = "0.0.0.0/0"
}
http3 = {
description = ""
ip_protocol = "udp"
from_port = 443
to_port = 443
cidr_ipv4 = "0.0.0.0/0"
}
consul_server = {
description = "consul"
ip_protocol = "tcp"
from_port = 8300
to_port = 8300
use_vyos_security_group = true
}
consul_lan_tcp = {
description = "consul"
ip_protocol = "tcp"
from_port = 8301
to_port = 8301
use_vyos_security_group = true
}
consul_lan_udp = {
description = "consul"
ip_protocol = "udp"
from_port = 8301
to_port = 8301
use_vyos_security_group = true
}
ssh_admin = {
description = "SSH"
ip_protocol = "tcp"
from_port = 10022
to_port = 10022
cidr_ipv4 = "0.0.0.0/0"
}
ssh_git = {
description = "SSH for Git"
ip_protocol = "tcp"
from_port = 50022
to_port = 50022
cidr_ipv4 = "0.0.0.0/0"
}
wireguard = {
description = "wireguard"
ip_protocol = "udp"
from_port = 51820
to_port = 51820
cidr_ipv4 = "0.0.0.0/0"
}
prometheus = {
description = "prometheus"
ip_protocol = "tcp"
from_port = 60000
to_port = 60000
use_vyos_security_group = true
}
}
web_instance = {
name = "web2404"
ami = "ami-0b20f552f63953f0e"
instance_type = "t2.small"
subnet_key = "dmz"
associate_public_ip_address = true
source_dest_check = true
ebs_optimized = false
monitoring = false
metadata_options = {
http_endpoint = "enabled"
http_tokens = "required"
http_put_response_hop_limit = 2
http_protocol_ipv6 = "disabled"
instance_metadata_tags = "disabled"
}
root_block_device = {
delete_on_termination = true
encrypted = false
volume_size = 30
volume_type = "gp3"
iops = 3000
throughput = 125
}
tags = {
Env = "homelab"
}
}
key_pair = {
name = "amazon"
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDQtav7Kk5kQhycnIUieMbV5dULwXlagkozkFERf0KQG2ZaVwzscFNNbJyK0KpmQ08boJw7j6XC/iiM1TCXvzUzkLcWZzHjVMM6ZIMSp784dZKXl6zZoJK8xOznsHjopVC96kVJIMuS9CObI3K2M3UNWZh6Un5aB3BFEhFsVObaUX4PnEsBGtuC77Sx8XBfnyuhYWzCaZLEbIEsdXL/T/E4bsS5YnTif2dFI789QAPgZY5CWwKponlqvd2I1xlPYJbqzCGbLX0PV42TZkyRL4hDRU0rlXsoYMzSZCynwCJCeQsVsrjk6IPH73wZNCSCCdLIRWmKzVZaT5hNCFZ/F2X7 amazon"
}
flow_logs = {
s3 = {
destination_arn = module.audit_logging_encryption.flow_logs_bucket_arn
tags = {
Name = "ACT-dmz-flowlogs"
}
}
cloudwatch = {
log_group_arn = module.audit_logging_encryption.vpc_flow_logs_log_group_arn
iam_role_arn = module.iam_auth.flow_logs_role_arn
tags = {
Name = "Cloudwatch"
Env = "homelab"
}
}
}
}