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_matchmaking_configuration Incorrectly Updates When Changing rule_set_name #2099

Open
kurtislamb opened this issue Nov 11, 2024 · 1 comment

Comments

@kurtislamb
Copy link

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

Terraform v1.9.8
on linux_amd64
+ provider registry.terraform.io/hashicorp/archive v2.2.0
+ provider registry.terraform.io/hashicorp/aws v5.30.0
+ provider registry.terraform.io/hashicorp/awscc v1.20.0
+ provider registry.terraform.io/hashicorp/external v2.2.3
+ provider registry.terraform.io/hashicorp/local v2.2.3
+ provider registry.terraform.io/hashicorp/null v3.1.1
+ provider registry.terraform.io/hashicorp/random v3.6.3
+ provider registry.terraform.io/hashicorp/time v0.7.2

Affected Resource(s)

  • awscc_gamelift_matchmaking_configuration

Terraform Configuration Files

locals {
  config_name = "${var.environment}-sandbox-flexmatch-config"
}

resource "awscc_gamelift_matchmaking_configuration" "flexmatch_sandbox" {
  name                    = local.config_name
  description             = "The matchmaker for the Sandbox game mode."
  flex_match_mode         = "STANDALONE"
  acceptance_required     = false
  request_timeout_seconds = var.ticket_timeout_seconds
  rule_set_name           = awscc_gamelift_matchmaking_rule_set.flexmatch_sandbox_2.id ## AWS CC Provider does not allow switching rule sets
  notification_target     = var.sns_arn


  lifecycle {
    replace_triggered_by = [awscc_gamelift_matchmaking_rule_set.flexmatch_sandbox]
  }
}

resource "awscc_gamelift_matchmaking_rule_set" "flexmatch_sandbox" {
  name = local.config_name

  rule_set_body = local.ruleset
}

resource "awscc_gamelift_matchmaking_rule_set" "flexmatch_sandbox_2" {
  name = "${local.config_name}-2"

  rule_set_body = local.ruleset
    }

## Rule Set Body is separate, not attached as it has no baring on the resource, `awscc_gamelift_matchmaking_rule_set` works fine

Debug Output

module.flexmatch_sandbox.awscc_gamelift_matchmaking_configuration.flexmatch_sandbox: Modifying... [id=kurtisl-sandbox-flexmatch-config]
╷
│ Error: AWS SDK Go Service Operation Unsuccessful
│ 
│   with module.flexmatch_sandbox.awscc_gamelift_matchmaking_configuration.flexmatch_sandbox,
│   on modules/flexmatch_sandbox/gamelift.tf line 5, in resource "awscc_gamelift_matchmaking_configuration" "flexmatch_sandbox":5: resource "awscc_gamelift_matchmaking_configuration" "flexmatch_sandbox" {
│ 
│ Calling Cloud Control API service UpdateResource operation returned: operation error CloudControl: UpdateResource, https response error StatusCode: 400, RequestID: 415df5d1-850e-46cf-8340-18f98440c0fc, api error
│ ValidationException: Model validation failed (#/GameSessionQueueArns/0: expected type: String, found: Null)

Expected Behavior

When changing the rule_set_name value in awscc_gamelift_matchmaking_configuration terraform should only change rule_set_name.
This in turn allows us to deploy new awscc_gamelift_matchmaking_rule_set and switch between them. It is worth considering terraform does not allow changing a awscc_gamelift_matchmaking_rule_set while attached to a awscc_gamelift_matchmaking_configuration hence the requirement to change the rule_set_name in awscc_gamelift_matchmaking_configuration

Actual Behavior

Terraform attempts to change a number of values which were not set in the 1st apply such as game_session_queue_arns which result in a validation error from the AWS API Model validation failed (#/GameSessionQueueArns/0: expected type: String, found: Null)

As we are using standalone flexmatch we do not need to use these values, in the debug info you can see other values which are been added despite only the rule_set_name changing from flexmatch_sandbox to flexmatch_sandbox_2

Steps to Reproduce

1.terraform apply
2. change rule_set_name to flexmatch_sandbox_2
3.terraform apply

Important Factoids

  • Everything is pretty standard with nothing unique

References

  • #0000
@wellsiau-aws
Copy link
Collaborator

@kurtislamb , thanks for reporting this issue. I wonder if the diff was caused because Cloud Control API returned a different value for game_session_queue_arns than what was stored in the statefile.

Are you able to re-run the Terraform plan with TF_LOG set to DEBUG ?

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

2 participants