Skip to content

fix: Fix stale append_tolerations when removed from the terraform configuration#2244

Open
skanakal wants to merge 1 commit into
rancher:mainfrom
skanakal:sure-11559
Open

fix: Fix stale append_tolerations when removed from the terraform configuration#2244
skanakal wants to merge 1 commit into
rancher:mainfrom
skanakal:sure-11559

Conversation

@skanakal
Copy link
Copy Markdown
Contributor

@skanakal skanakal commented May 6, 2026

Addresses #2207

Description

The provider currently omits append_tolerations from the rancher api payload when the terraform list becomes empty because the expander gates assignment n len(v) > 0, this prevents rancher from receiving an explicit empty list and causes stale tolerations to persist on the cluster spec.

so removing the length guard and preserves field presence whenever the terraform key exists. This allows the provider to serializes explicit empty slices and enables proper removal for append_tolerations

Testing

  • Add appened_tolerations
  • modify existing tolerations
  • remove tolerations while keeping the other fields like memory
  • remove entire block

Not a breaking change.

@matttrach
Copy link
Copy Markdown
Collaborator

matttrach commented May 6, 2026

What happens if you don't include the append_tolerations in your config with this change? Will it unexpectedly clear them out? Wouldn't that be a breaking change for existing configurations?

@matttrach
Copy link
Copy Markdown
Collaborator

This repo requires commits to be signed by a verified key, please see Github's docs for how to do that.

@skanakal
Copy link
Copy Markdown
Contributor Author

skanakal commented May 7, 2026

What happens if you don't include the append_tolerations in your config with this change? Will it unexpectedly clear them out? Wouldn't that be a breaking change for existing configurations?

Here is the current schema, https://github.com/rancher/terraform-provider-rancher2/blob/main/rancher2/schema_agent_deployment_customization.go#L37-L43

"append_tolerations": {
			Type:        schema.TypeList,
			Description: "User-defined tolerations to append to agent",
			Optional:    true,
			Elem: &schema.Resource{
				Schema: tolerationFields(),
			},
		},

Do you mean even though the current schema suggests they are distinguishable, this relies on terraform behavior rather than explicit state comparison...

@skanakal skanakal changed the title Fix stale append_tolerations when removed from the terraform configuration fix: Fix stale append_tolerations when removed from the terraform configuration May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/v15 Targets release v15.x correlating to Rancher's v2.15.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants