awscc_gamelift_matchmaking_rule_set (Resource)

The AWS::GameLift::MatchmakingRuleSet resource creates an Amazon GameLift (GameLift) matchmaking rule set.

Example Usage

IMPORTANT: This is an example FlexMatch rule set. Your actual rule set will need to be modified with context to your game, and the specific configuration you desire. For help designing an Amazon GameLift FlexMatch rule set, see this documentation.

To use awscc_gamelift_matchmaking_rule_set to create a GameLift FlexMatch Matchmaking Rule Set:

resource "awscc_gamelift_matchmaking_rule_set" "example" {
  name = "ExampleRuleSet"
  rule_set_body = jsonencode({
    name                = "ExampleRuleSet",
    ruleLanguageVersion = "1.0",
    playerAttributes = [
      {
        name    = "skill",
        type    = "number",
        default = 10
      }
    ],
    teams = [
      {
        name       = "all",
        minPlayers = 3,
        maxPlayers = 5
      }
    ],
    rules = [
      {
        name        = "FairTeamSkill",
        description = "The average skill of players in each team is within 10 points from the average skill of players in the match",
        type        = "distance",
        // get players for each team, and average separately to produce list of 3
        measurements = ["avg(teams[*].players.attributes[skill])"],
        // get players for each team, flatten into a single list, and average to produce overall average
        referenceValue = "avg(flatten(teams[*].players.attributes[skill]))",
        maxDistance    = 10 // minDistance would achieve the opposite result
      }
    ],
    expansions = [{
      target = "rules[FairTeamSkill].maxDistance",
      steps = [
        {
          waitTimeSeconds = 20,
          value           = 100
        },
        {
          waitTimeSeconds = 30,
          value           = 150
        }
      ]
    }]
  })
}

Schema

Required

Optional

Read-Only

Nested Schema for tags

Required:

Import

Import is supported using the following syntax:

$ terraform import awscc_gamelift_matchmaking_rule_set.example <resource ID>