This repository contains Terraform modules for setting up the infrastructure in AWS. The infrastructure is designed to be deployed on AWS, providing reusable and scalable components for building and managing your environment. The modules are organized into the following components:
This module is responsible for creating and managing the VPC and networking resources, including:
- VPC: The primary network for the environment.
- Subnets: Public and private subnets distributed across availability zones.
- Internet Gateway: Allows outbound internet access for resources in the public subnet.
- NAT Gateway: Provides internet access for resources in the private subnet.
- Route Tables: Configures routing for public and private subnets.
- VPC ID
- Subnet IDs (Public and Private)
- NAT Gateway IDs
- Elastic IPs for NAT Gateway and k8s node
This module defines security groups for controlling inbound and outbound traffic to the instances and other resources.
- Security Groups: Defines rules for accessing the k3s node, RDS database, and other servers.
- Security Group IDs for various resources
This module handles the deployment of EC2 instances for the k3s node, GitHub runner, and other necessary servers.
- EC2 Instances: Launches instances with the specified AMI, instance type, and user data scripts.
- User Data Scripts: Initializes the instances with necessary configurations (e.g., installing k3s).
- EC2 Instance IDs
- Public and Private IPs
This module sets up a VPN to securely access the private resources in the VPC.
- VPN Gateway and Connection: Establishes a secure connection to the VPC.
- Certificates: Manages the server and client certificates required for VPN authentication.
- VPN connection details
- Certificate ARNs
Each module is self-contained and can be integrated into larger infrastructure configurations.
After deployment, the output values will be printed to the console. These values include VPC IDs, subnet IDs, security group IDs, and public/private IPs of the EC2 instances.
- Clone the repository.
- Configure the necessary variables for your environment.
- Use Terraform to plan and then deploy each module:
terraform plan terraform apply
- Terraform >= 0.13
- AWS account with proper IAM permissions
Feel free to contribute by submitting issues or pull requests.