This message was deleted.
# terraform-provider-rancher2
a
This message was deleted.
f
Copy code
# Bootstrap rancher
resource "rancher2_bootstrap" "admin" {
  depends_on = [ 
    helm_release.rancher_server 
]
  provider         = rancher2.bootstrap
  initial_password = var.rancher_bootstrap_password
  password = var.rancher_pw
  telemetry = false
  
}

#provider config for admin
provider "rancher2" {
  alias     = "admin"
  api_url   = rancher2_bootstrap.admin.url
  token_key = rancher2_bootstrap.admin.token
  insecure  = true
}

#import the apps cluster after bootstrap
resource "rancher2_cluster" "apps-cluster"{
  depends_on = [ rancher2_bootstrap.admin ]
  provider   = rancher2.admin
  name       = "apps"
}

#execute the curl command on apps-cp-1
resource "null_resource" "add_cluster" {
  depends_on = [ rancher2_cluster.apps-cluster ]
  provisioner "remote-exec" {
    inline = [
      "${rancher2_cluster.apps-cluster.cluster_registration_token.0.insecure_command}",
    ]

    # Connection settings
    connection {
      type        = "ssh"
      user        = "ubuntu"
      password    = "${var.root_password}"
      host        = "${var.apps-cp-ip}"
    }
  }
Found the answer and figured I'd share. I ripped this outta my code so some of the context is missing, but you can get the gist. I can get the cluster_registration_token from the rancher2_cluster resource and execute that on my control plane node of the cluster I'd like to import.