fix(terraform): update subnet_id in docker-swarm module to use swarm-public-subnet instead of swarm-subnet for improved clarity
feat(terraform): add aws_subnet resource for swarm-public-subnet to create a public subnet for the swarm cluster feat(terraform): add aws_internet_gateway resource to create an internet gateway for the swarm VPC feat(terraform): add aws_route_table resource to create a route table for the swarm VPC feat(terraform): add aws_route_table_association resource to associate the swarm-public-subnet with the public route table
This commit is contained in:
parent
6afaede719
commit
3fe30671d9
1 changed files with 25 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ module "docker-swarm" {
|
|||
source = "./modules/docker-swarm"
|
||||
key_name = aws_key_pair.swarm-key.key_name
|
||||
vpc_id = aws_vpc.swarm-vpc.id
|
||||
subnet_id = aws_subnet.swarm-subnet.id
|
||||
subnet_id = aws_subnet.swarm-public-subnet.id
|
||||
security_group = aws_security_group.swarm-sg.id
|
||||
instance_type = "t2.micro" # Choose the instance type as needed
|
||||
manager_count = 1
|
||||
|
|
@ -24,11 +24,34 @@ resource "aws_vpc" "swarm-vpc" {
|
|||
enable_dns_hostnames = true
|
||||
}
|
||||
|
||||
resource "aws_subnet" "swarm-subnet" {
|
||||
resource "aws_subnet" "swarm-private-subnet" {
|
||||
vpc_id = aws_vpc.swarm-vpc.id
|
||||
cidr_block = "10.0.1.0/24"
|
||||
}
|
||||
|
||||
resource "aws_subnet" "swarm-public-subnet" {
|
||||
vpc_id = aws_vpc.swarm-vpc.id
|
||||
cidr_block = "10.0.2.0/24"
|
||||
}
|
||||
|
||||
resource "aws_internet_gateway" "igw" {
|
||||
vpc_id = aws_vpc.swarm-vpc.id
|
||||
}
|
||||
|
||||
resource "aws_route_table" "public_rt" {
|
||||
vpc_id = aws_vpc.swarm-vpc.id
|
||||
|
||||
route {
|
||||
cidr_block = "0.0.0.0/0"
|
||||
gateway_id = aws_internet_gateway.igw.id
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_route_table_association" "public_subnet_asso" {
|
||||
subnet_id = aws_subnet.swarm-public-subnet.id
|
||||
route_table_id = aws_route_table.public_rt.id
|
||||
}
|
||||
|
||||
resource "aws_security_group" "swarm-sg" {
|
||||
vpc_id = aws_vpc.swarm-vpc.id
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue