hashicorp / terraform-provider-awscc

Terraform AWS Cloud Control provider
https://registry.terraform.io/providers/hashicorp/awscc/latest/docs
Mozilla Public License 2.0
241 stars 109 forks source link

awscc_gamelift_game_server_group Updates Correctly But Underlying AutoScalingGroup Does Not Change #1787

Open kurtislamb opened 1 month ago

kurtislamb commented 1 month ago

Community Note

Terraform CLI and Terraform AWS Cloud Control Provider Version

    aws = {
      source  = "hashicorp/aws"
      version = "5.30.0"
    }
    random = {
      source  = "hashicorp/random"
      version = "~> 3.5.1"
    }
    awscc = {
      source  = "hashicorp/awscc"
      version = "~> 1.0.0"
    }
  }
  required_version = "~> 1.6.5"

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "awscc_gamelift_game_server_group" "game_server_group" {
  game_server_group_name        = local.game_server_group_name
  balancing_strategy            = "ON_DEMAND_ONLY"
  delete_option                 = "SAFE_DELETE"
  game_server_protection_policy = "FULL_PROTECTION"
  min_size                      = 1
  max_size                      = 10
  role_arn                      = aws_iam_role.service_group_iam_role.arn
  vpc_subnets                   = module.network.private_subnet_ids

  auto_scaling_policy = {
    estimated_instance_warmup_time = 60
    target_tracking_configuration = {
      target_value = 85
    }
  }

  instance_definitions = [
    {instance_type = "c5.xlarge", weighted_capacity = "1"},
    {instance_type = "c5a.xlarge", weighted_capacity = "1"}
    ]

  launch_template = {
    launch_template_id = "Provide a Launch template"
  }
}

Expected Behavior

When changing values in the resource, these are reflected in the underlying Auto Scaling Group(ASG), I have tested this on Min/Max Server Size and target_tracking_configuration. An Apply triggers an UPDATE to awscc_gamelift_game_server_group

Actual Behavior

When a change occurs in the below values, awscc_gamelift_game_server_group updates correctly but these changes are not passed down to the ASG the awscc_gamelift_game_server_group resource is responsible for managing.

I have observed that changing instance_definitions does result in a change on the ASG

Steps to Reproduce

  1. terraform apply - Deploy an awscc_gamelift_game_server_group resource
  2. terraform apply - Update min_size, max_size or target_tracking_configuration
  3. observe in console - check console to see ASG has not received values from GSG

Important Factoids

References

The below images are were all successful applies which have updated the awscc_gamelift_game_server_group I captured the proposed change before confirming yes

Change 1

image

Change 2

image

Change 1 - Console View After Apply (60 minutes later)

image

Change 2 - Console View After Apply (60 minutes later)

image

wellsiau-aws commented 2 weeks ago

@kurtislamb , thanks for reporting this issue.

I recall similar issues were reported in the past, upon looking at the CloudFormation documentation here, I found the following snippet:

Once the game server group and corresponding Auto Scaling group are created, you have full access to change the Auto Scaling group's configuration as needed. Several properties that are set when creating a game server group, including maximum/minimum size and auto-scaling policy settings, must be updated directly in the Auto Scaling group. Keep in mind that some Auto Scaling group properties are periodically updated by GameLift FleetIQ as part of its balancing activities to optimize for availability and cost.

Appears to me that the behavior that you reported matches the call out in this documentation.

At the moment, I consider this as the expected behavior from the upstream service (GameLift Server Group). I will pass on this issue to the GameLift team for consideration. I also suggest you to reach out to your AWS account team to share your feedback.