zifeo / terraform-openstack-rke2

Easily deploy a high-availability RKE2 Kubernetes cluster on OpenStack providers like Infomaniak.
https://registry.terraform.io/modules/zifeo/rke2/openstack/latest
Mozilla Public License 2.0
29 stars 16 forks source link

Unsupported argument #3

Closed donydonald1 closed 1 year ago

donydonald1 commented 1 year ago

Hello, Tried using your module but appears to have an issue when attempting to provision a cluster using your module. Below is the full cluster.tf based on the example shown on the repo.

``

  locals {
        auth_url = "https://api.pub1.infomaniak.cloud/identity"
        region   = "dc3-a"
        config   = <<EOF
      # https://docs.rke2.io/install/install_options/install_options/#configuration-file
      # https://docs.rke2.io/install/install_options/server_config/
      node-taint:
        - "CriticalAddonsOnly=true:NoExecute"
      etcd-snapshot-schedule-cron: "* */6 * * *"
      etcd-snapshot-retention: 20
      control-plane-resource-requests: kube-apiserver-cpu=75m,kube-apiserver-memory=128M,kube-scheduler-cpu=75m,kube-scheduler-memory=128M,kube-controller-manager-cpu=75m,kube-controller-manager-memory=128M,kube-proxy-cpu=75m,kube-proxy-memory=128M,etcd-cpu=75m,etcd-memory=128M,cloud-controller-manager-cpu=75m,cloud-controller-manager-memory=128M
        EOF
      }

      provider "openstack" {
        tenant_name = var.tenant_name
        user_name   = var.user_name
        password    = var.password
        auth_url    = local.auth_url
        region      = local.region
      }

      module "rke2" {
        # source = "zifeo/rke2/openstack"
        source = "./.."

        name = "cluster"
        # rke2 manifest autoload (https://docs.rke2.io/helm/)
        manifests_folder = "./manifests"

        floating_pool = "ext-floating1"
        # 22 & 6443 should be restricted to a secure bastion
        rules_ext = [
          { "port" : 22, "protocol" : "tcp", "source" : "0.0.0.0/0" },
          { "port" : 80, "protocol" : "tcp", "source" : "0.0.0.0/0" },
          { "port" : 443, "protocol" : "tcp", "source" : "0.0.0.0/0" },
          { "port" : 6443, "protocol" : "tcp", "source" : "0.0.0.0/0" },
        ]

        server = [{
          name = "server"

          flavor_name      = "a1-ram2-disk0"
          image_name       = "Ubuntu 22.04 LTS Jammy Jellyfish"
          system_user      = "ubuntu"
          boot_volume_size = 4

          rke2_version     = "v1.25.3+rke2r1"
          rke2_volume_size = 6
          # https://docs.rke2.io/install/install_options/install_options/#configuration-file
          rke2_config = local.config
        }]

        agents = [
          {
            name        = "pool-a"
            nodes_count = 1

            flavor_name      = "a1-ram2-disk0"
            image_name       = "Ubuntu 22.04 LTS Jammy Jellyfish"
            system_user      = "ubuntu"
            boot_volume_size = 4

            rke2_version     = "v1.25.3+rke2r1"
            rke2_volume_size = 6
          }
        ]

        # deploy cinder csi
        ff_native_csi = local.auth_url
        # enable automatically `kubectl delete node AGENT-NAME` after an agent change
        ff_autoremove_agent = true
        # rewrite kubeconfig
        ff_write_kubeconfig = true
        # deploy etcd backup
        ff_native_backup = "s3.pub1.infomaniak.cloud"
      }

      output "floating_ip" {
        value = module.rke2.floating_ips[0]
      }

      terraform {
        required_version = ">= 0.14.0"

        required_providers {
          openstack = {
            source  = "terraform-provider-openstack/openstack"
            version = ">= 1.44.0"
          }
        }
      }

``

I get the below errors when terraform apply;

`` │ Error: Unsupported argument │ │ on cluster.tf line 27, in module "rke2": │ 27: name = "cluster" │ │ An argument named "name" is not expected here. ╵ ╷ │ Error: Unsupported argument │ │ on cluster.tf line 29, in module "rke2": │ 29: manifests_folder = "./manifests" │ │ An argument named "manifests_folder" is not expected here. ╵ ╷ │ Error: Unsupported argument │ │ on cluster.tf line 31, in module "rke2": │ 31: floating_pool = "ext-floating1" │ │ An argument named "floating_pool" is not expected here. ╵ ╷ │ Error: Unsupported argument │ │ on cluster.tf line 33, in module "rke2": │ 33: rules_ext = [ │ │ An argument named "rules_ext" is not expected here. ╵ ╷ │ Error: Unsupported argument │ │ on cluster.tf line 40, in module "rke2": │ 40: server = [{ │ │ An argument named "server" is not expected here. ╵ ╷ │ Error: Unsupported argument │ │ on cluster.tf line 54, in module "rke2": │ 54: agents = [ │ │ An argument named "agents" is not expected here. ╵ ╷ │ Error: Unsupported argument │ │ on cluster.tf line 70, in module "rke2": │ 70: ff_native_csi = local.auth_url │ │ An argument named "ff_native_csi" is not expected here. ╵ ╷ │ Error: Unsupported argument │ │ on cluster.tf line 72, in module "rke2": │ 72: ff_autoremove_agent = true │ │ An argument named "ff_autoremove_agent" is not expected here. ╵ ╷ │ Error: Unsupported argument │ │ on cluster.tf line 74, in module "rke2": │ 74: ff_write_kubeconfig = true │ │ An argument named "ff_write_kubeconfig" is not expected here. ╵ ╷ │ Error: Unsupported argument │ │ on cluster.tf line 76, in module "rke2": │ 76: ff_native_backup = "s3.pub1.infomaniak.cloud" │ │ An argument named "ff_native_backup" is not expected here.

``

not sure what exactly i am doing wrong, hopefully you can help.

zifeo commented 1 year ago

@donydonald1 Did you clone the repo and run your command in the example folder? I believe terraform is not finding the "parent" module as required here: source = "./..". Current version is not yet published on terraform registry so you need to clone the whole repo.

zifeo commented 1 year ago

@donydonald1 Did you succeed with your tests? We have released a new version 1.0.3 with better setup. If you need help, please comment here otherwise I close the issue within the next few days.

donydonald1 commented 1 year ago

Oh yes... Thank you