package k8s import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants" "repository.basistech.ru/BASIS/terraform-provider-decort/internal/validators" ) /* Copyright (c) 2019-2023 Digital Energy Cloud Solutions LLC. All Rights Reserved. Authors: Petr Krutov, Stanislav Solovev, Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /* Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud Orchestration Technology) with Terraform by Hashicorp. Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort Please see README.md to learn where to place source code so that it builds seamlessly. Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki */ func dataSourceK8sComputesSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "k8s_id": { Type: schema.TypeInt, Required: true, }, "masters": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { Type: schema.TypeInt, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, }, "group_name": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, }, }, }, "workers": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "id": { Type: schema.TypeInt, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, }, "group_name": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, }, }, }, } } func dataSourceK8sListDeletedSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "by_id": { Type: schema.TypeInt, Optional: true, Description: "Filter by ID", }, "name": { Type: schema.TypeString, Optional: true, Description: "Filter by name", }, "ip_address": { Type: schema.TypeString, Optional: true, Description: "Filter by ipAddress", }, "rg_id": { Type: schema.TypeInt, Optional: true, Description: "Filter by RGID", }, "lb_id": { Type: schema.TypeInt, Optional: true, Description: "Filter by LBID", }, "basic_service_id": { Type: schema.TypeInt, Optional: true, Description: "Filter by BasicServiceID", }, "tech_status": { Type: schema.TypeString, Optional: true, Description: "Filter by Tech Status", }, "sort_by": { Type: schema.TypeString, Optional: true, Description: "sort by one of supported fields, format +|-(field)", }, "page": { Type: schema.TypeInt, Optional: true, Description: "Page number", }, "size": { Type: schema.TypeInt, Optional: true, Description: "Page size", }, "items": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "account_id": { Type: schema.TypeInt, Computed: true, }, "account_name": { Type: schema.TypeString, Computed: true, }, "acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "bservice_id": { Type: schema.TypeInt, Computed: true, }, "k8sci_id": { Type: schema.TypeInt, Computed: true, }, "created_by": { Type: schema.TypeString, Computed: true, }, "created_time": { Type: schema.TypeInt, Computed: true, }, "deleted_by": { Type: schema.TypeString, Computed: true, }, "deleted_time": { Type: schema.TypeInt, Computed: true, }, "desc": { Type: schema.TypeString, Computed: true, }, "extnet_id": { Type: schema.TypeInt, Computed: true, Description: "ID of the external network to connect workers to. If omitted network will be chosen by the platfom.", }, "gid": { Type: schema.TypeInt, Computed: true, }, "guid": { Type: schema.TypeInt, Computed: true, }, "k8s_id": { Type: schema.TypeInt, Computed: true, }, "kubeconfig": { Type: schema.TypeString, Computed: true, Description: "Kubeconfig for cluster access.", }, "lb_id": { Type: schema.TypeInt, Computed: true, }, "milestones": { Type: schema.TypeInt, Computed: true, }, "k8s_name": { Type: schema.TypeString, Computed: true, }, "network_plugin": { Type: schema.TypeString, Computed: true, }, "rg_id": { Type: schema.TypeInt, Computed: true, }, "rg_name": { Type: schema.TypeString, Computed: true, }, "service_account": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "guid": { Type: schema.TypeString, Computed: true, }, "password": { Type: schema.TypeString, Computed: true, }, "username": { Type: schema.TypeString, Computed: true, }, }, }, }, "ssh_key": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "updated_by": { Type: schema.TypeString, Computed: true, }, "updated_time": { Type: schema.TypeInt, Computed: true, }, "vins_id": { Type: schema.TypeInt, Computed: true, }, "workers_groups": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "annotations": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "cpu": { Type: schema.TypeInt, Computed: true, }, "detailed_info": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "external_ip": { Type: schema.TypeString, Computed: true, }, "compute_id": { Type: schema.TypeInt, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "interfaces": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "def_gw": { Type: schema.TypeString, Computed: true, }, "ip_address": { Type: schema.TypeString, Computed: true, }, }, }, }, }, }, }, "disk": { Type: schema.TypeInt, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "id": { Type: schema.TypeInt, Computed: true, }, "labels": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "name": { Type: schema.TypeString, Computed: true, }, "num": { Type: schema.TypeInt, Computed: true, }, "ram": { Type: schema.TypeInt, Computed: true, }, "taints": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, }, }, }, }, }, }, "entry_count": { Type: schema.TypeInt, Computed: true, }, } } func dataSourceK8sListSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "by_id": { Type: schema.TypeInt, Optional: true, Description: "Filter by ID", }, "name": { Type: schema.TypeString, Optional: true, Description: "Filter by name", }, "ip_address": { Type: schema.TypeString, Optional: true, Description: "Filter by ipAddress", }, "rg_id": { Type: schema.TypeInt, Optional: true, Description: "Filter by RGID", }, "lb_id": { Type: schema.TypeInt, Optional: true, Description: "Filter by LBID", }, "basic_service_id": { Type: schema.TypeInt, Optional: true, Description: "Filter by BasicServiceID", }, "status": { Type: schema.TypeString, Optional: true, Description: "Filter by status", }, "tech_status": { Type: schema.TypeString, Optional: true, Description: "Filter by Tech Status", }, "include_deleted": { Type: schema.TypeBool, Optional: true, Default: false, Description: "Include deleted k8s in result", }, "sort_by": { Type: schema.TypeString, Optional: true, Description: "sort by one of supported fields, format +|-(field)", }, "page": { Type: schema.TypeInt, Optional: true, Description: "Page number", }, "size": { Type: schema.TypeInt, Optional: true, Description: "Page size", }, "items": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "account_id": { Type: schema.TypeInt, Computed: true, }, "account_name": { Type: schema.TypeString, Computed: true, }, "acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "bservice_id": { Type: schema.TypeInt, Computed: true, }, "k8sci_id": { Type: schema.TypeInt, Computed: true, }, "created_by": { Type: schema.TypeString, Computed: true, }, "created_time": { Type: schema.TypeInt, Computed: true, }, "deleted_by": { Type: schema.TypeString, Computed: true, }, "deleted_time": { Type: schema.TypeInt, Computed: true, }, "desc": { Type: schema.TypeString, Computed: true, }, "extnet_id": { Type: schema.TypeInt, Computed: true, Description: "ID of the external network to connect workers to. If omitted network will be chosen by the platfom.", }, "gid": { Type: schema.TypeInt, Computed: true, }, "guid": { Type: schema.TypeInt, Computed: true, }, "k8s_id": { Type: schema.TypeInt, Computed: true, }, "kubeconfig": { Type: schema.TypeString, Computed: true, Description: "Kubeconfig for cluster access.", }, "lb_id": { Type: schema.TypeInt, Computed: true, }, "milestones": { Type: schema.TypeInt, Computed: true, }, "k8s_name": { Type: schema.TypeString, Computed: true, }, "network_plugin": { Type: schema.TypeString, Computed: true, }, "rg_id": { Type: schema.TypeInt, Computed: true, }, "rg_name": { Type: schema.TypeString, Computed: true, }, "service_account": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "guid": { Type: schema.TypeString, Computed: true, }, "password": { Type: schema.TypeString, Computed: true, }, "username": { Type: schema.TypeString, Computed: true, }, }, }, }, "ssh_key": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "updated_by": { Type: schema.TypeString, Computed: true, }, "updated_time": { Type: schema.TypeInt, Computed: true, }, "vins_id": { Type: schema.TypeInt, Computed: true, }, "workers_groups": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "annotations": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "guid": { Type: schema.TypeString, Computed: true, }, "id": { Type: schema.TypeInt, Computed: true, }, "labels": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "taints": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, }, }, }, }, }, }, "entry_count": { Type: schema.TypeInt, Computed: true, }, } } func dataSourceK8sWgCloudInitSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "k8s_id": { Type: schema.TypeInt, Required: true, Description: "Kubernetes cluster ID", }, "wg_id": { Type: schema.TypeInt, Required: true, Description: "ID of the workers compute group", }, "cloud_init": { Type: schema.TypeString, Computed: true, Description: "Worker group Cloud init", }, } } func dataSourceK8sWgListSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "k8s_id": { Type: schema.TypeInt, Required: true, }, "items": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "annotations": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "cpu": { Type: schema.TypeInt, Computed: true, }, "detailed_info": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "external_ip": { Type: schema.TypeString, Computed: true, }, "compute_id": { Type: schema.TypeInt, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "interfaces": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "def_gw": { Type: schema.TypeString, Computed: true, }, "ip_address": { Type: schema.TypeString, Computed: true, }, }, }, }, }, }, }, "disk": { Type: schema.TypeInt, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "wg_id": { Type: schema.TypeInt, Computed: true, }, "labels": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "name": { Type: schema.TypeString, Computed: true, }, "num": { Type: schema.TypeInt, Computed: true, }, "ram": { Type: schema.TypeInt, Computed: true, }, "taints": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, }, }, }, } } func dataSourceK8sWgSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "k8s_id": { Type: schema.TypeInt, Required: true, Description: "ID of k8s instance.", }, "wg_id": { Type: schema.TypeInt, Required: true, Description: "ID of k8s worker Group.", }, "name": { Type: schema.TypeString, Computed: true, Description: "Name of the worker group.", }, "num": { Type: schema.TypeInt, Computed: true, Description: "Number of worker nodes to create.", }, "cpu": { Type: schema.TypeInt, Computed: true, Description: "Worker node CPU count.", }, "ram": { Type: schema.TypeInt, Computed: true, Description: "Worker node RAM in MB.", }, "disk": { Type: schema.TypeInt, Computed: true, Description: "Worker node boot disk size. If unspecified or 0, size is defined by OS image size.", }, "detailed_info": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "external_ip": { Type: schema.TypeString, Computed: true, }, "compute_id": { Type: schema.TypeInt, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "interfaces": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "def_gw": { Type: schema.TypeString, Computed: true, }, "ip_address": { Type: schema.TypeString, Computed: true, }, }, }, }, }, }, }, "labels": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "guid": { Type: schema.TypeString, Computed: true, }, "annotations": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "taints": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, } } func dataSourceK8sSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "k8s_id": { Type: schema.TypeInt, Required: true, }, "acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "account_acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "type": { Type: schema.TypeString, Computed: true, }, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, "k8s_acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "type": { Type: schema.TypeString, Computed: true, }, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, "rg_acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "type": { Type: schema.TypeString, Computed: true, }, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, }, }, }, "account_id": { Type: schema.TypeInt, Computed: true, }, "account_name": { Type: schema.TypeString, Computed: true, }, "bservice_id": { Type: schema.TypeInt, Computed: true, }, "k8sci_id": { Type: schema.TypeInt, Computed: true, }, "created_by": { Type: schema.TypeString, Computed: true, }, "created_time": { Type: schema.TypeInt, Computed: true, }, "deleted_by": { Type: schema.TypeString, Computed: true, }, "deleted_time": { Type: schema.TypeInt, Computed: true, }, "desc": { Type: schema.TypeString, Computed: true, }, "extnet_id": { Type: schema.TypeInt, Computed: true, Description: "ID of the external network to connect workers to. If omitted network will be chosen by the platfom.", }, "gid": { Type: schema.TypeInt, Computed: true, }, "guid": { Type: schema.TypeInt, Computed: true, }, "k8s_ci_name": { Type: schema.TypeString, Computed: true, }, "k8s_groups": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "masters": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "cpu": { Type: schema.TypeInt, Computed: true, }, "detailed_info": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "external_ip": { Type: schema.TypeString, Computed: true, }, "compute_id": { Type: schema.TypeInt, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "interfaces": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "def_gw": { Type: schema.TypeString, Computed: true, }, "ip_address": { Type: schema.TypeString, Computed: true, }, }, }, }, }, }, }, "disk": { Type: schema.TypeInt, Computed: true, }, "master_id": { Type: schema.TypeInt, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, }, "num": { Type: schema.TypeInt, Computed: true, }, "ram": { Type: schema.TypeInt, Computed: true, }, }, }, }, "workers": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "annotations": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "cpu": { Type: schema.TypeInt, Computed: true, }, "detailed_info": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "external_ip": { Type: schema.TypeString, Computed: true, }, "compute_id": { Type: schema.TypeInt, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "interfaces": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "def_gw": { Type: schema.TypeString, Computed: true, }, "ip_address": { Type: schema.TypeString, Computed: true, }, }, }, }, }, }, }, "disk": { Type: schema.TypeInt, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "id": { Type: schema.TypeInt, Computed: true, }, "labels": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "name": { Type: schema.TypeString, Computed: true, }, "num": { Type: schema.TypeInt, Computed: true, }, "ram": { Type: schema.TypeInt, Computed: true, }, "taints": { Type: schema.TypeList, Computed: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, }, }, }, }, }, }, "kubeconfig": { Type: schema.TypeString, Computed: true, Description: "Kubeconfig for cluster access.", }, "lb_id": { Type: schema.TypeInt, Computed: true, }, "milestones": { Type: schema.TypeInt, Computed: true, }, "lb_ip": { Type: schema.TypeString, Computed: true, Description: "IP address of default load balancer.", }, "name": { Type: schema.TypeString, Computed: true, }, "network_plugin": { Type: schema.TypeString, Computed: true, }, "rg_id": { Type: schema.TypeInt, Computed: true, }, "rg_name": { Type: schema.TypeString, Computed: true, }, "service_account": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "guid": { Type: schema.TypeString, Computed: true, }, "password": { Type: schema.TypeString, Computed: true, }, "username": { Type: schema.TypeString, Computed: true, }, }, }, }, "ssh_key": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "updated_by": { Type: schema.TypeString, Computed: true, }, "updated_time": { Type: schema.TypeInt, Computed: true, }, "vins_id": { Type: schema.TypeInt, Computed: true, }, } } func resourceK8sCPSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "name": { Type: schema.TypeString, Required: true, Description: "Name of the cluster.", }, "rg_id": { Type: schema.TypeInt, Required: true, Description: "Resource group ID that this instance belongs to.", }, "k8sci_id": { Type: schema.TypeInt, Required: true, Description: "ID of the k8s catalog item to base this instance on.", }, "network_plugin": { Type: schema.TypeString, Required: true, Description: "Network plugin to be used", ValidateFunc: validation.StringInSlice([]string{"flannel", "weavenet", "calico"}, true), }, "num": { Type: schema.TypeInt, Optional: true, Computed: true, ValidateFunc: validation.IntInSlice([]int{1, 3, 5}), Description: "Number of VMs to create. Can be either 1 or 3 or 5", }, "cpu": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "Node CPU count.", }, "ram": { Type: schema.TypeInt, Optional: true, Computed: true, ValidateFunc: validation.All( validation.IntAtLeast(constants.MIN_RAM_PER_COMPUTE), validators.DivisibleBy(constants.RAM_DIVISIBILITY), ), Description: "Node RAM in MB.", }, "disk": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "Node boot disk size in GB.", }, "sep_id": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "Storage Endpoint ID", }, "sep_pool": { Type: schema.TypeString, Optional: true, Computed: true, Description: "Storage Endpoint Pool", }, "with_lb": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Create k8s with load balancer if true.", }, "extnet_only": { Type: schema.TypeBool, Optional: true, Default: false, Description: "Use only selected ExtNet for infrastructure connections", }, "join_config": { Type: schema.TypeString, Optional: true, Description: "is used to configure the behavior and settings for joining a node to a cluster. It includes parameters such as the cluster's control plane endpoint, token, and certificate key. insert a valid JSON string with all levels of nesting.", }, "kube_proxy_config": { Type: schema.TypeString, Optional: true, Description: "is used to configure the behavior and settings of the Kube-proxy, which is responsible for network proxying and load balancing within the cluster. It includes parameters such as proxy mode, cluster IP ranges, and other Kube-proxy specific configurations. insert a valid JSON string with all levels of nesting.", }, "kubelet_config": { Type: schema.TypeString, Optional: true, Description: "is used to configure the behavior and settings of the Kubelet, which is the primary node agent that runs on each node in the cluster. It includes parameters such as node IP address, resource allocation, pod eviction policies, and other Kubelet-specific configurations. insert a valid JSON string with all levels of nesting.", }, "cluster_config": { Type: schema.TypeString, Optional: true, Description: "is used to define global settings and configurations for the entire cluster. It includes parameters such as cluster name, DNS settings, authentication methods, and other cluster-wide configurations. insert a valid JSON string with all levels of nesting.", }, "init_config": { Type: schema.TypeString, Optional: true, Description: "is used to define settings and actions that should be performed before any other component in the cluster starts. It allows you to configure things like node registration, network setup, and other initialization tasks. insert a valid JSON string with all levels of nesting.", }, "additional_sans": { Type: schema.TypeList, Optional: true, Description: "Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names", Elem: &schema.Schema{ Type: schema.TypeString, }, }, "ha_mode": { Type: schema.TypeBool, Optional: true, Description: "Use Highly Available schema for LB deploy", }, "oidc_cert": { Type: schema.TypeString, Optional: true, Description: "insert ssl certificate in x509 pem format", }, "chipset": { Type: schema.TypeString, Optional: true, Description: "Type of the emulated system.", }, "lb_sysctl_params": { Type: schema.TypeList, Optional: true, Description: "Custom sysctl values for Load Balancer instance. Applied on boot.", Elem: &schema.Schema{ Type: schema.TypeMap, Elem: &schema.Schema{ Type: schema.TypeString, }, }, }, "extnet_id": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "ID of the external network to connect workers to. If omitted network will be chosen by the platfom.", }, "vins_id": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "ID of default vins for this instace.", }, "desc": { Type: schema.TypeString, Optional: true, Description: "Text description of this instance.", }, "start": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Start k8s cluster.", }, "enabled": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Enable k8s cluster", }, "permanently": { Type: schema.TypeBool, Optional: true, Default: false, Description: "whether to completely delete the account", }, "restore": { Type: schema.TypeBool, Optional: true, }, "detailed_info": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "compute_id": { Type: schema.TypeInt, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "interfaces": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "def_gw": { Type: schema.TypeString, Computed: true, }, "ip_address": { Type: schema.TypeString, Computed: true, }, }, }, }, }, }, }, "master_id": { Type: schema.TypeInt, Computed: true, Description: "Master group ID.", }, "master_name": { Type: schema.TypeString, Computed: true, Description: "Master group name.", }, "lb_ip": { Type: schema.TypeString, Computed: true, Description: "IP address of default load balancer.", }, "default_wg_id": { Type: schema.TypeInt, Computed: true, Description: "ID of default workers group for this instace.", }, "kubeconfig": { Type: schema.TypeString, Computed: true, Description: "Kubeconfig for cluster access.", }, "k8s_id": { Type: schema.TypeInt, Computed: true, }, "acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "account_acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "type": { Type: schema.TypeString, Computed: true, }, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, "k8s_acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "type": { Type: schema.TypeString, Computed: true, }, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, "rg_acl": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "explicit": { Type: schema.TypeBool, Computed: true, }, "guid": { Type: schema.TypeString, Computed: true, }, "right": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "type": { Type: schema.TypeString, Computed: true, }, "user_group_id": { Type: schema.TypeString, Computed: true, }, }, }, }, }, }, }, "account_id": { Type: schema.TypeInt, Computed: true, }, "account_name": { Type: schema.TypeString, Computed: true, }, "bservice_id": { Type: schema.TypeInt, Computed: true, }, "created_by": { Type: schema.TypeString, Computed: true, }, "created_time": { Type: schema.TypeInt, Computed: true, }, "deleted_by": { Type: schema.TypeString, Computed: true, }, "deleted_time": { Type: schema.TypeInt, Computed: true, }, "gid": { Type: schema.TypeInt, Computed: true, }, "guid": { Type: schema.TypeInt, Computed: true, }, "k8s_ci_name": { Type: schema.TypeString, Computed: true, }, "lb_id": { Type: schema.TypeInt, Computed: true, }, "milestones": { Type: schema.TypeInt, Computed: true, }, "rg_name": { Type: schema.TypeString, Computed: true, }, "ssh_key": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "updated_by": { Type: schema.TypeString, Computed: true, }, "updated_time": { Type: schema.TypeInt, Computed: true, }, } } func resourceK8sWgSchemaMake() map[string]*schema.Schema { return map[string]*schema.Schema{ "k8s_id": { Type: schema.TypeInt, Required: true, Description: "ID of k8s instance.", }, "name": { Type: schema.TypeString, Required: true, Description: "Name of the worker group.", }, "num": { Type: schema.TypeInt, Optional: true, Default: 1, Description: "Number of worker nodes to create.", }, "cpu": { Type: schema.TypeInt, Optional: true, Default: 1, Description: "Worker node CPU count.", }, "ram": { Type: schema.TypeInt, Optional: true, Computed: true, ValidateFunc: validation.All( validation.IntAtLeast(constants.MIN_RAM_PER_COMPUTE), validators.DivisibleBy(constants.RAM_DIVISIBILITY), ), Description: "Node RAM in MB.", }, "chipset": { Type: schema.TypeString, Optional: true, Description: "Type of the emulated system.", }, "disk": { Type: schema.TypeInt, Optional: true, Computed: true, Description: "Worker node boot disk size. If unspecified or 0, size is defined by OS image size.", }, "labels": { Type: schema.TypeList, Computed: true, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "annotations": { Type: schema.TypeList, Computed: true, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "taints": { Type: schema.TypeList, Computed: true, Optional: true, Elem: &schema.Schema{ Type: schema.TypeString, }, }, "worker_sep_id": { Type: schema.TypeInt, Optional: true, }, "worker_sep_pool": { Type: schema.TypeString, Optional: true, }, "cloud_init": { Type: schema.TypeString, Optional: true, DiffSuppressFunc: cloudInitDiffSupperss, }, "wg_id": { Type: schema.TypeInt, Computed: true, Description: "ID of k8s worker Group.", }, "detailed_info": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "compute_id": { Type: schema.TypeInt, Computed: true, }, "name": { Type: schema.TypeString, Computed: true, }, "status": { Type: schema.TypeString, Computed: true, }, "tech_status": { Type: schema.TypeString, Computed: true, }, "interfaces": { Type: schema.TypeList, Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "def_gw": { Type: schema.TypeString, Computed: true, }, "ip_address": { Type: schema.TypeString, Computed: true, }, }, }, }, }, }, }, "guid": { Type: schema.TypeString, Computed: true, }, } }