Skip to content

Commit

Permalink
fix: kubernetes cloud resource
Browse files Browse the repository at this point in the history
  • Loading branch information
alesstimec committed Dec 16, 2024
1 parent 54f8588 commit f121fc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 8 additions & 4 deletions internal/provider/resource_kubernetes_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 2 additions & 6 deletions internal/provider/resource_kubernetes_cloud_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit f121fc0

Please sign in to comment.