Skip to content

fix: add support for imported cluster config #1528

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kinarashah
Copy link
Member

@kinarashah kinarashah commented Jun 6, 2025

Issue:

#1523

Problem

Terraform currently does not support setting the ImportedConfig field explicitly. The assumption has been that Rancher creates an imported cluster automatically when no configuration is provided.

However, this assumption no longer holds as a new required field for supporting private registries was introduced for imported clusters. As a result, explicit support for ImportedConfig is now necessary.

Solution

Introduced support for imported_config in rancher2_cluster. As far as I know, imported clusters are not supported with rancher2_cluster2 since these are handled via the v3/clusters endpoint.

The resulting state differs slightly when imported_config is used so added the new state to the expected state list. However, this is consistent with the behavior observed when creating imported clusters directly through the Rancher API. The difference is not significant as the registration URL is correctly generated in both cases and the cluster becomes active after a successful import.

Engineering Testing

Manual testing, created cluster using both old and new format:

resource "rancher2_cluster" "foo" {
  name        = "foo"
}

resource "rancher2_cluster" "bar" {
  name        = "bar"
  imported_config {
    private_registry_url = "test102.io"
  }
}

@kinarashah kinarashah force-pushed the t-1523 branch 2 times, most recently from 81eac13 to ef65932 Compare June 6, 2025 19:01
@kinarashah kinarashah marked this pull request as ready for review June 6, 2025 19:26
@matttrach
Copy link
Collaborator

Please sign your commits with a verified key.

@matttrach matttrach self-assigned this Jun 9, 2025
@matttrach
Copy link
Collaborator

What version of the provider is this targeting?
Is this expected for the v8 release correlating to Rancher's v2.12 or something earlier?

@matttrach
Copy link
Collaborator

matttrach commented Jun 9, 2025

Config is not a valid word for the commit messages, please use "configuration".

@matttrach
Copy link
Collaborator

or just "fix: add support for imported cluster" should be fine

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