This project utilizes Terraform to provision an AWS EC2 instance. The EC2 instance is configured with Tailscale via a user data script, allowing it to function as a node within your Tailscale network. The setup supports deployment to specific AWS regions, namely ap-south-2 (Mumbai) and me-central-1 (UAE), with pre-configured key pairs and security groups.
Before deploying this infrastructure, ensure you have the following:
- Terraform CLI: Version
1.5.0or higher. - AWS CLI: Installed and configured with a profile named
home. This profile must have the necessary permissions to create EC2 instances, use AMIs, key pairs, and security groups in the target AWS regions. - AWS EC2 Key Pair:
add as per your needs & conveience- A key pair named
tf-keyexisting in theap-south-2region. - A key pair named
gw-dxbexisting in theme-central-1region.
- A key pair named
- AWS EC2 Security Group: A security group named
launch-wizard-1existing in your AWS account. This security group should be configured to allow inbound SSH (port 22) and any other necessary traffic for your Tailscale setup. - Tailscale Authentication Key: The
tailscale.sh.tpltemplate uses a hardcoded Tailscale authentication key. For production environments, consider securing this key using Terraform variables, environment variables, or a secrets manager.- To obtain a Tailscale authentication key:
- Log in to your Tailscale account at https://login.tailscale.com/admin/settings/authkeys.
- Navigate to the "Auth keys" section.
- Generate a new reusable authentication key.
- Copy the generated key.
- To obtain a Tailscale authentication key:
$ alias tf=terraform
$ tf init
$ export TF_REGION=ap-south-2 # or me-central-1
$ tf <plan|apply|destroy> -var="active_region=$TF_REGION"