Skip to content

Conversation

edersonbrilhante
Copy link
Contributor

@edersonbrilhante edersonbrilhante commented Oct 3, 2025

This PR will replace:

cpu_options {
  core_count       = var.cpu_options != null ? var.cpu_options.core_count : null
  threads_per_core = var.cpu_options != null ? var.cpu_options.threads_per_core : null
}

with:

dynamic "cpu_options" {
  for_each = var.cpu_options != null ? [var.cpu_options] : []
  content {
    core_count       = try(cpu_options.value.core_count, null)
    threads_per_core = try(cpu_options.value.threads_per_core, null)
  }
}

This way, if cpu_options is not set, Terraform will not force a resource update every time.

This issue was introduced in PR #4789

image

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where Terraform would force unnecessary resource updates by replacing a static cpu_options block with a dynamic one that only creates the block when cpu_options is actually set.

  • Replaces static cpu_options block with dynamic block to prevent forced updates
  • Uses conditional for_each to only create the block when var.cpu_options is not null
  • Updates field access to use cpu_options.value syntax within the dynamic block

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@npalm npalm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@npalm npalm merged commit 8a1cd6f into github-aws-runners:main Oct 4, 2025
40 checks passed
npalm pushed a commit that referenced this pull request Oct 4, 2025
🤖 I have created a release *beep* *boop*
---


##
[6.8.1](v6.8.0...v6.8.1)
(2025-10-04)


### Bug Fixes

* prevent unnecessary updates when cpu_options is unset
([#4806](#4806))
([8a1cd6f](8a1cd6f))
@edersonbrilhante

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: runners-releaser[bot] <194412594+runners-releaser[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants