https://rancher.com/ logo
#rke2
Title
s

silly-jordan-81965

05/13/2022, 7:45 AM
Im deploying a rancher2_cluster_v2 cluster and want to add cloud provider config. But receives the following error when doing that: on main.tf line 109, in resource “rancher2_cluster_v2” “k8s-sandbox-sc-mr”: │ 109: cloud_provider { │ │ Blocks of type “cloud_provider” are not expected here. My terraform code looks like this:
Copy code
rke_config {
    cloud_provider {
      name = "openstack"
      openstack_cloud_provider {
        global {
          auth_url = var.openstack_auth_url
          username = var.openstack_username
          password = var.openstack_password
          tenant_id = var.openstack_tenant_id
        }
      }
    }
    machine_global_config = <<EOF
Anyone that can point me in the right direction?
I see that this gets added into the yaml when i create a cluster manually:
Copy code
machineSelectorConfig:
      - config:
          cloud-provider-config: |-
            cloud_provider:
                name: openstack
                openstackCloudProvider:
                  global:
                    username: xxxxxxxxxxxxxx
                    password: xxxxxxxxxxxxxx
                    auth-url: <https://1.2.3.4/identity/v3>
                    tenant-id: xxxxxxxxxxxxxx
          cloud-provider-name: external
How and where do i add that in my rke_config in terraform?
l

lemon-midnight-46796

05/16/2022, 11:38 AM
I think you were using
rancher2_cluster
resource documentation instead of
rancher2_cluster_v2
. Once you go to https://registry.terraform.io/providers/rancher/rancher2/latest/docs/resources/cluster_v2 you will see that there is no
cloud_provider
argument, but you need to put your config under
Copy code
machine_selector_config
You will find an example to serve as a reference once you search for
Copy code
machine_selector_config
in that page.
s

silly-jordan-81965

05/18/2022, 6:54 AM
thank you @lemon-midnight-46796!
50 Views