Skip to content

Conversation

@yec-akamai
Copy link
Contributor

📝 Description

The filter on tags did not work properly for linode_nodebalancers. The root cause is on the API side. To unblock customer quickly, we use client-side filter as a workaround.

Addressed #1853

✔️ How to Test

Integration test:

make test-int PKG_NAME=nbs

Manual test:

  1. In a sandbox environment, firstly creating some basic nodebalancers for testing, i.e.
resource "linode_nodebalancer" "foobar" {
    count = 2
    label = "test-my-nbs-${count.index}"
    region = "us-east"
    client_conn_throttle = 20
    client_udp_sess_throttle = 10
    tags = count.index == 0 ? ["tf_test_1"] : ["tf_test_1", "tf_test_2"]
}
  1. Use the data source to list and filter on tags
data "linode_nodebalancers" "nbs" {
    filter {
        name   = "tags"
        values = ["tf_test_2"]
    }
}

output "result" {
  value = data.linode_nodebalancers.nbs.nodebalancers
}
  1. Observe the result is correct in the output.
  2. Change around the filters to make sure it works properly.
  3. Destroy the resources.

@yec-akamai yec-akamai requested a review from a team as a code owner November 12, 2025 19:34
@yec-akamai yec-akamai requested review from ezilber-akamai and vshanthe and removed request for a team November 12, 2025 19:34
@yec-akamai yec-akamai added the bugfix for any bug fixes in the changelog. label Nov 12, 2025
Copy link
Contributor

@ezilber-akamai ezilber-akamai left a comment

Choose a reason for hiding this comment

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

Tests passing locally!

@yec-akamai yec-akamai requested a review from Copilot November 13, 2025 21:38
Copy link
Contributor

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 a bug where filtering on tags for nodebalancers data source was not working properly due to an API-side issue. As a workaround, the implementation switches from server-side (API) filtering to client-side filtering for the tags field.

Key changes:

  • Changed the tags filter configuration to use client-side filtering instead of API filtering
  • Added integration test coverage for the tags filter functionality

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
linode/nbs/framework_schema_datasource.go Modified filter configuration to disable API filtering for tags and use client-side filtering instead
linode/nbs/datasource_test.go Added test case to verify tags filtering works correctly
linode/nbs/tmpl/template.go Added helper function to generate test configuration for tags filtering
linode/nbs/tmpl/data_filter_tags.gotf Added template file defining the test configuration for tags filtering

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

data "linode_nodebalancers" "nbs" {
filter {
name = "tags"
values = ["tf_test_2"]
Copy link

Copilot AI Nov 13, 2025

Choose a reason for hiding this comment

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

The hardcoded tag value 'tf_test_2' creates a dependency between the test template and the test setup. Consider parameterizing this value through the TemplateData struct to make the template more flexible and maintainable.

Suggested change
values = ["tf_test_2"]
values = ["{{.Tag}}"]

Copilot uses AI. Check for mistakes.
@yec-akamai yec-akamai merged commit 5b4e716 into dev Nov 13, 2025
12 checks passed
@yec-akamai yec-akamai deleted the TPT-3964/nb-filter-workaround branch November 13, 2025 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix for any bug fixes in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants