fix: add support for imported cluster config #1528
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
inrancher2_cluster
. As far as I know, imported clusters are not supported withrancher2_cluster2
since these are handled via thev3/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: