Skip to content

Conversation

@davidhrbac
Copy link

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.

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.

1 participant