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 1 commit 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 3 times, most recently from ef65932 to 94f84d7 Compare June 6, 2025 19:08
@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

@kinarashah
Copy link
Member Author

@matttrach Thanks for the review, pushed an updated commit message with verified key. The field was first introduced with Rancher v2.11, so it's not scoped to v2.12+ only and I'd like to backport it to v7 release line if possible.

@matttrach
Copy link
Collaborator

@kinarashah your commit wasn't signed with a verified key yet:
You can see in the link below that your commit is missing the "verified" badge.
https://github.com/rancher/terraform-provider-rancher2/pull/1528/commits

@matttrach
Copy link
Collaborator

This needs one more approval before merge, maybe @HarrisonWAffel ?

@matttrach
Copy link
Collaborator

main issue: #1523

Copy link
Collaborator

@HarrisonWAffel HarrisonWAffel left a comment

Choose a reason for hiding this comment

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

Core changes look good, but I think we need to update the docs with this new field

@kinarashah kinarashah force-pushed the t-1523 branch 2 times, most recently from aff2c73 to 7edc821 Compare June 11, 2025 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants