Skip to content

sonikro/terraform-aws-teamfortress2-server

Repository files navigation

terraform-aws-teamfortress2-server

Pipeline License: MIT

This module was designed to create an Team Fortress 2 Dedicated Server on AWS EC2s.

It creates the base configuration, but does not add any CFGS/Addons to the server.

The module outputs variables so you can connect to the server later and finish the setup as you desire.

System Requirements

To run this module, the system must have ansible and rsync available in the path.

If you are running this on a CI/CD Pipeline, we recommend using an docker image such as sonikro/terragrunt-ansible:1.2.4-5.8.0

Usage

provider "aws" {
    region = "us-east-1"
}

module "sonikro-tf2-server" {
    source = "sonikro/teamfortress2-server/aws"

    vpc_id            = "vpc_id"
    subnet_id         = "subnet_id"
    server_identifier = "unique_identifier"
    rcon_password     = "default_rcon"
    hostname          = "Test @ Sonikro Solutions"
}

Requirements

Name Version
aws ~> 3.0
http 2.2.0
local 2.2.3
null 3.1.1
tls 3.4.0

Providers

Name Version
aws ~> 3.0
http 2.2.0
local 2.2.3
null 3.1.1
tls 3.4.0

Modules

No modules.

Resources

Name Type
aws_instance.instance resource
aws_key_pair.instance_key resource
aws_security_group.srcds-sg resource
aws_security_group_rule.inbound_server_tcp resource
aws_security_group_rule.inbound_server_udp resource
aws_security_group_rule.inbound_ssh_self resource
aws_security_group_rule.inbound_tv_tcp resource
aws_security_group_rule.inbound_tv_udp resource
aws_security_group_rule.outbound resource
local_sensitive_file.private_key resource
null_resource.ansible_playbook resource
tls_private_key.instance_private_key resource
aws_ami.ubuntu data source
http_http.my_public_ip data source

Inputs

Name Description Type Default Required
associate_public_ip_address If EC2 instance should automatically get an Public IP address bool true no
cpu_credits CPU Credits configuration for EC2 Instance string "unlimited" no
default_map Default map to the server string "cp_process_final" no
default_tags Map of tags to be applied to all resources map(any)
{
"Name": "tf2-server"
}
no
hostname Default hostname for the server (title that shows in Server Browser) string n/a yes
instance_type Size of EC2 instance to be created string "t3.medium" no
max_players Max number of players in the server number 24 no
rcon_password Default RCON Password for the server string n/a yes
region AWS Region to deploy string "us-east-1" no
root_volume_size Size in GBs of the root block number 20 no
server_identifier Unique identifier for this server string n/a yes
server_port SRCDS Server Port number 27015 no
ssh_port Default SSH Port to connect to the box number 22222 no
subnet_id Subnet in which the EC2 instance will be created string n/a yes
tv_port SourceTV Port number 27020 no
vpc_id The VPC where your server will be deployed string n/a yes

Outputs

Name Description
instance_public_ip Public IP address associated with your TF2 Server
private_key_openssh Content of the private key generated for the EC2 Instance, in Openssh format
private_key_path Path where the key file was stored
private_key_pem Content of the private key generated for the EC2 Instance, in PEM Format