diff --git a/scaleway/resource_k8s_cluster_beta.go b/scaleway/resource_k8s_cluster_beta.go index d0cb2bda0..c94d2d365 100644 --- a/scaleway/resource_k8s_cluster_beta.go +++ b/scaleway/resource_k8s_cluster_beta.go @@ -120,6 +120,22 @@ func resourceScalewayK8SClusterBeta() *schema.Resource { }, }, }, + "feature_gates": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + Description: "The list of feature gates to enable on the cluster", + }, + "admission_plugins": { + Type: schema.TypeList, + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + Optional: true, + Description: "The list of admission plugins to enable on the cluster", + }, "default_pool": { Type: schema.TypeList, MaxItems: 1, @@ -292,13 +308,15 @@ func resourceScalewayK8SClusterBetaCreate(d *schema.ResourceData, m interface{}) } req := &k8s.CreateClusterRequest{ - Region: region, - OrganizationID: d.Get("organization_id").(string), - Name: expandOrGenerateString(d.Get("name"), "cluster"), - Description: description.(string), - Version: version.(string), - Cni: k8s.CNI(d.Get("cni").(string)), - Tags: expandStrings(d.Get("tags")), + Region: region, + OrganizationID: d.Get("organization_id").(string), + Name: expandOrGenerateString(d.Get("name"), "cluster"), + Description: description.(string), + Version: version.(string), + Cni: k8s.CNI(d.Get("cni").(string)), + Tags: expandStrings(d.Get("tags")), + FeatureGates: expandStrings(d.Get("feature_gates")), + AdmissionPlugins: expandStrings(d.Get("admission_plugins")), } if dashboard, ok := d.GetOk("enable_dashboard"); ok { @@ -680,6 +698,14 @@ func resourceScalewayK8SClusterBetaUpdate(d *schema.ResourceData, m interface{}) updateRequest.Tags = scw.StringsPtr(tags) } + if d.HasChange("feature_gates") { + updateRequest.FeatureGates = scw.StringsPtr(expandStrings(d.Get("feature_gates"))) + } + + if d.HasChange("admission_plugins") { + updateRequest.AdmissionPlugins = scw.StringsPtr(expandStrings(d.Get("admission_plugins"))) + } + if d.HasChange("version") { versions, err := k8sAPI.ListClusterAvailableVersions(&k8s.ListClusterAvailableVersionsRequest{ Region: region, diff --git a/website/docs/r/k8s_cluster_beta.html.markdown b/website/docs/r/k8s_cluster_beta.html.markdown index 4b675ef9d..f4a5876b4 100644 --- a/website/docs/r/k8s_cluster_beta.html.markdown +++ b/website/docs/r/k8s_cluster_beta.html.markdown @@ -125,6 +125,10 @@ The following arguments are supported: - `maintenance_window_day` - (Optional) The day of the auto upgrade maintenance window (`monday` to `sunday`, or `any`). +- `feature_gates` - (Optional) The list of [feature gates](https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/) to enable on the cluster. + +- `admission_controllers` - (Optional) The list of [admission plugins](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/) to enable on the cluster. + - `default_pool` - (Required) The cluster's default pool configuration. - `node_type` - (Required) The commercial type of the default pool instances.