Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
containerservice - update sdk to 2024-05-01
  • Loading branch information
ms-henglu committed Aug 20, 2024
commit f6f515338cbd921de51c6796e201f8c8bb40a2ac
8 changes: 4 additions & 4 deletions internal/services/containers/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
containerregistry_v2023_06_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-06-01-preview"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerregistry/2023-07-01/cacherules"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2019-08-01/containerservices"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/agentpools"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/maintenanceconfigurations"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/managedclusters"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/snapshots"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-04-01/fleetupdatestrategies"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-04-01/updateruns"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/agentpools"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/maintenanceconfigurations"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/managedclusters"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/snapshots"
"github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/extensions"
"github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration"
"github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager"
Expand Down
2 changes: 1 addition & 1 deletion internal/services/containers/kubernetes_addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/pointer"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/managedclusters"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/managedclusters"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-11-01/applicationgateways"
"github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces"
"github.com/hashicorp/go-azure-sdk/sdk/environments"
Expand Down
49 changes: 7 additions & 42 deletions internal/services/containers/kubernetes_cluster_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-helpers/resourcemanager/zones"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/managedclusters"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/managedclusters"
"github.com/hashicorp/go-azure-sdk/resource-manager/operationalinsights/2020-08-01/workspaces"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
Expand Down Expand Up @@ -868,13 +868,6 @@ func dataSourceKubernetesClusterRead(d *pluginsdk.ResourceData, meta interface{}
return fmt.Errorf("setting `key_management_service`: %+v", err)
}

if !features.FourPointOhBeta() {
customCaTrustCertList := flattenCustomCaTrustCerts(props.SecurityProfile)
if err := d.Set("custom_ca_trust_certificates_base64", customCaTrustCertList); err != nil {
return fmt.Errorf("setting `custom_ca_trust_certificates_base64`: %+v", err)
}
}

serviceMeshProfile := flattenKubernetesClusterAzureServiceMeshProfile(props.ServiceMeshProfile)
if err := d.Set("service_mesh_profile", serviceMeshProfile); err != nil {
return fmt.Errorf("setting `service_mesh_profile`: %+v", err)
Expand Down Expand Up @@ -1033,26 +1026,12 @@ func flattenKubernetesClusterDataSourceStorageProfile(input *managedclusters.Man
snapshotController = *input.SnapshotController.Enabled
}

if !features.FourPointOhBeta() {
diskVersion := ""
if input.DiskCSIDriver != nil && input.DiskCSIDriver.Version != nil {
diskVersion = *input.DiskCSIDriver.Version
}
storageProfile = append(storageProfile, map[string]interface{}{
"blob_driver_enabled": blobEnabled,
"disk_driver_enabled": diskEnabled,
"disk_driver_version": diskVersion,
"file_driver_enabled": fileEnabled,
"snapshot_controller_enabled": snapshotController,
})
} else {
storageProfile = append(storageProfile, map[string]interface{}{
"blob_driver_enabled": blobEnabled,
"disk_driver_enabled": diskEnabled,
"file_driver_enabled": fileEnabled,
"snapshot_controller_enabled": snapshotController,
})
}
storageProfile = append(storageProfile, map[string]interface{}{
"blob_driver_enabled": blobEnabled,
"disk_driver_enabled": diskEnabled,
"file_driver_enabled": fileEnabled,
"snapshot_controller_enabled": snapshotController,
})
}

return storageProfile
Expand Down Expand Up @@ -1582,17 +1561,3 @@ func flattenKubernetesClusterDataSourceUpgradeSettings(input *managedclusters.Ag

return []interface{}{values}
}

func flattenCustomCaTrustCerts(input *managedclusters.ManagedClusterSecurityProfile) []interface{} {
if input == nil || input.CustomCATrustCertificates == nil {
return make([]interface{}, 0)
}

customCaTrustCertInterface := make([]interface{}, len(*input.CustomCATrustCertificates))

for index, value := range *input.CustomCATrustCertificates {
customCaTrustCertInterface[index] = value
}

return customCaTrustCertInterface
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-helpers/resourcemanager/zones"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/agentpools"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/agentpools"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/validate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package containers

import (
"context"
"encoding/base64"
"fmt"
"log"
"regexp"
Expand All @@ -20,9 +19,9 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/zones"
"github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-01/capacityreservationgroups"
"github.com/hashicorp/go-azure-sdk/resource-manager/compute/2022-03-01/proximityplacementgroups"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/agentpools"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/managedclusters"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/snapshots"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/agentpools"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/managedclusters"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/snapshots"
"github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/subnets"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
Expand Down Expand Up @@ -401,37 +400,6 @@ func resourceKubernetesClusterNodePoolSchema() map[string]*pluginsdk.Schema {
},
}

if !features.FourPointOhBeta() {
s["message_of_the_day"] = &pluginsdk.Schema{
Deprecated: "This property is not available in the stable API and will be removed in v4.0 of the Azure Provider. Please see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/4.0-upgrade-guide#aks-migration-to-stable-api for more details.",
Type: pluginsdk.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringIsNotEmpty,
}

s["custom_ca_trust_enabled"] = &pluginsdk.Schema{
Deprecated: "This property is not available in the stable API and will be removed in v4.0 of the Azure Provider. Please see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/4.0-upgrade-guide#aks-migration-to-stable-api for more details.",
Type: pluginsdk.TypeBool,
Optional: true,
}

s["os_sku"].ValidateFunc = validation.StringInSlice([]string{
string(agentpools.OSSKUAzureLinux),
string(agentpools.OSSKUCBLMariner),
string(agentpools.OSSKUMariner),
string(agentpools.OSSKUUbuntu),
string(agentpools.OSSKUWindowsTwoZeroOneNine),
string(agentpools.OSSKUWindowsTwoZeroTwoTwo),
}, false)

s["workload_runtime"].ValidateFunc = validation.StringInSlice([]string{
string(agentpools.WorkloadRuntimeOCIContainer),
string(agentpools.WorkloadRuntimeWasmWasi),
string(agentpools.WorkloadRuntimeKataMshvVMIsolation),
}, false)
}

if !features.FourPointOh() {
s["enable_auto_scaling"] = &pluginsdk.Schema{
Type: pluginsdk.TypeBool,
Expand Down Expand Up @@ -570,10 +538,6 @@ func resourceKubernetesClusterNodePoolCreate(d *pluginsdk.ResourceData, meta int
Count: utils.Int64(int64(count)),
}

if !features.FourPointOhBeta() {
profile.EnableCustomCATrust = pointer.To(d.Get("custom_ca_trust_enabled").(bool))
}

if gpuInstanceProfile := d.Get("gpu_instance").(string); gpuInstanceProfile != "" {
profile.GpuInstanceProfile = pointer.To(agentpools.GPUInstanceProfile(gpuInstanceProfile))
}
Expand Down Expand Up @@ -635,16 +599,6 @@ func resourceKubernetesClusterNodePoolCreate(d *pluginsdk.ResourceData, meta int
profile.NodeTaints = nodeTaints
}

if !features.FourPointOhBeta() {
if v := d.Get("message_of_the_day").(string); v != "" {
if profile.OsType != nil && *profile.OsType == agentpools.OSTypeWindows {
return fmt.Errorf("`message_of_the_day` cannot be specified for Windows nodes and must be a static string (i.e. will be printed raw and not executed as a script)")
}
messageOfTheDayEncoded := base64.StdEncoding.EncodeToString([]byte(v))
profile.MessageOfTheDay = &messageOfTheDayEncoded
}
}

if osDiskSizeGB := d.Get("os_disk_size_gb").(int); osDiskSizeGB > 0 {
profile.OsDiskSizeGB = utils.Int64(int64(osDiskSizeGB))
}
Expand Down Expand Up @@ -822,12 +776,6 @@ func resourceKubernetesClusterNodePoolUpdate(d *pluginsdk.ResourceData, meta int
}
}

if !features.FourPointOhBeta() {
if d.HasChange("custom_ca_trust_enabled") {
props.EnableCustomCATrust = utils.Bool(d.Get("custom_ca_trust_enabled").(bool))
}
}

if d.HasChange("max_count") || enableAutoScaling {
props.MaxCount = utils.Int64(int64(d.Get("max_count").(int)))
}
Expand Down Expand Up @@ -994,10 +942,6 @@ func resourceKubernetesClusterNodePoolRead(d *pluginsdk.ResourceData, meta inter
d.Set("enable_node_public_ip", props.EnableNodePublicIP)
d.Set("enable_host_encryption", props.EnableEncryptionAtHost)
default:
d.Set("custom_ca_trust_enabled", props.EnableCustomCATrust)
d.Set("enable_auto_scaling", props.EnableAutoScaling)
d.Set("enable_node_public_ip", props.EnableNodePublicIP)
d.Set("enable_host_encryption", props.EnableEncryptionAtHost)
}
d.Set("fips_enabled", props.EnableFIPS)
d.Set("ultra_ssd_enabled", props.EnableUltraSSD)
Expand Down Expand Up @@ -1048,18 +992,6 @@ func resourceKubernetesClusterNodePoolRead(d *pluginsdk.ResourceData, meta inter
}
d.Set("max_count", maxCount)

if !features.FourPointOhBeta() {
messageOfTheDay := ""
if props.MessageOfTheDay != nil {
messageOfTheDayDecoded, err := base64.StdEncoding.DecodeString(*props.MessageOfTheDay)
if err != nil {
return fmt.Errorf("setting `message_of_the_day`: %+v", err)
}
messageOfTheDay = string(messageOfTheDayDecoded)
}
d.Set("message_of_the_day", messageOfTheDay)
}

maxPods := 0
if props.MaxPods != nil {
maxPods = int(*props.MaxPods)
Expand Down Expand Up @@ -1167,7 +1099,7 @@ func resourceKubernetesClusterNodePoolDelete(d *pluginsdk.ResourceData, meta int
return err
}

err = client.DeleteThenPoll(ctx, *id, agentpools.DefaultDeleteOperationOptions())
err = client.DeleteThenPoll(ctx, *id)
if err != nil {
return fmt.Errorf("deleting %s: %+v", *id, err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (

"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/agentpools"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/snapshots"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/agentpools"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/snapshots"
"github.com/hashicorp/terraform-plugin-testing/terraform"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"time"

"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/agentpools"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2023-09-02-preview/snapshots"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/agentpools"
"github.com/hashicorp/go-azure-sdk/resource-manager/containerservice/2024-05-01/snapshots"
"github.com/hashicorp/terraform-plugin-testing/terraform"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance"
"github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check"
Expand Down
Loading