Skip to content

[release/v14] Add support to import machine configs v2 #2049

@github-actions

Description

@github-actions

Backport #1846 to release/v14 for #1847

Copied from PR:

Description

As we can import clusters it would be nice to have the ability to import machine configs v2 too.

Testing

I was able to generate import file of my machine config successfully like this:

❯ cat  import.tf
import {
  to = rancher2_machine_config_v2.nc_test
  id = "fleet-default/nc-test-pool1-zs2g8"
}

❯ terraform plan -generate-config-out=generated.tf
Found existing alias for "terraform plan". You should use: "tfp"
Acquiring state lock. This may take a few moments...
helm_release.rancher: Refreshing state... [id=rancher]
rancher2_machine_config_v2.nc_test: Preparing import... [id=fleet-default/nc-test-pool1-zs2g8]
rancher2_machine_config_v2.nc_test_pool1: Refreshing state... [id=fleet-default/nc-test-pool1-qnqw8]
rancher2_cluster_v2.db-operations-sand: Refreshing state... [id=fleet-default/db-operations-sand]
rancher2_cluster.local: Refreshing state... [id=local]
rancher2_cluster_v2.test: Refreshing state... [id=fleet-default/test]
rancher2_machine_config_v2.nc_test: Refreshing state... [id=fleet-default/nc-test-pool1-zs2g8]

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Warning: Config generation is experimental
│
│ Generating configuration during import is currently experimental, and the generated configuration format may change in future versions.
╵
╷
│ Error: "generate_name": required field is not set
│
│   with rancher2_machine_config_v2.nc_test,
│   on generated.tf line 1:
│   (source code not available)
│
╵

Generated TF file contains generate_name=null which must be corrected manually. That's not the deal-breaker as we see this behaviour during the import of others resources.

Metadata

Metadata

Assignees

Labels

release/v14Targets release v14.x correlating to Rancher's v2.14.x

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions