Terraform module to deploy a BeamMP server to AWS
Simple example:
module "beamMP_server" {
source = "Harry-Moore-dev/beamMP-server-module/aws"
version = "1.2.1"
beamMP_auth_key = var.beamMP_auth_key # Should be loaded in as a secret and kept out of source control
}Detailed example:
module "beamMP_server" {
source = "Harry-Moore-dev/beamMP-server-module/aws"
version = "1.2.1"
region = "eu-west-1
ec2_instance_type = "t3.large"
ec2_ebs_volume_size = 8
ec2_spot_instance_price = "0.01"
ec2_spot_instance_enabled = true
beamMP_port = 42069
beamMP_auth_key = var.beamMP_auth_key # Should be loaded in as a secret and kept out of source control
beamMP_map = "italy"
beamMP_server_name = "Yet Another BeamMP Server"
beamMP_server_description = "Yet Another Server Description"
beamMP_max_cars = 2
beamMP_max_players = 10
beamMP_private = false
beamMP_modded = true
beamMP_mod_s3_bucket_path = "examplebucket/mods"
}Create an S3 bucket in your AWS account and load the mod zip files to a path of your choice. When mods are enabled in the server build and the path is provided, all mod files in that path will be copied over to the server on creation so sufficient ebs volume size should be specified depending on the size of the mods loaded.
Install dependencies for pre-commit.
brew install pre-commit terraform-docs tflint tfsec
| Name | Version |
|---|---|
| terraform | >= 1.5.7 |
| aws | ~> 5.33.0 |
| Name | Version |
|---|---|
| aws | 5.33.0 |
| Name | Source | Version |
|---|---|---|
| ec2 | terraform-aws-modules/ec2-instance/aws | 5.6.0 |
| security_group | terraform-aws-modules/security-group/aws | 5.1.0 |
| Name | Type |
|---|---|
| aws_default_vpc.default | resource |
| aws_iam_instance_profile.ssm_instance_profile | resource |
| aws_iam_policy.s3_read_policy | resource |
| aws_iam_role.ssm_role | resource |
| aws_iam_role_policy_attachment.s3_read_policy_attachment | resource |
| aws_iam_role_policy_attachment.ssm_policy_attachment | resource |
| aws_subnet.public_subnet | resource |
| aws_ami.ubuntu | data source |
| aws_availability_zones.available | data source |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| beamMP_auth_key | BeamMP config auth key | string |
n/a | yes |
| beamMP_map | BeamMP config server map selected | string |
"gridmap_v2" |
no |
| beamMP_max_cars | BeamMP config maximum number of cars per allowed person | number |
1 |
no |
| beamMP_max_players | BeamMP config maximum number of players | number |
5 |
no |
| beamMP_mod_s3_bucket_path | S3 bucket name and path containing the zipped mod files (Potential security risk, only specify buckets in your control!) | string |
"" |
no |
| beamMP_modded | BeamMP server enable mods | bool |
false |
no |
| beamMP_port | BeamMP config server port, also used in the security group rules | number |
30814 |
no |
| beamMP_private | BeamMP config set the server to private or not | bool |
true |
no |
| beamMP_server_description | BeamMP config server description | string |
"BeamMP Server created by Terraform" |
no |
| beamMP_server_name | BeamMP config server name | string |
"BeamMP Server created by Terraform" |
no |
| ec2_ebs_volume_size | ec2 ebs volume size | number |
8 |
no |
| ec2_instance_type | ec2 instance type | string |
"t3.small" |
no |
| ec2_spot_instance_enabled | use ec2 spot instances (cheaper but can be terminated at any time) | bool |
false |
no |
| ec2_spot_instance_price | ec2 spot instance price (adjust this for the instance type if using spot instances) | string |
"0.01" |
no |
| region | AWS region | string |
"eu-west-2" |
no |
| vpc_subnet_cidr_block | value of the vpc cidr block for the public subnet | string |
"172.31.0.0/16" |
no |
| Name | Description |
|---|---|
| server_ip | public IP of the EC2 instance used for direct connect |