diff --git a/cloud/resource_cloud_environment.go b/cloud/resource_cloud_environment.go index 3d9f8d8..ce60ab6 100644 --- a/cloud/resource_cloud_environment.go +++ b/cloud/resource_cloud_environment.go @@ -107,6 +107,7 @@ func resourceCloudEnvironment() *schema.Resource { "network": { Type: schema.TypeList, Required: true, + MaxItems: 1, Description: descriptions["network"], Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -254,6 +255,16 @@ func resourceCloudEnvironmentCreate(ctx context.Context, d *schema.ResourceData, return diag.FromErr(fmt.Errorf("ERROR_CREATE_CLOUD_ENVIRONMENT: " + "One of network.id or network.cidr must be set")) } + if cloudEnvironment.Spec.Network.ID != "" { + cc, err := clientSet.CloudV1alpha1().CloudConnections(namespace).Get(ctx, cloudConnectionName, metav1.GetOptions{}) + if err != nil { + return diag.FromErr(err) + } + if cc.Spec.ConnectionType == cloudv1alpha1.ConnectionTypeAzure { + return diag.FromErr(fmt.Errorf("ERROR_CREATE_CLOUD_ENVIRONMENT: Azure doesn't support specify network id yet. Please use network cidr")) + } + } + expandDns := func() error { for _, l := range dns { if l == nil { diff --git a/cloud/resource_pulsar_cluster.go b/cloud/resource_pulsar_cluster.go index 9c4b704..a3e5198 100644 --- a/cloud/resource_pulsar_cluster.go +++ b/cloud/resource_pulsar_cluster.go @@ -106,6 +106,9 @@ func resourcePulsarCluster() *schema.Resource { Default: "rapid", Description: descriptions["release_channel"], ValidateFunc: validateReleaseChannel, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless) + }, }, "bookie_replicas": { Type: schema.TypeInt, @@ -113,6 +116,9 @@ func resourcePulsarCluster() *schema.Resource { Default: 3, Description: descriptions["bookie_replicas"], ValidateFunc: validateBookieReplicas, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless) + }, }, "broker_replicas": { Type: schema.TypeInt, @@ -120,6 +126,9 @@ func resourcePulsarCluster() *schema.Resource { Default: 2, Description: descriptions["broker_replicas"], ValidateFunc: validateBrokerReplicas, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless) + }, }, "compute_unit": { Type: schema.TypeFloat, @@ -127,6 +136,9 @@ func resourcePulsarCluster() *schema.Resource { Default: 0.5, Description: descriptions["compute_unit"], ValidateFunc: validateCUSU, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless) + }, }, "storage_unit": { Type: schema.TypeFloat, @@ -134,10 +146,16 @@ func resourcePulsarCluster() *schema.Resource { Default: 0.5, Description: descriptions["storage_unit"], ValidateFunc: validateCUSU, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless) + }, }, "config": { Type: schema.TypeList, Optional: true, + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("type") == string(cloudv1alpha1.PulsarInstanceTypeServerless) + }, MinItems: 0, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{