From f121fc0b25022151d7593a38a398176f90d9b442 Mon Sep 17 00:00:00 2001 From: Ales Stimec Date: Mon, 16 Dec 2024 08:15:51 +0100 Subject: [PATCH] fix: kubernetes cloud resource --- internal/provider/resource_kubernetes_cloud.go | 12 ++++++++---- internal/provider/resource_kubernetes_cloud_test.go | 8 ++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/provider/resource_kubernetes_cloud.go b/internal/provider/resource_kubernetes_cloud.go index d7a5858a..9f4a6932 100644 --- a/internal/provider/resource_kubernetes_cloud.go +++ b/internal/provider/resource_kubernetes_cloud.go @@ -128,8 +128,10 @@ func (r *kubernetesCloudResource) Create(ctx context.Context, req resource.Creat // Create the kubernetes cloud. cloudCredentialName, err := r.client.Clouds.CreateKubernetesCloud( &juju.CreateKubernetesCloudInput{ - Name: plan.CloudName.ValueString(), - KubernetesConfig: plan.KubernetesConfig.ValueString(), + Name: plan.CloudName.ValueString(), + KubernetesConfig: plan.KubernetesConfig.ValueString(), + ParentCloudName: plan.ParentCloudName.String(), + ParentCloudRegion: plan.ParentCloudRegion.String(), }, ) if err != nil { @@ -201,8 +203,10 @@ func (r *kubernetesCloudResource) Update(ctx context.Context, req resource.Updat // Update the kubernetes cloud. err := r.client.Clouds.UpdateKubernetesCloud( juju.UpdateKubernetesCloudInput{ - Name: plan.CloudName.ValueString(), - KubernetesConfig: plan.KubernetesConfig.ValueString(), + Name: plan.CloudName.ValueString(), + KubernetesConfig: plan.KubernetesConfig.ValueString(), + ParentCloudName: plan.ParentCloudName.String(), + ParentCloudRegion: plan.ParentCloudRegion.String(), }, ) if err != nil { diff --git a/internal/provider/resource_kubernetes_cloud_test.go b/internal/provider/resource_kubernetes_cloud_test.go index 5a6aafc1..4bb46373 100644 --- a/internal/provider/resource_kubernetes_cloud_test.go +++ b/internal/provider/resource_kubernetes_cloud_test.go @@ -14,12 +14,6 @@ import ( ) func TestAcc_ResourceKubernetesCloud(t *testing.T) { - // Note (alesstimec): Skipping this test, because the default - // hosted cloud tf provider adds is "other", which cannot - // be parsed by JIMM - it needs a valid cloud/region to determine - // which controller to add the cloud to. - SkipJAAS(t) - // TODO: This test is not adding model as a resource, which is required. // The reason in the race that we (potentially) have in the Juju side. // Once the problem is fixed (https://bugs.launchpad.net/juju/+bug/2084448), @@ -51,6 +45,8 @@ func testAccResourceKubernetesCloudWithoutModel(cloudName string, config string) resource "juju_kubernetes_cloud" "{{.CloudName}}" { name = "{{.CloudName}}" kubernetes_config = file("~/microk8s-config.yaml") + parent_cloud_name = "localhost" + parent_cloud_region = "localhost" } `, internaltesting.TemplateData{ "CloudName": cloudName,