From d972526c0f250a9274de63173152eb8cad1a99ab Mon Sep 17 00:00:00 2001 From: jayctran Date: Tue, 18 Jun 2024 19:33:12 +1000 Subject: [PATCH 01/18] bump vendor fluxConfiguration api version --- .../model_kustomizationdefinition.go | 15 -- .../model_kustomizationpatchdefinition.go | 14 -- .../fluxconfiguration/README.md | 6 +- .../fluxconfiguration/client.go | 0 .../fluxconfiguration/constants.go | 0 .../id_scopedfluxconfiguration.go | 0 .../id_scopedfluxconfiguration_test.go | 222 ++++++++++++++++++ .../method_createorupdate.go | 0 .../fluxconfiguration/method_delete.go | 0 .../fluxconfiguration/method_get.go | 0 .../fluxconfiguration/method_list.go | 0 .../fluxconfiguration/method_update.go | 0 .../model_azureblobdefinition.go | 0 .../model_azureblobpatchdefinition.go | 0 .../model_bucketdefinition.go | 0 .../model_bucketpatchdefinition.go | 0 .../model_fluxconfiguration.go | 0 .../model_fluxconfigurationpatch.go | 0 .../model_fluxconfigurationpatchproperties.go | 0 .../model_fluxconfigurationproperties.go | 2 + .../model_gitrepositorydefinition.go | 0 .../model_gitrepositorypatchdefinition.go | 0 .../model_helmreleasepropertiesdefinition.go | 0 .../model_kustomizationdefinition.go | 17 ++ .../model_kustomizationpatchdefinition.go | 16 ++ .../model_managedidentitydefinition.go | 0 .../model_managedidentitypatchdefinition.go | 0 .../model_objectreferencedefinition.go | 0 .../model_objectstatusconditiondefinition.go | 0 .../model_objectstatusdefinition.go | 0 .../model_postbuilddefinition.go | 9 + .../model_repositoryrefdefinition.go | 0 .../model_serviceprincipaldefinition.go | 0 .../model_serviceprincipalpatchdefinition.go | 0 .../model_substitutefromdefinition.go | 10 + .../fluxconfiguration/predicates.go | 0 .../fluxconfiguration/version.go | 2 +- vendor/modules.txt | 2 +- 38 files changed, 281 insertions(+), 34 deletions(-) delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_kustomizationdefinition.go delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_kustomizationpatchdefinition.go rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/README.md (93%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/client.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/constants.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/id_scopedfluxconfiguration.go (100%) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration_test.go rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/method_createorupdate.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/method_delete.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/method_get.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/method_list.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/method_update.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_azureblobdefinition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_azureblobpatchdefinition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_bucketdefinition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_bucketpatchdefinition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_fluxconfiguration.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_fluxconfigurationpatch.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_fluxconfigurationpatchproperties.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_fluxconfigurationproperties.go (92%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_gitrepositorydefinition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_gitrepositorypatchdefinition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_helmreleasepropertiesdefinition.go (100%) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_kustomizationdefinition.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_kustomizationpatchdefinition.go rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_managedidentitydefinition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_managedidentitypatchdefinition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_objectreferencedefinition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_objectstatusconditiondefinition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_objectstatusdefinition.go (100%) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_postbuilddefinition.go rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_repositoryrefdefinition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_serviceprincipaldefinition.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/model_serviceprincipalpatchdefinition.go (100%) create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_substitutefromdefinition.go rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/predicates.go (100%) rename vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/{2022-11-01 => 2023-05-01}/fluxconfiguration/version.go (87%) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_kustomizationdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_kustomizationdefinition.go deleted file mode 100644 index f290effccf3a..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_kustomizationdefinition.go +++ /dev/null @@ -1,15 +0,0 @@ -package fluxconfiguration - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type KustomizationDefinition struct { - DependsOn *[]string `json:"dependsOn,omitempty"` - Force *bool `json:"force,omitempty"` - Name *string `json:"name,omitempty"` - Path *string `json:"path,omitempty"` - Prune *bool `json:"prune,omitempty"` - RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` - SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` - TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_kustomizationpatchdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_kustomizationpatchdefinition.go deleted file mode 100644 index 988a0b73b931..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_kustomizationpatchdefinition.go +++ /dev/null @@ -1,14 +0,0 @@ -package fluxconfiguration - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type KustomizationPatchDefinition struct { - DependsOn *[]string `json:"dependsOn,omitempty"` - Force *bool `json:"force,omitempty"` - Path *string `json:"path,omitempty"` - Prune *bool `json:"prune,omitempty"` - RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` - SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` - TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/README.md similarity index 93% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/README.md index 9c645d7efd89..ca3e11b12d5b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/README.md @@ -1,7 +1,7 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration` Documentation -The `fluxconfiguration` SDK allows for interaction with Azure Resource Manager `kubernetesconfiguration` (API Version `2022-11-01`). +The `fluxconfiguration` SDK allows for interaction with Azure Resource Manager`kubernetesconfiguration` (API Version `2023-05-01`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). @@ -9,7 +9,7 @@ This readme covers example usages, but further information on [using this SDK ca ```go import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -import "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration" +import "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/constants.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/constants.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/id_scopedfluxconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/id_scopedfluxconfiguration.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration_test.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration_test.go new file mode 100644 index 000000000000..3e7d649562e3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration_test.go @@ -0,0 +1,222 @@ +package fluxconfiguration + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = &ScopedFluxConfigurationId{} + +func TestNewScopedFluxConfigurationID(t *testing.T) { + id := NewScopedFluxConfigurationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "fluxConfigurationValue") + + if id.Scope != "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group" { + t.Fatalf("Expected %q but got %q for Segment 'Scope'", id.Scope, "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + } + + if id.FluxConfigurationName != "fluxConfigurationValue" { + t.Fatalf("Expected %q but got %q for Segment 'FluxConfigurationName'", id.FluxConfigurationName, "fluxConfigurationValue") + } +} + +func TestFormatScopedFluxConfigurationID(t *testing.T) { + actual := NewScopedFluxConfigurationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "fluxConfigurationValue").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/fluxConfigurationValue" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseScopedFluxConfigurationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ScopedFluxConfigurationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/fluxConfigurationValue", + Expected: &ScopedFluxConfigurationId{ + Scope: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", + FluxConfigurationName: "fluxConfigurationValue", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/fluxConfigurationValue/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseScopedFluxConfigurationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.Scope != v.Expected.Scope { + t.Fatalf("Expected %q but got %q for Scope", v.Expected.Scope, actual.Scope) + } + + if actual.FluxConfigurationName != v.Expected.FluxConfigurationName { + t.Fatalf("Expected %q but got %q for FluxConfigurationName", v.Expected.FluxConfigurationName, actual.FluxConfigurationName) + } + + } +} + +func TestParseScopedFluxConfigurationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ScopedFluxConfigurationId + }{ + { + // Incomplete URI + Input: "", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs/mIcRoSoFt.kUbErNeTeScOnFiGuRaTiOn", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs/mIcRoSoFt.kUbErNeTeScOnFiGuRaTiOn/fLuXcOnFiGuRaTiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/fluxConfigurationValue", + Expected: &ScopedFluxConfigurationId{ + Scope: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", + FluxConfigurationName: "fluxConfigurationValue", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/fluxConfigurationValue/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs/mIcRoSoFt.kUbErNeTeScOnFiGuRaTiOn/fLuXcOnFiGuRaTiOnS/fLuXcOnFiGuRaTiOnVaLuE", + Expected: &ScopedFluxConfigurationId{ + Scope: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp", + FluxConfigurationName: "fLuXcOnFiGuRaTiOnVaLuE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs/mIcRoSoFt.kUbErNeTeScOnFiGuRaTiOn/fLuXcOnFiGuRaTiOnS/fLuXcOnFiGuRaTiOnVaLuE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseScopedFluxConfigurationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.Scope != v.Expected.Scope { + t.Fatalf("Expected %q but got %q for Scope", v.Expected.Scope, actual.Scope) + } + + if actual.FluxConfigurationName != v.Expected.FluxConfigurationName { + t.Fatalf("Expected %q but got %q for FluxConfigurationName", v.Expected.FluxConfigurationName, actual.FluxConfigurationName) + } + + } +} + +func TestSegmentsForScopedFluxConfigurationId(t *testing.T) { + segments := ScopedFluxConfigurationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ScopedFluxConfigurationId has no segments") + } + + uniqueNames := make(map[string]struct{}, 0) + for _, segment := range segments { + uniqueNames[segment.Name] = struct{}{} + } + if len(uniqueNames) != len(segments) { + t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/method_createorupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/method_createorupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/method_createorupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/method_delete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/method_get.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/method_list.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/method_list.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/method_list.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/method_update.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/method_update.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/method_update.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_azureblobdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_azureblobdefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_azureblobdefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_azureblobdefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_azureblobpatchdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_azureblobpatchdefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_azureblobpatchdefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_azureblobpatchdefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_bucketdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_bucketdefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_bucketdefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_bucketdefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_bucketpatchdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_bucketpatchdefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_bucketpatchdefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_bucketpatchdefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_fluxconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_fluxconfiguration.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_fluxconfiguration.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_fluxconfiguration.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_fluxconfigurationpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_fluxconfigurationpatch.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_fluxconfigurationpatch.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_fluxconfigurationpatch.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_fluxconfigurationpatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_fluxconfigurationpatchproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_fluxconfigurationpatchproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_fluxconfigurationpatchproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_fluxconfigurationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_fluxconfigurationproperties.go similarity index 92% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_fluxconfigurationproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_fluxconfigurationproperties.go index ca4d4b334dd9..1ddb605cb296 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_fluxconfigurationproperties.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_fluxconfigurationproperties.go @@ -19,6 +19,7 @@ type FluxConfigurationProperties struct { Kustomizations *map[string]KustomizationDefinition `json:"kustomizations,omitempty"` Namespace *string `json:"namespace,omitempty"` ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ReconciliationWaitDuration *string `json:"reconciliationWaitDuration,omitempty"` RepositoryPublicKey *string `json:"repositoryPublicKey,omitempty"` Scope *ScopeType `json:"scope,omitempty"` SourceKind *SourceKindType `json:"sourceKind,omitempty"` @@ -27,6 +28,7 @@ type FluxConfigurationProperties struct { StatusUpdatedAt *string `json:"statusUpdatedAt,omitempty"` Statuses *[]ObjectStatusDefinition `json:"statuses,omitempty"` Suspend *bool `json:"suspend,omitempty"` + WaitForReconciliation *bool `json:"waitForReconciliation,omitempty"` } func (o *FluxConfigurationProperties) GetSourceUpdatedAtAsTime() (*time.Time, error) { diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_gitrepositorydefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_gitrepositorydefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_gitrepositorydefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_gitrepositorydefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_gitrepositorypatchdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_gitrepositorypatchdefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_gitrepositorypatchdefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_gitrepositorypatchdefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_helmreleasepropertiesdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_helmreleasepropertiesdefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_helmreleasepropertiesdefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_helmreleasepropertiesdefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_kustomizationdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_kustomizationdefinition.go new file mode 100644 index 000000000000..1797c7dae5d3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_kustomizationdefinition.go @@ -0,0 +1,17 @@ +package fluxconfiguration + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KustomizationDefinition struct { + DependsOn *[]string `json:"dependsOn,omitempty"` + Force *bool `json:"force,omitempty"` + Name *string `json:"name,omitempty"` + Path *string `json:"path,omitempty"` + PostBuild *PostBuildDefinition `json:"postBuild,omitempty"` + Prune *bool `json:"prune,omitempty"` + RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + Wait *bool `json:"wait,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_kustomizationpatchdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_kustomizationpatchdefinition.go new file mode 100644 index 000000000000..ff7f9e541b2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_kustomizationpatchdefinition.go @@ -0,0 +1,16 @@ +package fluxconfiguration + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KustomizationPatchDefinition struct { + DependsOn *[]string `json:"dependsOn,omitempty"` + Force *bool `json:"force,omitempty"` + Path *string `json:"path,omitempty"` + PostBuild *PostBuildDefinition `json:"postBuild,omitempty"` + Prune *bool `json:"prune,omitempty"` + RetryIntervalInSeconds *int64 `json:"retryIntervalInSeconds,omitempty"` + SyncIntervalInSeconds *int64 `json:"syncIntervalInSeconds,omitempty"` + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + Wait *bool `json:"wait,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_managedidentitydefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_managedidentitydefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_managedidentitydefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_managedidentitydefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_managedidentitypatchdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_managedidentitypatchdefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_managedidentitypatchdefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_managedidentitypatchdefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_objectreferencedefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_objectreferencedefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_objectreferencedefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_objectreferencedefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_objectstatusconditiondefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_objectstatusconditiondefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_objectstatusconditiondefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_objectstatusconditiondefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_objectstatusdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_objectstatusdefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_objectstatusdefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_objectstatusdefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_postbuilddefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_postbuilddefinition.go new file mode 100644 index 000000000000..85b45889c26e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_postbuilddefinition.go @@ -0,0 +1,9 @@ +package fluxconfiguration + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PostBuildDefinition struct { + Substitute *map[string]string `json:"substitute,omitempty"` + SubstituteFrom *[]SubstituteFromDefinition `json:"substituteFrom,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_repositoryrefdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_repositoryrefdefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_repositoryrefdefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_repositoryrefdefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_serviceprincipaldefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_serviceprincipaldefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_serviceprincipaldefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_serviceprincipaldefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_serviceprincipalpatchdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_serviceprincipalpatchdefinition.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/model_serviceprincipalpatchdefinition.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_serviceprincipalpatchdefinition.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_substitutefromdefinition.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_substitutefromdefinition.go new file mode 100644 index 000000000000..3ce02779a40f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/model_substitutefromdefinition.go @@ -0,0 +1,10 @@ +package fluxconfiguration + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubstituteFromDefinition struct { + Kind *string `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` + Optional *bool `json:"optional,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/version.go similarity index 87% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/version.go index ca0e7395f358..f48af596ded1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/version.go @@ -3,7 +3,7 @@ package fluxconfiguration // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2022-11-01" +const defaultApiVersion = "2023-05-01" func userAgent() string { return "hashicorp/go-azure-sdk/fluxconfiguration/2022-11-01" diff --git a/vendor/modules.txt b/vendor/modules.txt index 8b8b6cea4f66..451d74bcc446 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -611,7 +611,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/keyvault/2023-02-01/vaults github.com/hashicorp/go-azure-sdk/resource-manager/keyvault/2023-07-01/managedhsms github.com/hashicorp/go-azure-sdk/resource-manager/keyvault/2023-07-01/vaults 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/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/attacheddatabaseconfigurations github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusterprincipalassignments github.com/hashicorp/go-azure-sdk/resource-manager/kusto/2023-08-15/clusters From 3fb37bf9dfe299d44e915e002e816ba03171de5f Mon Sep 17 00:00:00 2001 From: jayctran Date: Tue, 18 Jun 2024 19:33:12 +1000 Subject: [PATCH 02/18] added postBuild and Wait attributes included as part of 2023-05-01 api changes --- ..._kubernetes_flux_configuration_resource.go | 2 +- ...rnetes_flux_configuration_resource_test.go | 2 +- .../services/arckubernetes/client/client.go | 2 +- internal/services/containers/client/client.go | 2 +- .../kubernetes_flux_configuration_resource.go | 162 ++++++++++++++++-- ...rnetes_flux_configuration_resource_test.go | 56 +++++- 6 files changed, 203 insertions(+), 23 deletions(-) diff --git a/internal/services/arckubernetes/arc_kubernetes_flux_configuration_resource.go b/internal/services/arckubernetes/arc_kubernetes_flux_configuration_resource.go index 3c7328bf9032..4c6aca95f6f5 100644 --- a/internal/services/arckubernetes/arc_kubernetes_flux_configuration_resource.go +++ b/internal/services/arckubernetes/arc_kubernetes_flux_configuration_resource.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" arckubernetes "github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2024-01-01/connectedclusters" - "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration" + "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" diff --git a/internal/services/arckubernetes/arc_kubernetes_flux_configuration_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_flux_configuration_resource_test.go index ac861680836d..7db4da1a79c6 100644 --- a/internal/services/arckubernetes/arc_kubernetes_flux_configuration_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_flux_configuration_resource_test.go @@ -12,7 +12,7 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration" + "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" diff --git a/internal/services/arckubernetes/client/client.go b/internal/services/arckubernetes/client/client.go index e9609c976da1..d57df1f8562e 100644 --- a/internal/services/arckubernetes/client/client.go +++ b/internal/services/arckubernetes/client/client.go @@ -8,7 +8,7 @@ import ( "github.com/hashicorp/go-azure-sdk/resource-manager/hybridkubernetes/2024-01-01/connectedclusters" "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/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) diff --git a/internal/services/containers/client/client.go b/internal/services/containers/client/client.go index 764c6a84ab9d..e24090f037a0 100644 --- a/internal/services/containers/client/client.go +++ b/internal/services/containers/client/client.go @@ -18,7 +18,7 @@ import ( "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/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration" "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" "github.com/hashicorp/go-azure-sdk/sdk/environments" "github.com/hashicorp/terraform-provider-azurerm/internal/common" diff --git a/internal/services/containers/kubernetes_flux_configuration_resource.go b/internal/services/containers/kubernetes_flux_configuration_resource.go index 1badab9cf242..502baa8ad223 100644 --- a/internal/services/containers/kubernetes_flux_configuration_resource.go +++ b/internal/services/containers/kubernetes_flux_configuration_resource.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration" + "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/containers/validate" storageValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/validate" @@ -31,15 +31,16 @@ const ( ) type KubernetesFluxConfigurationModel struct { - Name string `tfschema:"name"` - ClusterID string `tfschema:"cluster_id"` - BlobStorage []AzureBlobDefinitionModel `tfschema:"blob_storage"` - Bucket []BucketDefinitionModel `tfschema:"bucket"` - GitRepository []GitRepositoryDefinitionModel `tfschema:"git_repository"` - Kustomizations []KustomizationDefinitionModel `tfschema:"kustomizations"` - Namespace string `tfschema:"namespace"` - Scope string `tfschema:"scope"` - ContinuousReconciliationEnabled bool `tfschema:"continuous_reconciliation_enabled"` + Name string `tfschema:"name"` + ClusterID string `tfschema:"cluster_id"` + BlobStorage []AzureBlobDefinitionModel `tfschema:"blob_storage"` + Bucket []BucketDefinitionModel `tfschema:"bucket"` + GitRepository []GitRepositoryDefinitionModel `tfschema:"git_repository"` + Kustomizations []KustomizationDefinitionModel `tfschema:"kustomizations"` + Namespace string `tfschema:"namespace"` + + Scope string `tfschema:"scope"` + ContinuousReconciliationEnabled bool `tfschema:"continuous_reconciliation_enabled"` } type AzureBlobDefinitionModel struct { @@ -88,14 +89,27 @@ type GitRepositoryDefinitionModel struct { } type KustomizationDefinitionModel struct { - Name string `tfschema:"name"` - Path string `tfschema:"path"` - TimeoutInSeconds int64 `tfschema:"timeout_in_seconds"` - SyncIntervalInSeconds int64 `tfschema:"sync_interval_in_seconds"` - RetryIntervalInSeconds int64 `tfschema:"retry_interval_in_seconds"` - Force bool `tfschema:"recreating_enabled"` - Prune bool `tfschema:"garbage_collection_enabled"` - DependsOn []string `tfschema:"depends_on"` + Name string `tfschema:"name"` + Path string `tfschema:"path"` + TimeoutInSeconds int64 `tfschema:"timeout_in_seconds"` + SyncIntervalInSeconds int64 `tfschema:"sync_interval_in_seconds"` + RetryIntervalInSeconds int64 `tfschema:"retry_interval_in_seconds"` + Force bool `tfschema:"recreating_enabled"` + Prune bool `tfschema:"garbage_collection_enabled"` + DependsOn []string `tfschema:"depends_on"` + PostBuild []PostBuildDefinitionModel `tfschema:"post_build"` + Wait bool `tfschema:"wait"` +} + +type PostBuildDefinitionModel struct { + Substitute map[string]string `tfschema:"substitute"` + SubstituteFrom []SubstituteFromDefinitionModel `tfschema:"substitute_from"` +} + +type SubstituteFromDefinitionModel struct { + Kind string `tfschema:"kind"` + Name string `tfschema:"name"` + Optional bool `tfschema:"optional"` } type ManagedIdentityDefinitionModel struct { @@ -218,6 +232,46 @@ func (r KubernetesFluxConfigurationResource) Arguments() map[string]*pluginsdk.S Type: pluginsdk.TypeString, }, }, + + "post_build": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "substitute": { + Type: pluginsdk.TypeMap, + Optional: true, + Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + }, + "substitute_from": { + Type: pluginsdk.TypeList, + Optional: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "kind": { + Type: pluginsdk.TypeString, + Required: true, + }, + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + "optional": { + Type: pluginsdk.TypeBool, + Optional: true, + }, + }, + }, + }, + }, + }, + }, + "wait": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, }, }, }, @@ -841,10 +895,12 @@ func expandKustomizationDefinitionModel(inputList []KustomizationDefinitionModel DependsOn: &input.DependsOn, Force: &input.Force, Name: &input.Name, + PostBuild: expandPostBuildDefinitionModel(input.PostBuild), Prune: &input.Prune, RetryIntervalInSeconds: &input.RetryIntervalInSeconds, SyncIntervalInSeconds: &input.SyncIntervalInSeconds, TimeoutInSeconds: &input.TimeoutInSeconds, + Wait: &input.Wait, } if input.Path != "" { @@ -857,6 +913,40 @@ func expandKustomizationDefinitionModel(inputList []KustomizationDefinitionModel return &outputList } +func expandPostBuildDefinitionModel(inputList []PostBuildDefinitionModel) *fluxconfiguration.PostBuildDefinition { + if len(inputList) == 0 { + return nil + } + + input := &inputList[0] + + output := fluxconfiguration.PostBuildDefinition{ + Substitute: &input.Substitute, + SubstituteFrom: expandSubstituteFromDefinitionModel(input.SubstituteFrom), + } + + return &output +} + +func expandSubstituteFromDefinitionModel(inputList []SubstituteFromDefinitionModel) *[]fluxconfiguration.SubstituteFromDefinition { + if len(inputList) == 0 { + return nil + } + + input := &inputList + output := make([]fluxconfiguration.SubstituteFromDefinition, 0) + + for _, v := range *input { + output = append(output, fluxconfiguration.SubstituteFromDefinition{ + Kind: &v.Kind, + Name: &v.Name, + Optional: &v.Optional, + }) + } + + return &output +} + func expandServicePrincipalDefinitionModel(inputList []ServicePrincipalDefinitionModel) *fluxconfiguration.ServicePrincipalDefinition { if len(inputList) == 0 { return nil @@ -1057,10 +1147,46 @@ func flattenKustomizationDefinitionModel(inputList *map[string]fluxconfiguration Force: pointer.From(input.Force), Name: pointer.From(input.Name), Path: pointer.From(input.Path), + PostBuild: flattenPostBuildDefinitionModel(input.PostBuild), Prune: pointer.From(input.Prune), RetryIntervalInSeconds: pointer.From(input.RetryIntervalInSeconds), SyncIntervalInSeconds: pointer.From(input.SyncIntervalInSeconds), TimeoutInSeconds: pointer.From(input.TimeoutInSeconds), + Wait: pointer.From(input.Wait), + } + + outputList = append(outputList, output) + } + + return outputList +} + +func flattenPostBuildDefinitionModel(input *fluxconfiguration.PostBuildDefinition) []PostBuildDefinitionModel { + outputList := make([]PostBuildDefinitionModel, 0) + + if input == nil { + return outputList + } + + output := PostBuildDefinitionModel{ + Substitute: pointer.From(input.Substitute), + SubstituteFrom: flattenSubstituteFromDefinitionModel(input.SubstituteFrom), + } + + return append(outputList, output) +} + +func flattenSubstituteFromDefinitionModel(input *[]fluxconfiguration.SubstituteFromDefinition) []SubstituteFromDefinitionModel { + outputList := make([]SubstituteFromDefinitionModel, 0) + if input == nil { + return outputList + } + + for _, v := range *input { + output := SubstituteFromDefinitionModel{ + Kind: pointer.From(v.Kind), + Name: pointer.From(v.Name), + Optional: pointer.From(v.Optional), } outputList = append(outputList, output) diff --git a/internal/services/containers/kubernetes_flux_configuration_resource_test.go b/internal/services/containers/kubernetes_flux_configuration_resource_test.go index fc3f4c3f18bb..0a5320f317d0 100644 --- a/internal/services/containers/kubernetes_flux_configuration_resource_test.go +++ b/internal/services/containers/kubernetes_flux_configuration_resource_test.go @@ -12,7 +12,7 @@ import ( "time" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2022-11-01/fluxconfiguration" + "github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" @@ -196,6 +196,20 @@ func TestAccKubernetesFluxConfiguration_kustomizationNameDuplicated(t *testing.T }) } +func TestAccKubernetesFluxConfiguration_kustomizationPostBuild(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_kubernetes_flux_configuration", "test") + r := KubernetesFluxConfigurationResource{} + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.kustomizationPostBuild(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func (r KubernetesFluxConfigurationResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := fluxconfiguration.ParseScopedFluxConfigurationID(state.ID) if err != nil { @@ -715,3 +729,43 @@ resource "azurerm_kubernetes_flux_configuration" "test" { } `, template, data.RandomInteger) } + +func (r KubernetesFluxConfigurationResource) kustomizationPostBuild(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` + %s + +resource "azurerm_kubernetes_flux_configuration" "test" { + name = "acctest-fc-%d" + cluster_id = azurerm_kubernetes_cluster.test.id + namespace = "flux" + + git_repository { + url = "https://github.com/Azure/arc-k8s-demo" + reference_type = "branch" + reference_value = "main" + } + + kustomizations { + name = "kustomization-1" + path = "./test/path" + postBuild = { + substitute = { + "key" = "value", + "key2" = "value2" + } + substituteFrom { + kind = "Secret" + name = "secret-name" + optional = false + } + } + wait = false + } + + depends_on = [ + azurerm_kubernetes_cluster_extension.test + ] +} +`, template, data.RandomInteger) +} From 878eed2fab33dceb734c44ad2857174906eb7395 Mon Sep 17 00:00:00 2001 From: jayctran Date: Tue, 18 Jun 2024 19:33:12 +1000 Subject: [PATCH 03/18] Added validation and documentation --- .../kubernetes_flux_configuration_resource.go | 27 ++++++++++++----- ...ubernetes_flux_configuration.html.markdown | 30 +++++++++++++++++++ 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/internal/services/containers/kubernetes_flux_configuration_resource.go b/internal/services/containers/kubernetes_flux_configuration_resource.go index 502baa8ad223..389958441ba4 100644 --- a/internal/services/containers/kubernetes_flux_configuration_resource.go +++ b/internal/services/containers/kubernetes_flux_configuration_resource.go @@ -242,7 +242,10 @@ func (r KubernetesFluxConfigurationResource) Arguments() map[string]*pluginsdk.S "substitute": { Type: pluginsdk.TypeMap, Optional: true, - Elem: &pluginsdk.Schema{Type: pluginsdk.TypeString}, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + ValidateFunc: validation.StringIsNotEmpty, + }, }, "substitute_from": { Type: pluginsdk.TypeList, @@ -250,16 +253,19 @@ func (r KubernetesFluxConfigurationResource) Arguments() map[string]*pluginsdk.S Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "kind": { - Type: pluginsdk.TypeString, - Required: true, + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, }, "name": { - Type: pluginsdk.TypeString, - Required: true, + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, }, "optional": { Type: pluginsdk.TypeBool, Optional: true, + Default: true, }, }, }, @@ -920,9 +926,14 @@ func expandPostBuildDefinitionModel(inputList []PostBuildDefinitionModel) *fluxc input := &inputList[0] - output := fluxconfiguration.PostBuildDefinition{ - Substitute: &input.Substitute, - SubstituteFrom: expandSubstituteFromDefinitionModel(input.SubstituteFrom), + output := fluxconfiguration.PostBuildDefinition{} + + if len(input.Substitute) > 0 { + output.Substitute = &input.Substitute + } + + if len(input.SubstituteFrom) > 0 { + output.SubstituteFrom = expandSubstituteFromDefinitionModel(input.SubstituteFrom) } return &output diff --git a/website/docs/r/kubernetes_flux_configuration.html.markdown b/website/docs/r/kubernetes_flux_configuration.html.markdown index 554da12c50a8..2e4299d52a54 100644 --- a/website/docs/r/kubernetes_flux_configuration.html.markdown +++ b/website/docs/r/kubernetes_flux_configuration.html.markdown @@ -54,6 +54,16 @@ resource "azurerm_kubernetes_flux_configuration" "example" { kustomizations { name = "kustomization-1" + + post_build { + substitute = { + example_var = "substitute_with_this" + } + substitute_from { + kind = "ConfigMap" + name = "example-configmap" + } + } } depends_on = [ @@ -104,6 +114,10 @@ A `kustomizations` block supports the following: * `depends_on` - (Optional) Specifies other kustomizations that this kustomization depends on. This kustomization will not reconcile until all dependencies have completed their reconciliation. +* `post_build` - (Optional) A `post_build` block as defined below. + +* `wait` - (Optional) Enable/disable health check for all Kubernetes objects created by this Kustomization. + --- An `blob_storage` block supports the following: @@ -192,6 +206,22 @@ A `git_repository` block supports the following: * `timeout_in_seconds` - (Optional) Specifies the maximum time to attempt to reconcile the cluster git repository source with the remote. Defaults to `600`. +--- + +A `post_build` block supports the following: +* `substitute` - (Optional) Specifies the key/value pairs holding the variables to be substituted in this Kustomization. + +* `substitute_from` - (Optional) A `substitute_from` block as defined below. + +--- + +A `substitute_from` block supports the following: +* `kind` - (Required) Define whether it is ConfigMap or Secret that holds the variables to be used in substitution. + +* `name` - (Required) Name of the ConfigMap/Secret that holds the variables to be used in substitution. + +* `optional` - (Optional) Set to True to proceed without ConfigMap/Secret, if it is not present. Defaults to `True`. + ## Attributes Reference In addition to the Arguments listed above - the following Attributes are exported: From 64d0de4f32104103d226644859cd2ba07a975719 Mon Sep 17 00:00:00 2001 From: jayctran Date: Tue, 18 Jun 2024 19:33:12 +1000 Subject: [PATCH 04/18] Fixed formatting --- .../kubernetes_flux_configuration_resource.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/internal/services/containers/kubernetes_flux_configuration_resource.go b/internal/services/containers/kubernetes_flux_configuration_resource.go index 389958441ba4..ccaf32cc0c4a 100644 --- a/internal/services/containers/kubernetes_flux_configuration_resource.go +++ b/internal/services/containers/kubernetes_flux_configuration_resource.go @@ -31,16 +31,15 @@ const ( ) type KubernetesFluxConfigurationModel struct { - Name string `tfschema:"name"` - ClusterID string `tfschema:"cluster_id"` - BlobStorage []AzureBlobDefinitionModel `tfschema:"blob_storage"` - Bucket []BucketDefinitionModel `tfschema:"bucket"` - GitRepository []GitRepositoryDefinitionModel `tfschema:"git_repository"` - Kustomizations []KustomizationDefinitionModel `tfschema:"kustomizations"` - Namespace string `tfschema:"namespace"` - - Scope string `tfschema:"scope"` - ContinuousReconciliationEnabled bool `tfschema:"continuous_reconciliation_enabled"` + Name string `tfschema:"name"` + ClusterID string `tfschema:"cluster_id"` + BlobStorage []AzureBlobDefinitionModel `tfschema:"blob_storage"` + Bucket []BucketDefinitionModel `tfschema:"bucket"` + GitRepository []GitRepositoryDefinitionModel `tfschema:"git_repository"` + Kustomizations []KustomizationDefinitionModel `tfschema:"kustomizations"` + Namespace string `tfschema:"namespace"` + Scope string `tfschema:"scope"` + ContinuousReconciliationEnabled bool `tfschema:"continuous_reconciliation_enabled"` } type AzureBlobDefinitionModel struct { From a0213e49af0275fa7727efe3ecc8e2df6f7fab12 Mon Sep 17 00:00:00 2001 From: jayctran Date: Tue, 18 Jun 2024 19:33:13 +1000 Subject: [PATCH 05/18] Fixed extra = typo in test --- .../kubernetes_flux_configuration_resource_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/services/containers/kubernetes_flux_configuration_resource_test.go b/internal/services/containers/kubernetes_flux_configuration_resource_test.go index 0a5320f317d0..449a5a1e41f6 100644 --- a/internal/services/containers/kubernetes_flux_configuration_resource_test.go +++ b/internal/services/containers/kubernetes_flux_configuration_resource_test.go @@ -749,15 +749,15 @@ resource "azurerm_kubernetes_flux_configuration" "test" { kustomizations { name = "kustomization-1" path = "./test/path" - postBuild = { + postBuild { substitute = { - "key" = "value", + "key" = "value", "key2" = "value2" } substituteFrom { - kind = "Secret" - name = "secret-name" - optional = false + kind = "Secret" + name = "secret-name" + optional = false } } wait = false From a99a3ed849d04d5576b5e46a470f3f2d747153e9 Mon Sep 17 00:00:00 2001 From: jayctran Date: Tue, 18 Jun 2024 19:33:13 +1000 Subject: [PATCH 06/18] Resolve vendor due to failing depscheck This reverts commit 7153acae2d157e07475e9a9dc45b0a2f12134c43. --- .../id_scopedfluxconfiguration_test.go | 222 ------------------ 1 file changed, 222 deletions(-) delete mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration_test.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration_test.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration_test.go deleted file mode 100644 index 3e7d649562e3..000000000000 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/id_scopedfluxconfiguration_test.go +++ /dev/null @@ -1,222 +0,0 @@ -package fluxconfiguration - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -var _ resourceids.ResourceId = &ScopedFluxConfigurationId{} - -func TestNewScopedFluxConfigurationID(t *testing.T) { - id := NewScopedFluxConfigurationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "fluxConfigurationValue") - - if id.Scope != "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'Scope'", id.Scope, "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") - } - - if id.FluxConfigurationName != "fluxConfigurationValue" { - t.Fatalf("Expected %q but got %q for Segment 'FluxConfigurationName'", id.FluxConfigurationName, "fluxConfigurationValue") - } -} - -func TestFormatScopedFluxConfigurationID(t *testing.T) { - actual := NewScopedFluxConfigurationID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "fluxConfigurationValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/fluxConfigurationValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseScopedFluxConfigurationID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ScopedFluxConfigurationId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/fluxConfigurationValue", - Expected: &ScopedFluxConfigurationId{ - Scope: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", - FluxConfigurationName: "fluxConfigurationValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/fluxConfigurationValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseScopedFluxConfigurationID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.Scope != v.Expected.Scope { - t.Fatalf("Expected %q but got %q for Scope", v.Expected.Scope, actual.Scope) - } - - if actual.FluxConfigurationName != v.Expected.FluxConfigurationName { - t.Fatalf("Expected %q but got %q for FluxConfigurationName", v.Expected.FluxConfigurationName, actual.FluxConfigurationName) - } - - } -} - -func TestParseScopedFluxConfigurationIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *ScopedFluxConfigurationId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs/mIcRoSoFt.kUbErNeTeScOnFiGuRaTiOn", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs/mIcRoSoFt.kUbErNeTeScOnFiGuRaTiOn/fLuXcOnFiGuRaTiOnS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/fluxConfigurationValue", - Expected: &ScopedFluxConfigurationId{ - Scope: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", - FluxConfigurationName: "fluxConfigurationValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/fluxConfigurationValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs/mIcRoSoFt.kUbErNeTeScOnFiGuRaTiOn/fLuXcOnFiGuRaTiOnS/fLuXcOnFiGuRaTiOnVaLuE", - Expected: &ScopedFluxConfigurationId{ - Scope: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp", - FluxConfigurationName: "fLuXcOnFiGuRaTiOnVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/sOmE-ReSoUrCe-gRoUp/pRoViDeRs/mIcRoSoFt.kUbErNeTeScOnFiGuRaTiOn/fLuXcOnFiGuRaTiOnS/fLuXcOnFiGuRaTiOnVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseScopedFluxConfigurationIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.Scope != v.Expected.Scope { - t.Fatalf("Expected %q but got %q for Scope", v.Expected.Scope, actual.Scope) - } - - if actual.FluxConfigurationName != v.Expected.FluxConfigurationName { - t.Fatalf("Expected %q but got %q for FluxConfigurationName", v.Expected.FluxConfigurationName, actual.FluxConfigurationName) - } - - } -} - -func TestSegmentsForScopedFluxConfigurationId(t *testing.T) { - segments := ScopedFluxConfigurationId{}.Segments() - if len(segments) == 0 { - t.Fatalf("ScopedFluxConfigurationId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} From 5380e82b589f1f97188b37730030ff886f04e6ff Mon Sep 17 00:00:00 2001 From: jayctran Date: Tue, 18 Jun 2024 19:33:13 +1000 Subject: [PATCH 07/18] Fixed gradually deprecated functions --- ...rnetes_flux_configuration_resource_test.go | 50 ++++++++++++++----- ...rnetes_flux_configuration_resource_test.go | 50 ++++++++++++++----- 2 files changed, 74 insertions(+), 26 deletions(-) diff --git a/internal/services/arckubernetes/arc_kubernetes_flux_configuration_resource_test.go b/internal/services/arckubernetes/arc_kubernetes_flux_configuration_resource_test.go index 7db4da1a79c6..3dac7219cc5f 100644 --- a/internal/services/arckubernetes/arc_kubernetes_flux_configuration_resource_test.go +++ b/internal/services/arckubernetes/arc_kubernetes_flux_configuration_resource_test.go @@ -517,6 +517,20 @@ func (r ArcKubernetesFluxConfigurationResource) azureBlobWithServicePrincipalSec return fmt.Sprintf(` %[1]s +provider "azuread" {} + +resource "azuread_application" "test" { + display_name = "acctestspa-%[2]d" +} + +resource "azuread_service_principal" "test" { + application_id = azuread_application.test.application_id +} + +resource "azuread_service_principal_password" "test" { + service_principal_id = azuread_service_principal.test.object_id +} + resource "azurerm_storage_account" "test" { name = "sa%[2]d" resource_group_name = azurerm_resource_group.test.name @@ -537,13 +551,13 @@ data "azurerm_client_config" "test" { resource "azurerm_role_assignment" "test_queue" { scope = azurerm_storage_account.test.id role_definition_name = "Storage Queue Data Contributor" - principal_id = data.azurerm_client_config.test.object_id + principal_id = azuread_service_principal.test.object_id } resource "azurerm_role_assignment" "test_blob" { scope = azurerm_storage_account.test.id role_definition_name = "Storage Blob Data Contributor" - principal_id = data.azurerm_client_config.test.object_id + principal_id = azuread_service_principal.test.object_id } resource "azurerm_arc_kubernetes_flux_configuration" "test" { @@ -554,9 +568,9 @@ resource "azurerm_arc_kubernetes_flux_configuration" "test" { blob_storage { container_id = azurerm_storage_container.test.id service_principal { - client_id = "%[3]s" - tenant_id = "%[4]s" - client_secret = "%[5]s" + client_id = azuread_service_principal.test.client_id + tenant_id = data.azurerm_client_config.test.tenant_id + client_secret = azuread_service_principal_password.test.value } } @@ -570,13 +584,23 @@ resource "azurerm_arc_kubernetes_flux_configuration" "test" { azurerm_role_assignment.test_blob ] } -`, r.template(data, credential, privateKey, publicKey), data.RandomInteger, os.Getenv("ARM_CLIENT_ID"), os.Getenv("ARM_TENANT_ID"), os.Getenv("ARM_CLIENT_SECRET")) +`, r.template(data, credential, privateKey, publicKey), data.RandomInteger) } func (r ArcKubernetesFluxConfigurationResource) azureBlobWithServicePrincipalCertificate(data acceptance.TestData, credential string, privateKey string, publicKey string) string { return fmt.Sprintf(` %[1]s +provider "azuread" {} + +resource "azuread_application" "test" { + display_name = "acctestspa-%[2]d" +} + +resource "azuread_service_principal" "test" { + application_id = azuread_application.test.application_id +} + resource "azurerm_storage_account" "test" { name = "sa%[2]d" resource_group_name = azurerm_resource_group.test.name @@ -597,13 +621,13 @@ data "azurerm_client_config" "test" { resource "azurerm_role_assignment" "test_queue" { scope = azurerm_storage_account.test.id role_definition_name = "Storage Queue Data Contributor" - principal_id = data.azurerm_client_config.test.object_id + principal_id = azuread_service_principal.test.object_id } resource "azurerm_role_assignment" "test_blob" { scope = azurerm_storage_account.test.id role_definition_name = "Storage Blob Data Contributor" - principal_id = data.azurerm_client_config.test.object_id + principal_id = azuread_service_principal.test.object_id } resource "azurerm_arc_kubernetes_flux_configuration" "test" { @@ -614,10 +638,10 @@ resource "azurerm_arc_kubernetes_flux_configuration" "test" { blob_storage { container_id = azurerm_storage_container.test.id service_principal { - client_id = "%[3]s" - tenant_id = "%[4]s" - client_certificate_base64 = "%[5]s" - client_certificate_password = "%[6]s" + client_id = azuread_service_principal.test.client_id + tenant_id = data.azurerm_client_config.test.tenant_id + client_certificate_base64 = "%[3]s" + client_certificate_password = "%[4]s" client_certificate_send_chain = true } } @@ -632,7 +656,7 @@ resource "azurerm_arc_kubernetes_flux_configuration" "test" { azurerm_role_assignment.test_blob ] } -`, r.template(data, credential, privateKey, publicKey), data.RandomInteger, os.Getenv("ARM_CLIENT_ID"), os.Getenv("ARM_TENANT_ID"), os.Getenv("ARM_CLIENT_CERTIFICATE"), os.Getenv("ARM_CLIENT_CERTIFICATE_PASSWORD")) +`, r.template(data, credential, privateKey, publicKey), data.RandomInteger, os.Getenv("ARM_CLIENT_CERTIFICATE"), os.Getenv("ARM_CLIENT_CERTIFICATE_PASSWORD")) } func (r ArcKubernetesFluxConfigurationResource) kustomizationNameDuplicated(data acceptance.TestData, credential string, privateKey string, publicKey string) string { diff --git a/internal/services/containers/kubernetes_flux_configuration_resource_test.go b/internal/services/containers/kubernetes_flux_configuration_resource_test.go index 449a5a1e41f6..db47480462e1 100644 --- a/internal/services/containers/kubernetes_flux_configuration_resource_test.go +++ b/internal/services/containers/kubernetes_flux_configuration_resource_test.go @@ -580,6 +580,20 @@ func (r KubernetesFluxConfigurationResource) azureBlobWithServicePrincipalSecret return fmt.Sprintf(` %[1]s +provider "azuread" {} + +resource "azuread_application" "test" { + display_name = "acctestspa-%[2]d" +} + +resource "azuread_service_principal" "test" { + application_id = azuread_application.test.application_id +} + +resource "azuread_service_principal_password" "test" { + service_principal_id = azuread_service_principal.test.object_id +} + resource "azurerm_storage_account" "test" { name = "sa%[2]d" resource_group_name = azurerm_resource_group.test.name @@ -600,13 +614,13 @@ data "azurerm_client_config" "test" { resource "azurerm_role_assignment" "test_queue" { scope = azurerm_storage_account.test.id role_definition_name = "Storage Queue Data Contributor" - principal_id = data.azurerm_client_config.test.object_id + principal_id = azuread_service_principal.test.object_id } resource "azurerm_role_assignment" "test_blob" { scope = azurerm_storage_account.test.id role_definition_name = "Storage Blob Data Contributor" - principal_id = data.azurerm_client_config.test.object_id + principal_id = azuread_service_principal.test.object_id } resource "azurerm_kubernetes_flux_configuration" "test" { @@ -617,9 +631,9 @@ resource "azurerm_kubernetes_flux_configuration" "test" { blob_storage { container_id = azurerm_storage_container.test.id service_principal { - client_id = "%[3]s" - tenant_id = "%[4]s" - client_secret = "%[5]s" + client_id = azuread_service_principal.test.client_id + tenant_id = data.azurerm_client_config.test.tenant_id + client_secret = azuread_service_principal_password.test.value } } @@ -633,13 +647,23 @@ resource "azurerm_kubernetes_flux_configuration" "test" { azurerm_role_assignment.test_blob ] } -`, r.template(data), data.RandomInteger, os.Getenv("ARM_CLIENT_ID"), os.Getenv("ARM_TENANT_ID"), os.Getenv("ARM_CLIENT_SECRET")) +`, r.template(data), data.RandomInteger) } func (r KubernetesFluxConfigurationResource) azureBlobWithServicePrincipalCertificate(data acceptance.TestData) string { return fmt.Sprintf(` %[1]s +provider "azuread" {} + +resource "azuread_application" "test" { + display_name = "acctestspa-%[2]d" +} + +resource "azuread_service_principal" "test" { + application_id = azuread_application.test.application_id +} + resource "azurerm_storage_account" "test" { name = "sa%[2]d" resource_group_name = azurerm_resource_group.test.name @@ -660,13 +684,13 @@ data "azurerm_client_config" "test" { resource "azurerm_role_assignment" "test_queue" { scope = azurerm_storage_account.test.id role_definition_name = "Storage Queue Data Contributor" - principal_id = data.azurerm_client_config.test.object_id + principal_id = azuread_service_principal.test.object_id } resource "azurerm_role_assignment" "test_blob" { scope = azurerm_storage_account.test.id role_definition_name = "Storage Blob Data Contributor" - principal_id = data.azurerm_client_config.test.object_id + principal_id = azuread_service_principal.test.object_id } resource "azurerm_kubernetes_flux_configuration" "test" { @@ -677,10 +701,10 @@ resource "azurerm_kubernetes_flux_configuration" "test" { blob_storage { container_id = azurerm_storage_container.test.id service_principal { - client_id = "%[3]s" - tenant_id = "%[4]s" - client_certificate_base64 = "%[5]s" - client_certificate_password = "%[6]s" + client_id = azuread_service_principal.test.client_id + tenant_id = data.azurerm_client_config.test.tenant_id + client_certificate_base64 = "%[3]s" + client_certificate_password = "%[4]s" client_certificate_send_chain = true } } @@ -695,7 +719,7 @@ resource "azurerm_kubernetes_flux_configuration" "test" { azurerm_role_assignment.test_blob ] } -`, r.template(data), data.RandomInteger, os.Getenv("ARM_CLIENT_ID"), os.Getenv("ARM_TENANT_ID"), os.Getenv("ARM_CLIENT_CERTIFICATE"), os.Getenv("ARM_CLIENT_CERTIFICATE_PASSWORD")) +`, r.template(data), data.RandomInteger, os.Getenv("ARM_CLIENT_CERTIFICATE"), os.Getenv("ARM_CLIENT_CERTIFICATE_PASSWORD")) } func (r KubernetesFluxConfigurationResource) kustomizationNameDuplicated(data acceptance.TestData) string { From 247896cf12b4dc07b13d361368e2e34c0816dd9a Mon Sep 17 00:00:00 2001 From: jayctran Date: Mon, 24 Jun 2024 13:35:22 +1000 Subject: [PATCH 08/18] Typo in test --- .../containers/kubernetes_flux_configuration_resource_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/services/containers/kubernetes_flux_configuration_resource_test.go b/internal/services/containers/kubernetes_flux_configuration_resource_test.go index db47480462e1..e9fa1d9cef88 100644 --- a/internal/services/containers/kubernetes_flux_configuration_resource_test.go +++ b/internal/services/containers/kubernetes_flux_configuration_resource_test.go @@ -773,12 +773,12 @@ resource "azurerm_kubernetes_flux_configuration" "test" { kustomizations { name = "kustomization-1" path = "./test/path" - postBuild { + post_build { substitute = { "key" = "value", "key2" = "value2" } - substituteFrom { + substitute_from { kind = "Secret" name = "secret-name" optional = false From 0677fcdc94fb792c272cabbea3a8e21cabac2562 Mon Sep 17 00:00:00 2001 From: James Tran Date: Tue, 29 Oct 2024 17:52:04 +1000 Subject: [PATCH 09/18] Update documentation for name field in postBuild Co-authored-by: Zhenhua Hu --- website/docs/r/kubernetes_flux_configuration.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/kubernetes_flux_configuration.html.markdown b/website/docs/r/kubernetes_flux_configuration.html.markdown index 2e4299d52a54..04736e046c77 100644 --- a/website/docs/r/kubernetes_flux_configuration.html.markdown +++ b/website/docs/r/kubernetes_flux_configuration.html.markdown @@ -218,7 +218,7 @@ A `post_build` block supports the following: A `substitute_from` block supports the following: * `kind` - (Required) Define whether it is ConfigMap or Secret that holds the variables to be used in substitution. -* `name` - (Required) Name of the ConfigMap/Secret that holds the variables to be used in substitution. +* `name` - (Required) Specifies the name of the ConfigMap/Secret that holds the variables to be used in substitution. * `optional` - (Optional) Set to True to proceed without ConfigMap/Secret, if it is not present. Defaults to `True`. From b257673f7579fcada2580b6d6e9a56c68a014c17 Mon Sep 17 00:00:00 2001 From: jayctran Date: Fri, 1 Nov 2024 00:28:02 +1000 Subject: [PATCH 10/18] Updated defaults and kind validation --- .../kubernetes_flux_configuration_resource.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/internal/services/containers/kubernetes_flux_configuration_resource.go b/internal/services/containers/kubernetes_flux_configuration_resource.go index ccaf32cc0c4a..7a3159088bd3 100644 --- a/internal/services/containers/kubernetes_flux_configuration_resource.go +++ b/internal/services/containers/kubernetes_flux_configuration_resource.go @@ -30,6 +30,11 @@ const ( FluxGitSemverRange string = "semver" ) +const ( + SubstituteFromKindConfigMap string = "ConfigMap" + SubstituteFromKindSecret string = "Secret" +) + type KubernetesFluxConfigurationModel struct { Name string `tfschema:"name"` ClusterID string `tfschema:"cluster_id"` @@ -252,9 +257,12 @@ func (r KubernetesFluxConfigurationResource) Arguments() map[string]*pluginsdk.S Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "kind": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringIsNotEmpty, + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice([]string{ + SubstituteFromKindConfigMap, + SubstituteFromKindSecret, + }, false), }, "name": { Type: pluginsdk.TypeString, @@ -264,7 +272,7 @@ func (r KubernetesFluxConfigurationResource) Arguments() map[string]*pluginsdk.S "optional": { Type: pluginsdk.TypeBool, Optional: true, - Default: true, + Default: false, }, }, }, @@ -275,7 +283,7 @@ func (r KubernetesFluxConfigurationResource) Arguments() map[string]*pluginsdk.S "wait": { Type: pluginsdk.TypeBool, Optional: true, - Default: false, + Default: true, }, }, }, From 311f07d77b5d52556e51e49043cb29ee0fc81711 Mon Sep 17 00:00:00 2001 From: James Tran Date: Sun, 3 Nov 2024 17:25:18 +1000 Subject: [PATCH 11/18] Update docs wait description Co-authored-by: Zhenhua Hu --- website/docs/r/kubernetes_flux_configuration.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/kubernetes_flux_configuration.html.markdown b/website/docs/r/kubernetes_flux_configuration.html.markdown index 04736e046c77..b4119e5693a6 100644 --- a/website/docs/r/kubernetes_flux_configuration.html.markdown +++ b/website/docs/r/kubernetes_flux_configuration.html.markdown @@ -116,7 +116,7 @@ A `kustomizations` block supports the following: * `post_build` - (Optional) A `post_build` block as defined below. -* `wait` - (Optional) Enable/disable health check for all Kubernetes objects created by this Kustomization. +* `wait` - (Optional) Whether to enable health check for all Kubernetes objects created by this Kustomization. Defaults to `true`. --- From d7778aad0476a5fd2650540e19aab5f38373d620 Mon Sep 17 00:00:00 2001 From: James Tran Date: Sun, 3 Nov 2024 17:25:55 +1000 Subject: [PATCH 12/18] Update docs substitute_from kind description Co-authored-by: Zhenhua Hu --- website/docs/r/kubernetes_flux_configuration.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/kubernetes_flux_configuration.html.markdown b/website/docs/r/kubernetes_flux_configuration.html.markdown index b4119e5693a6..d302808d2e0c 100644 --- a/website/docs/r/kubernetes_flux_configuration.html.markdown +++ b/website/docs/r/kubernetes_flux_configuration.html.markdown @@ -216,7 +216,7 @@ A `post_build` block supports the following: --- A `substitute_from` block supports the following: -* `kind` - (Required) Define whether it is ConfigMap or Secret that holds the variables to be used in substitution. +* `kind` - (Required) Specifies the source kind to hold the variables to be used in substitution. Possible values are `ConfigMap` and `Secret`. * `name` - (Required) Specifies the name of the ConfigMap/Secret that holds the variables to be used in substitution. From 5840c5aa6ebc632ea38875377853f787b3d6e34a Mon Sep 17 00:00:00 2001 From: James Tran Date: Sun, 3 Nov 2024 17:26:23 +1000 Subject: [PATCH 13/18] Update docs substitute_from optional description Co-authored-by: Zhenhua Hu --- website/docs/r/kubernetes_flux_configuration.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/kubernetes_flux_configuration.html.markdown b/website/docs/r/kubernetes_flux_configuration.html.markdown index d302808d2e0c..7500fafa3f65 100644 --- a/website/docs/r/kubernetes_flux_configuration.html.markdown +++ b/website/docs/r/kubernetes_flux_configuration.html.markdown @@ -220,7 +220,7 @@ A `substitute_from` block supports the following: * `name` - (Required) Specifies the name of the ConfigMap/Secret that holds the variables to be used in substitution. -* `optional` - (Optional) Set to True to proceed without ConfigMap/Secret, if it is not present. Defaults to `True`. +* `optional` - (Optional) Whether to proceed without ConfigMap/Secret if it is not present. Defaults to `false`. ## Attributes Reference From 6ea3b020d6a85547cacb1379ff2b82acd74e35ce Mon Sep 17 00:00:00 2001 From: jayctran Date: Mon, 6 Jan 2025 22:50:27 +1000 Subject: [PATCH 14/18] Fixed depscheck --- .../2023-05-01/fluxconfiguration/README.md | 2 +- .../2023-05-01/fluxconfiguration/version.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/README.md index ca3e11b12d5b..a6b33bfc9568 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/README.md @@ -1,7 +1,7 @@ ## `github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration` Documentation -The `fluxconfiguration` SDK allows for interaction with Azure Resource Manager`kubernetesconfiguration` (API Version `2023-05-01`). +The `fluxconfiguration` SDK allows for interaction with Azure Resource Manager `kubernetesconfiguration` (API Version `2023-05-01`). This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/version.go index f48af596ded1..cc1a17da5fda 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/kubernetesconfiguration/2023-05-01/fluxconfiguration/version.go @@ -6,5 +6,5 @@ package fluxconfiguration const defaultApiVersion = "2023-05-01" func userAgent() string { - return "hashicorp/go-azure-sdk/fluxconfiguration/2022-11-01" + return "hashicorp/go-azure-sdk/fluxconfiguration/2023-05-01" } From 64bb190d60c54b774cdd87aa9611d8c9f1e82bb9 Mon Sep 17 00:00:00 2001 From: James Tran Date: Fri, 10 Jan 2025 02:09:52 +1000 Subject: [PATCH 15/18] Update internal/services/containers/kubernetes_flux_configuration_resource.go Co-authored-by: stephybun --- .../containers/kubernetes_flux_configuration_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/containers/kubernetes_flux_configuration_resource.go b/internal/services/containers/kubernetes_flux_configuration_resource.go index 7a3159088bd3..3f5de8226fa6 100644 --- a/internal/services/containers/kubernetes_flux_configuration_resource.go +++ b/internal/services/containers/kubernetes_flux_configuration_resource.go @@ -931,7 +931,7 @@ func expandPostBuildDefinitionModel(inputList []PostBuildDefinitionModel) *fluxc return nil } - input := &inputList[0] + input := inputList[0] output := fluxconfiguration.PostBuildDefinition{} From 8ff059a7a4f258f97f5af18bdee863e5c20fbf62 Mon Sep 17 00:00:00 2001 From: James Tran Date: Fri, 10 Jan 2025 02:11:50 +1000 Subject: [PATCH 16/18] Update internal/services/containers/kubernetes_flux_configuration_resource.go Co-authored-by: stephybun --- .../containers/kubernetes_flux_configuration_resource.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/services/containers/kubernetes_flux_configuration_resource.go b/internal/services/containers/kubernetes_flux_configuration_resource.go index 3f5de8226fa6..7f02cd75f200 100644 --- a/internal/services/containers/kubernetes_flux_configuration_resource.go +++ b/internal/services/containers/kubernetes_flux_configuration_resource.go @@ -951,10 +951,10 @@ func expandSubstituteFromDefinitionModel(inputList []SubstituteFromDefinitionMod return nil } - input := &inputList + input := inputList output := make([]fluxconfiguration.SubstituteFromDefinition, 0) - for _, v := range *input { + for _, v := range input { output = append(output, fluxconfiguration.SubstituteFromDefinition{ Kind: &v.Kind, Name: &v.Name, From 00be824fdaea6b2ecbfd8d7c223e9d21c37777ac Mon Sep 17 00:00:00 2001 From: James Tran Date: Fri, 10 Jan 2025 02:12:05 +1000 Subject: [PATCH 17/18] Update website/docs/r/kubernetes_flux_configuration.html.markdown Co-authored-by: stephybun --- website/docs/r/kubernetes_flux_configuration.html.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/r/kubernetes_flux_configuration.html.markdown b/website/docs/r/kubernetes_flux_configuration.html.markdown index 7500fafa3f65..07e003f7a3b1 100644 --- a/website/docs/r/kubernetes_flux_configuration.html.markdown +++ b/website/docs/r/kubernetes_flux_configuration.html.markdown @@ -209,6 +209,7 @@ A `git_repository` block supports the following: --- A `post_build` block supports the following: + * `substitute` - (Optional) Specifies the key/value pairs holding the variables to be substituted in this Kustomization. * `substitute_from` - (Optional) A `substitute_from` block as defined below. From e1667a790f51107ae1b13c533cf97ffc392cb6cf Mon Sep 17 00:00:00 2001 From: James Tran Date: Fri, 10 Jan 2025 02:12:21 +1000 Subject: [PATCH 18/18] Update website/docs/r/kubernetes_flux_configuration.html.markdown Co-authored-by: stephybun --- website/docs/r/kubernetes_flux_configuration.html.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/website/docs/r/kubernetes_flux_configuration.html.markdown b/website/docs/r/kubernetes_flux_configuration.html.markdown index 07e003f7a3b1..fac8c6001920 100644 --- a/website/docs/r/kubernetes_flux_configuration.html.markdown +++ b/website/docs/r/kubernetes_flux_configuration.html.markdown @@ -217,6 +217,7 @@ A `post_build` block supports the following: --- A `substitute_from` block supports the following: + * `kind` - (Required) Specifies the source kind to hold the variables to be used in substitution. Possible values are `ConfigMap` and `Secret`. * `name` - (Required) Specifies the name of the ConfigMap/Secret that holds the variables to be used in substitution.