Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

awscc_gamelift_fleet requires two applies to set the Locations property #2206

Open
jarrington-supernatural opened this issue Feb 14, 2025 · 0 comments

Comments

@jarrington-supernatural
Copy link

jarrington-supernatural commented Feb 14, 2025

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.

Terraform CLI and Terraform AWS Cloud Control Provider Version

awscc version 1.27.0

Affected Resource(s)

  • awscc_gamelift_fleet

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_fleet" "test" {
  name              = "Test"
  build_id          = "build-asdf"
  compute_type      = "EC2"
  ec2_instance_type = "c5.large"
  fleet_type        = "ON_DEMAND"

  locations = [
    {
      location = "us-west-2"
      location_capacity = {
        desired_ec2_instances = 1
        min_size              = 1
        max_size              = 2
      }
  }]

  runtime_configuration = {
    game_session_activation_timeout_seconds = 60
    max_concurrent_game_session_activations = 2147483647
    server_processes = [
      {
        concurrent_executions = 1
        launch_path           = "/local/game/run.sh"
        parameters            = "8101"
      }
    ]
  }
}

Expected Behavior

Applying a awscc_gamelift_fleet should set the location capacity on the first apply.

Actual Behavior

The location capacity is not applied until a second apply is made on the resource.

The max_size and min_size are marked as deprecated but it appears the documented behavior is still applied.

From https://registry.terraform.io/providers/hashicorp/awscc/latest/docs/resources/gamelift_fleet

max_size (Number) [DEPRECATED] The maximum value that is allowed for the 
fleet's instance count. When creating a new fleet, GameLift automatically sets 
this value to "1". Once the fleet is active, you can change this value.

The provider should perform a second API call to ensure the locations are applied.

Steps to Reproduce

First apply:

  # awscc_gamelift_fleet.test will be created
  + resource "awscc_gamelift_fleet" "test" {
      + anywhere_configuration             = (known after apply)
      + apply_capacity                     = (known after apply)
      + build_id                           = "build-asdf"
      + certificate_configuration          = (known after apply)
      + compute_type                       = "EC2"
      + description                        = (known after apply)
      + desired_ec2_instances              = (known after apply)
      + ec2_inbound_permissions            = (known after apply)
      + ec2_instance_type                  = "c5.large"
      + fleet_id                           = (known after apply)
      + fleet_type                         = "ON_DEMAND"
      + id                                 = (known after apply)
      + instance_role_arn                  = (known after apply)
      + instance_role_credentials_provider = (known after apply)
      + locations                          = [
          + {
              + location          = "us-west-2"
              + location_capacity = {
                  + desired_ec2_instances = 1
                  + max_size              = 2
                  + min_size              = 1
                }
            },
        ]
      + log_paths                          = (known after apply)
      + max_size                           = (known after apply)
      + metric_groups                      = (known after apply)
      + min_size                           = (known after apply)
      + name                               = "Test"
      + new_game_session_protection_policy = (known after apply)
      + peer_vpc_aws_account_id            = (known after apply)
      + peer_vpc_id                        = (known after apply)
      + resource_creation_limit_policy     = (known after apply)
      + runtime_configuration              = {
          + game_session_activation_timeout_seconds = 60
          + max_concurrent_game_session_activations = 2147483647
          + server_processes                        = [
              + {
                  + concurrent_executions = 1
                  + launch_path           = "/local/game/run.sh"
                  + parameters            = "8101"
                },
            ]
        }
      + scaling_policies                   = (known after apply)
      + script_id                          = (known after apply)
      + server_launch_parameters           = (known after apply)
      + server_launch_path                 = (known after apply)
    }

Not set:

Image

Second apply will actually update the locations correctly:

  ~ resource "awscc_gamelift_fleet" "test" {
      ...
      ~ locations                          = [
          ~ {
              ~ location_capacity = {
                  ~ max_size              = 1 -> 2
                  ~ min_size              = 0 -> 1
                    # (1 unchanged attribute hidden)
                }
                # (1 unchanged attribute hidden)
            },
        ]
      + max_size                           = (known after apply)
      + min_size                           = (known after apply)
      ...
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant