diff --git a/internal/juju/kubernetes_clouds.go b/internal/juju/kubernetes_clouds.go index 8835e41a..f16fe099 100644 --- a/internal/juju/kubernetes_clouds.go +++ b/internal/juju/kubernetes_clouds.go @@ -167,12 +167,19 @@ func (c *kubernetesCloudsClient) UpdateKubernetesCloud(input UpdateKubernetesClo k8sContextName = input.KubernetesContextName } + var hostCloudRegion string + if input.ParentCloudName != "" || input.ParentCloudRegion != "" { + hostCloudRegion = input.ParentCloudName + "/" + input.ParentCloudRegion + } else { + hostCloudRegion = k8s.K8sCloudOther + } + newCloud, err := k8scloud.CloudFromKubeConfigContext( k8sContextName, &apiConf, k8scloud.CloudParamaters{ Name: input.Name, - HostCloudRegion: k8s.K8sCloudOther, + HostCloudRegion: hostCloudRegion, }, ) if err != nil { diff --git a/internal/provider/resource_kubernetes_cloud.go b/internal/provider/resource_kubernetes_cloud.go index 19591c8f..377574d9 100644 --- a/internal/provider/resource_kubernetes_cloud.go +++ b/internal/provider/resource_kubernetes_cloud.go @@ -81,19 +81,19 @@ func (r *kubernetesCloudResource) Schema(_ context.Context, req resource.SchemaR stringplanmodifier.RequiresReplace(), }, }, - "kubernetesconfig": schema.StringAttribute{ + "kubernetes_config": schema.StringAttribute{ Description: "The kubernetes config file path for the cloud.", Optional: true, Sensitive: true, }, - "parentcloudname": schema.StringAttribute{ + "parent_cloud_name": schema.StringAttribute{ Description: "The parent cloud name in case adding k8s cluster from existed cloud. Changing this value will cause the cloud to be destroyed and recreated by terraform.", Optional: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.RequiresReplace(), }, }, - "parentcloudregion": schema.StringAttribute{ + "parent_cloud_region": schema.StringAttribute{ Description: "The parent cloud region name in case adding k8s cluster from existed cloud. Changing this value will cause the cloud to be destroyed and recreated by terraform.", Optional: true, PlanModifiers: []planmodifier.String{