aliyun / terraform-provider-alicloud

Terraform AliCloud provider
https://www.terraform.io/docs/providers/alicloud/
Mozilla Public License 2.0
589 stars 554 forks source link

alicloud_cs_managed_kubernetes_clusters: allow specifying SLB type #2602

Open michael-bouvy opened 4 years ago

michael-bouvy commented 4 years ago

When creating a CS Managed Kubernetes Cluster (with slb_internet_enabled to true, which is default value), a SLB of type slb.s1.small is created.

There is no option in the alicloud_cs_managed_kubernetes_clusters resource to specify another SLB instance type. Furthermore, when changing the SLB instance type from the console, terraform wont see any remote change.

Terraform Version

Terraform v0.12.25
+ provider.alicloud v1.78.0

Affected Resource(s)

Terraform Configuration Files

resource "alicloud_cs_managed_kubernetes" "k8s" {
  worker_vswitch_ids = alicloud_vswitch.vswitches.*.id

  worker_instance_types = var.alicloud_kubernetes_worker_instance_types
  worker_number = var.alicloud_kubernetes_worker_number

  node_cidr_mask = 24
  password = XXXXXX
  pod_cidr = var.alicloud_kubernetes_pod_cidr_block
  service_cidr = var.alicloud_kubernetes_service_cidr_block

  version = "1.16.6-aliyun.1"

  worker_disk_category = "cloud_ssd"

  worker_instance_charge_type = var.alicloud_kubernetes_worker_instance_charge_type
  worker_period = var.alicloud_kubernetes_worker_period
  worker_auto_renew = var.alicloud_kubernetes_worker_auto_renew
}
ljluestc commented 2 months ago

resource "alicloud_cs_managed_kubernetes" "k8s" {
  # Reference worker VSwitch IDs from previously defined vswitches
  worker_vswitch_ids = alicloud_vswitch.vswitches.*.id

  # Define the instance types for worker nodes
  worker_instance_types = var.alicloud_kubernetes_worker_instance_types

  # Set the number of worker nodes
  worker_number = var.alicloud_kubernetes_worker_number

  # Specify the CIDR mask for the Kubernetes nodes
  node_cidr_mask = 24

  # Define the login password for the worker nodes (consider storing passwords securely)
  password = var.alicloud_kubernetes_password

  # Pod CIDR block for the Kubernetes cluster
  pod_cidr = var.alicloud_kubernetes_pod_cidr_block

  # Service CIDR block for Kubernetes services
  service_cidr = var.alicloud_kubernetes_service_cidr_block

  # Specify the Kubernetes version (consider updating to a more recent version if required)
  version = "1.16.6-aliyun.1"

  # Specify worker node disk category (cloud SSD)
  worker_disk_category = "cloud_ssd"

  # Instance charge type for worker nodes (e.g., PrePaid, PostPaid)
  worker_instance_charge_type = var.alicloud_kubernetes_worker_instance_charge_type

  # Specify the billing period for worker nodes (in months)
  worker_period = var.alicloud_kubernetes_worker_period

  # Enable auto-renewal for worker nodes
  worker_auto_renew = var.alicloud_kubernetes_worker_auto_renew

  # Optional: Specify tags for your cluster if needed
  tags = {
    Name        = "my-k8s-cluster"
    Environment = "production"
  }
}